Commit f970087
authored
deps: V8: backport 93b1a74cbc9b
Original commit message:
Reland "[api] allow v8::Data as internal field"
This is a reland of commit 0aa622e12893e9921c01a34ce9507b544e599c4a
The original patch tried to run a test that calls exit() in the
fatal error handler in parallel, which would not work. This marked
the test with TEST() to avoid running it in parallel.
Original change's description:
> [api] allow v8::Data as internal field
>
> Previously only v8::Value can be stored as internal fields.
> In some cases, however, it's necessary for the embedder to
> tie the lifetime of a v8::Data with the lifetime of a
> JS object, and that v8::Data may not be a v8::Value, as
> it can be something returned from the V8 API. One way to
> keep the v8::Data alive may be to use a v8::Persistent<v8::Data>
> but that can easily lead to leaks.
>
> This patch changes v8::Object::GetInternalField() and
> v8::Object::SetInernalField() to accept v8::Data instead of just
> v8::Value, so that v8::Data can kept alive by a JS object in
> a way that the GC can be aware of to address this problem.
> This is a breaking change for embedders
> using v8::Object::GetInternalField() as it changes the return
> type. Since most v8::Value subtypes only support direct casts
> from v8::Value but not v8::Data, calls like
>
> object->GetInternalField(index).As<v8::External>()
>
> needs to be updated to cast the value to v8::Value first:
>
> object->GetInternalField(index).As<v8::Value>().As<v8::External>()
>
> Bug: v8:14120
> Change-Id: I731c958d1756b9d5ee4a3e78813416cd60d1b7ca
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4707972
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Joyee Cheung <joyee@igalia.com>
> Cr-Commit-Position: refs/heads/main@{#89718}
Bug: v8:14120
Change-Id: I3e45d09b5c300d5eefc73e380ef21ac2bd61760c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4834471
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89824}
Refs: v8/v8@93b1a74
PR-URL: #49419
Refs: v8/v8@0aa622e
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>1 parent a3020dd commit f970087Copy full SHA for f970087
File tree
Expand file treeCollapse file tree
8 files changed
+103
-36
lines changedOpen diff view settings
Filter options
- deps/v8
- include
- samples
- src/api
- test
- cctest
- unittests/objects
Expand file treeCollapse file tree
8 files changed
+103
-36
lines changedOpen diff view settings
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | | - |
| 39 | + |
40 | 40 | |
41 | 41 | |
42 | 42 | |
|
Collapse file
deps/v8/include/v8-object.h
Copy file name to clipboardExpand all lines: deps/v8/include/v8-object.h+17-8Lines changed: 17 additions & 8 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
474 | 474 | |
475 | 475 | |
476 | 476 | |
477 | | - |
478 | | - |
| 477 | + |
| 478 | + |
| 479 | + |
| 480 | + |
| 481 | + |
| 482 | + |
| 483 | + |
| 484 | + |
| 485 | + |
| 486 | + |
| 487 | + |
479 | 488 | |
480 | | - |
481 | | - |
| 489 | + |
| 490 | + |
482 | 491 | |
483 | 492 | |
484 | 493 | |
| ||
710 | 719 | |
711 | 720 | |
712 | 721 | |
713 | | - |
| 722 | + |
714 | 723 | |
715 | 724 | |
716 | 725 | |
717 | 726 | |
718 | 727 | |
719 | | - |
| 728 | + |
720 | 729 | |
721 | 730 | |
722 | 731 | |
| ||
734 | 743 | |
735 | 744 | |
736 | 745 | |
737 | | - |
| 746 | + |
738 | 747 | |
739 | 748 | |
740 | 749 | |
741 | 750 | |
742 | | - |
| 751 | + |
743 | 752 | |
744 | 753 | |
745 | 754 | |
|
Collapse file
+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
388 | 388 | |
389 | 389 | |
390 | 390 | |
391 | | - |
| 391 | + |
392 | 392 | |
393 | 393 | |
394 | 394 | |
| ||
504 | 504 | |
505 | 505 | |
506 | 506 | |
507 | | - |
| 507 | + |
508 | 508 | |
509 | 509 | |
510 | 510 | |
|
Collapse file
+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6342 | 6342 | |
6343 | 6343 | |
6344 | 6344 | |
6345 | | - |
| 6345 | + |
6346 | 6346 | |
6347 | 6347 | |
6348 | 6348 | |
6349 | 6349 | |
6350 | 6350 | |
6351 | | - |
| 6351 | + |
6352 | 6352 | |
6353 | 6353 | |
6354 | | - |
| 6354 | + |
6355 | 6355 | |
6356 | 6356 | |
6357 | 6357 | |
|
Collapse file
deps/v8/test/cctest/test-api.cc
Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-api.cc+55-9Lines changed: 55 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2874 | 2874 | |
2875 | 2875 | |
2876 | 2876 | |
| 2877 | + |
| 2878 | + |
| 2879 | + |
| 2880 | + |
| 2881 | + |
| 2882 | + |
| 2883 | + |
| 2884 | + |
| 2885 | + |
| 2886 | + |
| 2887 | + |
| 2888 | + |
| 2889 | + |
| 2890 | + |
| 2891 | + |
| 2892 | + |
| 2893 | + |
| 2894 | + |
| 2895 | + |
| 2896 | + |
| 2897 | + |
| 2898 | + |
| 2899 | + |
| 2900 | + |
| 2901 | + |
| 2902 | + |
| 2903 | + |
| 2904 | + |
| 2905 | + |
| 2906 | + |
| 2907 | + |
| 2908 | + |
| 2909 | + |
| 2910 | + |
| 2911 | + |
| 2912 | + |
| 2913 | + |
2877 | 2914 | |
2878 | 2915 | |
2879 | 2916 | |
| ||
2887 | 2924 | |
2888 | 2925 | |
2889 | 2926 | |
2890 | | - |
| 2927 | + |
2891 | 2928 | |
2892 | | - |
| 2929 | + |
| 2930 | + |
| 2931 | + |
| 2932 | + |
2893 | 2933 | |
2894 | 2934 | |
2895 | 2935 | |
| ||
2915 | 2955 | |
2916 | 2956 | |
2917 | 2957 | |
2918 | | - |
| 2958 | + |
2919 | 2959 | |
2920 | 2960 | |
2921 | 2961 | |
2922 | 2962 | |
2923 | 2963 | |
2924 | | - |
2925 | | - |
| 2964 | + |
| 2965 | + |
| 2966 | + |
| 2967 | + |
2926 | 2968 | |
2927 | 2969 | |
2928 | 2970 | |
| ||
3022 | 3064 | |
3023 | 3065 | |
3024 | 3066 | |
3025 | | - |
| 3067 | + |
3026 | 3068 | |
3027 | | - |
| 3069 | + |
| 3070 | + |
| 3071 | + |
| 3072 | + |
3028 | 3073 | |
3029 | 3074 | |
3030 | 3075 | |
| ||
7766 | 7811 | |
7767 | 7812 | |
7768 | 7813 | |
7769 | | - |
| 7814 | + |
7770 | 7815 | |
7771 | 7816 | |
7772 | 7817 | |
| ||
29858 | 29903 | |
29859 | 29904 | |
29860 | 29905 | |
29861 | | - |
| 29906 | + |
| 29907 | + |
29862 | 29908 | |
29863 | 29909 | |
29864 | 29910 | |
|
Collapse file
deps/v8/test/cctest/test-api.h
Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-api.h+5-3Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | | - |
48 | | - |
49 | | - |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
50 | 52 | |
51 | 53 | |
52 | 54 | |
|
Collapse file
deps/v8/test/cctest/test-serialize.cc
Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-serialize.cc+12-8Lines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3577 | 3577 | |
3578 | 3578 | |
3579 | 3579 | |
3580 | | - |
3581 | | - |
3582 | | - |
3583 | | - |
| 3580 | + |
| 3581 | + |
| 3582 | + |
| 3583 | + |
| 3584 | + |
| 3585 | + |
| 3586 | + |
| 3587 | + |
3584 | 3588 | |
3585 | 3589 | |
3586 | 3590 | |
3587 | | - |
| 3591 | + |
3588 | 3592 | |
3589 | 3593 | |
3590 | 3594 | |
3591 | | - |
| 3595 | + |
3592 | 3596 | |
3593 | | - |
| 3597 | + |
3594 | 3598 | |
3595 | 3599 | |
3596 | | - |
| 3600 | + |
3597 | 3601 | |
3598 | 3602 | |
3599 | 3603 | |
|
Collapse file
deps/v8/test/unittests/objects/value-serializer-unittest.cc
Copy file name to clipboardExpand all lines: deps/v8/test/unittests/objects/value-serializer-unittest.cc+8-2Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | | - |
| 64 | + |
| 65 | + |
65 | 66 | |
66 | 67 | |
67 | 68 | |
68 | 69 | |
69 | | - |
| 70 | + |
| 71 | + |
70 | 72 | |
71 | 73 | |
72 | 74 | |
| ||
2897 | 2899 | |
2898 | 2900 | |
2899 | 2901 | |
| 2902 | + |
2900 | 2903 | |
2901 | 2904 | |
2902 | 2905 | |
| ||
2928 | 2931 | |
2929 | 2932 | |
2930 | 2933 | |
| 2934 | + |
2931 | 2935 | |
2932 | 2936 | |
2933 | 2937 | |
| 2938 | + |
2934 | 2939 | |
2935 | 2940 | |
2936 | 2941 | |
| ||
2968 | 2973 | |
2969 | 2974 | |
2970 | 2975 | |
| 2976 | + |
2971 | 2977 | |
2972 | 2978 | |
2973 | 2979 | |
|
0 commit comments