Commit 867586c
committed
deps: V8: cherry-pick 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: #49639
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>1 parent 4ad3479 commit 867586cCopy full SHA for 867586c
File tree
Expand file treeCollapse file tree
8 files changed
+104
-35
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
+104
-35
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+16-7Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
483 | 483 | |
484 | 484 | |
485 | 485 | |
486 | | - |
487 | | - |
| 486 | + |
| 487 | + |
| 488 | + |
| 489 | + |
| 490 | + |
| 491 | + |
| 492 | + |
| 493 | + |
| 494 | + |
| 495 | + |
| 496 | + |
488 | 497 | |
489 | | - |
490 | | - |
| 498 | + |
| 499 | + |
491 | 500 | |
492 | 501 | |
493 | 502 | |
| ||
725 | 734 | |
726 | 735 | |
727 | 736 | |
728 | | - |
| 737 | + |
729 | 738 | |
730 | 739 | |
731 | 740 | |
732 | 741 | |
733 | 742 | |
734 | | - |
| 743 | + |
735 | 744 | |
736 | 745 | |
737 | 746 | |
| ||
750 | 759 | |
751 | 760 | |
752 | 761 | |
753 | | - |
| 762 | + |
754 | 763 | |
755 | 764 | |
756 | 765 | |
|
Collapse file
+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | | - |
| 389 | + |
390 | 390 | |
391 | 391 | |
392 | 392 | |
| ||
502 | 502 | |
503 | 503 | |
504 | 504 | |
505 | | - |
| 505 | + |
506 | 506 | |
507 | 507 | |
508 | 508 | |
|
Collapse file
+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6246 | 6246 | |
6247 | 6247 | |
6248 | 6248 | |
6249 | | - |
| 6249 | + |
6250 | 6250 | |
6251 | 6251 | |
6252 | 6252 | |
6253 | 6253 | |
6254 | 6254 | |
6255 | | - |
| 6255 | + |
6256 | 6256 | |
6257 | 6257 | |
6258 | | - |
| 6258 | + |
6259 | 6259 | |
6260 | 6260 | |
6261 | 6261 | |
|
Collapse file
deps/v8/test/cctest/test-api.cc
Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-api.cc+57-9Lines changed: 57 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2884 | 2884 | |
2885 | 2885 | |
2886 | 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 | + |
| 2914 | + |
| 2915 | + |
| 2916 | + |
| 2917 | + |
| 2918 | + |
| 2919 | + |
| 2920 | + |
| 2921 | + |
| 2922 | + |
| 2923 | + |
| 2924 | + |
| 2925 | + |
2887 | 2926 | |
2888 | 2927 | |
2889 | 2928 | |
| ||
2897 | 2936 | |
2898 | 2937 | |
2899 | 2938 | |
2900 | | - |
| 2939 | + |
2901 | 2940 | |
2902 | | - |
| 2941 | + |
| 2942 | + |
| 2943 | + |
| 2944 | + |
2903 | 2945 | |
2904 | 2946 | |
2905 | 2947 | |
| ||
2925 | 2967 | |
2926 | 2968 | |
2927 | 2969 | |
2928 | | - |
| 2970 | + |
2929 | 2971 | |
2930 | 2972 | |
2931 | 2973 | |
2932 | 2974 | |
2933 | 2975 | |
2934 | | - |
2935 | | - |
| 2976 | + |
| 2977 | + |
| 2978 | + |
| 2979 | + |
2936 | 2980 | |
2937 | 2981 | |
2938 | 2982 | |
| ||
3032 | 3076 | |
3033 | 3077 | |
3034 | 3078 | |
3035 | | - |
| 3079 | + |
3036 | 3080 | |
3037 | | - |
| 3081 | + |
| 3082 | + |
| 3083 | + |
| 3084 | + |
3038 | 3085 | |
3039 | 3086 | |
3040 | 3087 | |
| ||
7789 | 7836 | |
7790 | 7837 | |
7791 | 7838 | |
7792 | | - |
| 7839 | + |
7793 | 7840 | |
7794 | 7841 | |
7795 | 7842 | |
| ||
29699 | 29746 | |
29700 | 29747 | |
29701 | 29748 | |
29702 | | - |
| 29749 | + |
| 29750 | + |
29703 | 29751 | |
29704 | 29752 | |
29705 | 29753 | |
|
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 |
|---|---|---|
| ||
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | | - |
50 | | - |
51 | | - |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
52 | 54 | |
53 | 55 | |
54 | 56 | |
|
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 |
|---|---|---|
| ||
3667 | 3667 | |
3668 | 3668 | |
3669 | 3669 | |
3670 | | - |
3671 | | - |
3672 | | - |
3673 | | - |
| 3670 | + |
| 3671 | + |
| 3672 | + |
| 3673 | + |
| 3674 | + |
| 3675 | + |
| 3676 | + |
| 3677 | + |
3674 | 3678 | |
3675 | 3679 | |
3676 | 3680 | |
3677 | | - |
| 3681 | + |
3678 | 3682 | |
3679 | 3683 | |
3680 | 3684 | |
3681 | | - |
| 3685 | + |
3682 | 3686 | |
3683 | | - |
| 3687 | + |
3684 | 3688 | |
3685 | 3689 | |
3686 | | - |
| 3690 | + |
3687 | 3691 | |
3688 | 3692 | |
3689 | 3693 | |
|
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 |
|---|---|---|
| ||
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | | - |
| 66 | + |
| 67 | + |
67 | 68 | |
68 | 69 | |
69 | 70 | |
70 | 71 | |
71 | 72 | |
72 | | - |
| 73 | + |
| 74 | + |
73 | 75 | |
74 | 76 | |
75 | 77 | |
| ||
2884 | 2886 | |
2885 | 2887 | |
2886 | 2888 | |
| 2889 | + |
2887 | 2890 | |
2888 | 2891 | |
2889 | 2892 | |
| ||
2915 | 2918 | |
2916 | 2919 | |
2917 | 2920 | |
| 2921 | + |
2918 | 2922 | |
2919 | 2923 | |
2920 | 2924 | |
| 2925 | + |
2921 | 2926 | |
2922 | 2927 | |
2923 | 2928 | |
| ||
2955 | 2960 | |
2956 | 2961 | |
2957 | 2962 | |
| 2963 | + |
2958 | 2964 | |
2959 | 2965 | |
2960 | 2966 | |
|
0 commit comments