Move GetRootListIndex into Heap.
R=hpayer@chromium.org BUG= Review URL: https://codereview.chromium.org/1095513003 Cr-Commit-Position: refs/heads/master@{#27891}
This commit is contained in:
parent
a0e2dd23ce
commit
cb08656b6d
@ -202,13 +202,7 @@ bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
|
|||||||
bool CodeGenerator::IsMaterializableFromRoot(
|
bool CodeGenerator::IsMaterializableFromRoot(
|
||||||
Handle<HeapObject> object, Heap::RootListIndex* index_return) {
|
Handle<HeapObject> object, Heap::RootListIndex* index_return) {
|
||||||
if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
|
if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
|
||||||
#define IMMORTAL_IMMOVABLE_ROOT(Name) \
|
return isolate()->heap()->GetRootListIndex(object, index_return);
|
||||||
if (*object == isolate()->heap()->root(Heap::k##Name##RootIndex)) { \
|
|
||||||
*index_return = Heap::k##Name##RootIndex; \
|
|
||||||
return true; \
|
|
||||||
}
|
|
||||||
IMMORTAL_IMMOVABLE_ROOT_LIST(IMMORTAL_IMMOVABLE_ROOT)
|
|
||||||
#undef IMMORTAL_IMMOVABLE_ROOT
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4808,6 +4808,20 @@ bool Heap::RootIsImmortalImmovable(int root_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Heap::GetRootListIndex(Handle<HeapObject> object,
|
||||||
|
Heap::RootListIndex* index_return) {
|
||||||
|
Object* ptr = *object;
|
||||||
|
#define IMMORTAL_IMMOVABLE_ROOT(Name) \
|
||||||
|
if (ptr == roots_[Heap::k##Name##RootIndex]) { \
|
||||||
|
*index_return = k##Name##RootIndex; \
|
||||||
|
return true; \
|
||||||
|
}
|
||||||
|
IMMORTAL_IMMOVABLE_ROOT_LIST(IMMORTAL_IMMOVABLE_ROOT)
|
||||||
|
#undef IMMORTAL_IMMOVABLE_ROOT
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERIFY_HEAP
|
#ifdef VERIFY_HEAP
|
||||||
void Heap::Verify() {
|
void Heap::Verify() {
|
||||||
CHECK(HasBeenSetUp());
|
CHECK(HasBeenSetUp());
|
||||||
|
@ -1166,6 +1166,10 @@ class Heap {
|
|||||||
kSmiRootsStart = kStringTableRootIndex + 1
|
kSmiRootsStart = kStringTableRootIndex + 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Get the root list index for {object} if such a root list index exists.
|
||||||
|
bool GetRootListIndex(Handle<HeapObject> object,
|
||||||
|
Heap::RootListIndex* index_return);
|
||||||
|
|
||||||
Object* root(RootListIndex index) { return roots_[index]; }
|
Object* root(RootListIndex index) { return roots_[index]; }
|
||||||
|
|
||||||
STATIC_ASSERT(kUndefinedValueRootIndex ==
|
STATIC_ASSERT(kUndefinedValueRootIndex ==
|
||||||
|
Loading…
Reference in New Issue
Block a user