[ubsan] Replace Object** in StrongRootsList with ObjectSlot
as part of the ongoing quest to get rid of Object*/Object** entirely. Bug: v8:3770 Change-Id: Id3c6112a48a7a7ddb5441c72d81f4e4be61e3eae Reviewed-on: https://chromium-review.googlesource.com/c/1316610 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#57225}
This commit is contained in:
parent
5031c145e6
commit
ad8169a0c3
@ -136,8 +136,8 @@ DeoptimizerData::DeoptimizerData(Heap* heap) : heap_(heap), current_(nullptr) {
|
|||||||
}
|
}
|
||||||
Code** start = &deopt_entry_code_[0];
|
Code** start = &deopt_entry_code_[0];
|
||||||
Code** end = &deopt_entry_code_[DeoptimizerData::kLastDeoptimizeKind + 1];
|
Code** end = &deopt_entry_code_[DeoptimizerData::kLastDeoptimizeKind + 1];
|
||||||
heap_->RegisterStrongRoots(reinterpret_cast<Object**>(start),
|
heap_->RegisterStrongRoots(ObjectSlot(reinterpret_cast<Address>(start)),
|
||||||
reinterpret_cast<Object**>(end));
|
ObjectSlot(reinterpret_cast<Address>(end)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ DeoptimizerData::~DeoptimizerData() {
|
|||||||
deopt_entry_code_[i] = nullptr;
|
deopt_entry_code_[i] = nullptr;
|
||||||
}
|
}
|
||||||
Code** start = &deopt_entry_code_[0];
|
Code** start = &deopt_entry_code_[0];
|
||||||
heap_->UnregisterStrongRoots(reinterpret_cast<Object**>(start));
|
heap_->UnregisterStrongRoots(ObjectSlot(reinterpret_cast<Address>(start)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Code* DeoptimizerData::deopt_entry_code(DeoptimizeKind kind) {
|
Code* DeoptimizerData::deopt_entry_code(DeoptimizeKind kind) {
|
||||||
|
@ -111,8 +111,8 @@ Heap::GCCallbackTuple& Heap::GCCallbackTuple::operator=(
|
|||||||
const Heap::GCCallbackTuple& other) = default;
|
const Heap::GCCallbackTuple& other) = default;
|
||||||
|
|
||||||
struct Heap::StrongRootsList {
|
struct Heap::StrongRootsList {
|
||||||
Object** start;
|
ObjectSlot start;
|
||||||
Object** end;
|
ObjectSlot end;
|
||||||
StrongRootsList* next;
|
StrongRootsList* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3856,8 +3856,7 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
|
|||||||
|
|
||||||
// Iterate over other strong roots (currently only identity maps).
|
// Iterate over other strong roots (currently only identity maps).
|
||||||
for (StrongRootsList* list = strong_roots_list_; list; list = list->next) {
|
for (StrongRootsList* list = strong_roots_list_; list; list = list->next) {
|
||||||
v->VisitRootPointers(Root::kStrongRoots, nullptr, ObjectSlot(list->start),
|
v->VisitRootPointers(Root::kStrongRoots, nullptr, list->start, list->end);
|
||||||
ObjectSlot(list->end));
|
|
||||||
}
|
}
|
||||||
v->Synchronize(VisitorSynchronization::kStrongRoots);
|
v->Synchronize(VisitorSynchronization::kStrongRoots);
|
||||||
|
|
||||||
@ -4538,7 +4537,7 @@ void Heap::TracePossibleWrapper(JSObject* js_object) {
|
|||||||
void Heap::RegisterExternallyReferencedObject(Address* location) {
|
void Heap::RegisterExternallyReferencedObject(Address* location) {
|
||||||
// The embedder is not aware of whether numbers are materialized as heap
|
// The embedder is not aware of whether numbers are materialized as heap
|
||||||
// objects are just passed around as Smis.
|
// objects are just passed around as Smis.
|
||||||
Object* object = *reinterpret_cast<Object**>(location);
|
ObjectPtr object(*location);
|
||||||
if (!object->IsHeapObject()) return;
|
if (!object->IsHeapObject()) return;
|
||||||
HeapObject* heap_object = HeapObject::cast(object);
|
HeapObject* heap_object = HeapObject::cast(object);
|
||||||
DCHECK(Contains(heap_object));
|
DCHECK(Contains(heap_object));
|
||||||
@ -5218,7 +5217,7 @@ void Heap::RememberUnmappedPage(Address page, bool compacted) {
|
|||||||
remembered_unmapped_pages_index_ %= kRememberedUnmappedPages;
|
remembered_unmapped_pages_index_ %= kRememberedUnmappedPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Heap::RegisterStrongRoots(Object** start, Object** end) {
|
void Heap::RegisterStrongRoots(ObjectSlot start, ObjectSlot end) {
|
||||||
StrongRootsList* list = new StrongRootsList();
|
StrongRootsList* list = new StrongRootsList();
|
||||||
list->next = strong_roots_list_;
|
list->next = strong_roots_list_;
|
||||||
list->start = start;
|
list->start = start;
|
||||||
@ -5226,8 +5225,7 @@ void Heap::RegisterStrongRoots(Object** start, Object** end) {
|
|||||||
strong_roots_list_ = list;
|
strong_roots_list_ = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Heap::UnregisterStrongRoots(ObjectSlot start) {
|
||||||
void Heap::UnregisterStrongRoots(Object** start) {
|
|
||||||
StrongRootsList* prev = nullptr;
|
StrongRootsList* prev = nullptr;
|
||||||
StrongRootsList* list = strong_roots_list_;
|
StrongRootsList* list = strong_roots_list_;
|
||||||
while (list != nullptr) {
|
while (list != nullptr) {
|
||||||
|
@ -658,8 +658,8 @@ class Heap {
|
|||||||
// snapshot blob, we need to reset it before serializing.
|
// snapshot blob, we need to reset it before serializing.
|
||||||
void ClearStackLimits();
|
void ClearStackLimits();
|
||||||
|
|
||||||
void RegisterStrongRoots(Object** start, Object** end);
|
void RegisterStrongRoots(ObjectSlot start, ObjectSlot end);
|
||||||
void UnregisterStrongRoots(Object** start);
|
void UnregisterStrongRoots(ObjectSlot start);
|
||||||
|
|
||||||
void SetBuiltinsConstantsTable(FixedArray* cache);
|
void SetBuiltinsConstantsTable(FixedArray* cache);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ IdentityMapBase::~IdentityMapBase() {
|
|||||||
void IdentityMapBase::Clear() {
|
void IdentityMapBase::Clear() {
|
||||||
if (keys_) {
|
if (keys_) {
|
||||||
DCHECK(!is_iterable());
|
DCHECK(!is_iterable());
|
||||||
heap_->UnregisterStrongRoots(reinterpret_cast<Object**>(keys_));
|
heap_->UnregisterStrongRoots(ObjectSlot(keys_));
|
||||||
DeleteArray(keys_);
|
DeleteArray(keys_);
|
||||||
DeleteArray(values_);
|
DeleteArray(values_);
|
||||||
keys_ = nullptr;
|
keys_ = nullptr;
|
||||||
@ -168,8 +168,8 @@ IdentityMapBase::RawEntry IdentityMapBase::GetEntry(Address key) {
|
|||||||
values_ = NewPointerArray(capacity_);
|
values_ = NewPointerArray(capacity_);
|
||||||
memset(values_, 0, sizeof(void*) * capacity_);
|
memset(values_, 0, sizeof(void*) * capacity_);
|
||||||
|
|
||||||
heap_->RegisterStrongRoots(reinterpret_cast<Object**>(keys_),
|
heap_->RegisterStrongRoots(ObjectSlot(keys_),
|
||||||
reinterpret_cast<Object**>(keys_ + capacity_));
|
ObjectSlot(keys_ + capacity_));
|
||||||
}
|
}
|
||||||
int index = LookupOrInsert(key);
|
int index = LookupOrInsert(key);
|
||||||
return &values_[index];
|
return &values_[index];
|
||||||
@ -293,9 +293,8 @@ void IdentityMapBase::Resize(int new_capacity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unregister old keys and register new keys.
|
// Unregister old keys and register new keys.
|
||||||
heap_->UnregisterStrongRoots(reinterpret_cast<Object**>(old_keys));
|
heap_->UnregisterStrongRoots(ObjectSlot(old_keys));
|
||||||
heap_->RegisterStrongRoots(reinterpret_cast<Object**>(keys_),
|
heap_->RegisterStrongRoots(ObjectSlot(keys_), ObjectSlot(keys_ + capacity_));
|
||||||
reinterpret_cast<Object**>(keys_ + capacity_));
|
|
||||||
|
|
||||||
// Delete old storage;
|
// Delete old storage;
|
||||||
DeleteArray(old_keys);
|
DeleteArray(old_keys);
|
||||||
|
Loading…
Reference in New Issue
Block a user