Repository navigation
Commit fd1aba0
deps: V8: cherry-pick 99ebeac9c548
Original commit message:
[torque] Fix C++ object layout assertions for MSVC STL
The assertions generated for @cppObjectLayoutDefinition classes assume
that the first field of a derived class starts at sizeof(Parent) and
that sizeof(Class) == the packed size computed by Torque. Both
assumptions break when compiling with the MSVC STL, which stores
std::atomic<T> with alignas(sizeof(T)). Under the Microsoft C++ ABI an
alignas() is a required alignment that #pragma pack cannot lower, so the
std::atomic bit fields of Map force Map, and in turn the pack(1)
ExtendedMap, to align by 4 bytes. After rounding up,
sizeof(ExtendedMap) == sizeof(Map) + 4 == kSize + 3
so
static_assert(kSize == sizeof(ExtendedMap))
fails. The base subobject size is not rounded up
however, so JSInterceptorMap places its first field at sizeof(Map) + 1
rather than sizeof(ExtendedMap), and
static_assert(kFlagsOffset == offsetof(JSInterceptorMap, flags_))
fails as well.
Fix this by:
- Using the packed parent size that Torque already knows as the offset
of the first derived field instead of sizeof(Parent).
- Relaxing the assertion to only require that sizeof(Class) does not
exceed kSize by alignof(Class) or more, so that any extra bytes fit
into the alignment padding.
Co-Authored-By: StefanStojanovic <stefan.stojanovic@janeasystems.com>
Refs: #65161
Bug: 531344950
Change-Id: I16811484a8ff3d1bff187bab950ac71b6ea7f297
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8486028
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Cr-Commit-Position: refs/heads/main@{#110223}
Refs: v8/v8@99ebeac
Co-Authored-By: StefanStojanovic <stefan.stojanovic@janeasystems.com>
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: #66537
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>1 parent f0273ed commit fd1aba0
2 files changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4029 | 4029 | | |
4030 | 4030 | | |
4031 | 4031 | | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
4032 | 4037 | | |
4033 | 4038 | | |
4034 | 4039 | | |
| |||
4117 | 4122 | | |
4118 | 4123 | | |
4119 | 4124 | | |
4120 | | - | |
| 4125 | + | |
| 4126 | + | |
4121 | 4127 | | |
4122 | 4128 | | |
4123 | 4129 | | |
| |||
0 commit comments