Fix windows compilation

Prior to this CL compilation fails with:

- 'error: offset of on non-standard-layout type' due to offsetof()
- 'Assertion failed: vector subscript out of range' due to the OOB vector subscripts

Change-Id: I8751fafd1058ca839de832267811f8f1f47c53fe
Reviewed-on: https://chromium-review.googlesource.com/c/1400404
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58616}
This commit is contained in:
Jakob Gruber 2019-01-08 09:34:48 +01:00 committed by Commit Bot
parent ae8f83fe08
commit 9525443498
2 changed files with 8 additions and 8 deletions

View File

@ -2193,8 +2193,8 @@ void Heap::ExternalStringTable::IterateAll(RootVisitor* v) {
if (!old_space_strings_.empty()) {
v->VisitRootPointers(
Root::kExternalStringsTable, nullptr,
FullObjectSlot(&old_space_strings_[0]),
FullObjectSlot(&old_space_strings_[old_space_strings_.size()]));
FullObjectSlot(old_space_strings_.data()),
FullObjectSlot(old_space_strings_.data() + old_space_strings_.size()));
}
}
@ -2206,8 +2206,8 @@ void Heap::UpdateNewSpaceReferencesInExternalStringTable(
void Heap::ExternalStringTable::UpdateReferences(
Heap::ExternalStringTableUpdaterCallback updater_func) {
if (old_space_strings_.size() > 0) {
FullObjectSlot start(&old_space_strings_[0]);
FullObjectSlot end(&old_space_strings_[old_space_strings_.size()]);
FullObjectSlot start(old_space_strings_.data());
FullObjectSlot end(old_space_strings_.data() + old_space_strings_.size());
for (FullObjectSlot p = start; p < end; ++p)
p.store(updater_func(heap_, p));
}

View File

@ -18,11 +18,11 @@ namespace v8 {
namespace internal {
const size_t MicrotaskQueue::kRingBufferOffset =
offsetof(MicrotaskQueue, ring_buffer_);
OFFSET_OF(MicrotaskQueue, ring_buffer_);
const size_t MicrotaskQueue::kCapacityOffset =
offsetof(MicrotaskQueue, capacity_);
const size_t MicrotaskQueue::kSizeOffset = offsetof(MicrotaskQueue, size_);
const size_t MicrotaskQueue::kStartOffset = offsetof(MicrotaskQueue, start_);
OFFSET_OF(MicrotaskQueue, capacity_);
const size_t MicrotaskQueue::kSizeOffset = OFFSET_OF(MicrotaskQueue, size_);
const size_t MicrotaskQueue::kStartOffset = OFFSET_OF(MicrotaskQueue, start_);
const intptr_t MicrotaskQueue::kMinimumCapacity = 8;