Commit d9e009f9 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Materialize all from non-writable roots from root array.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1175113005

Cr-Commit-Position: refs/heads/master@{#28942}
parent 896b7d7e
......@@ -221,7 +221,16 @@ bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
bool CodeGenerator::IsMaterializableFromRoot(
Handle<HeapObject> object, Heap::RootListIndex* index_return) {
if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
return isolate()->heap()->GetRootListIndex(object, index_return);
// Check if {object} is one of the non-smi roots that cannot be written
// after initialization.
for (int i = 0; i < Heap::kSmiRootsStart; ++i) {
Heap::RootListIndex const index = static_cast<Heap::RootListIndex>(i);
if (!Heap::RootCanBeWrittenAfterInitialization(index) &&
*object == isolate()->heap()->root(index)) {
*index_return = index;
return true;
}
}
}
return false;
}
......
......@@ -4920,20 +4920,6 @@ 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
void Heap::Verify() {
CHECK(HasBeenSetUp());
......
......@@ -1211,10 +1211,6 @@ class Heap {
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]; }
STATIC_ASSERT(kUndefinedValueRootIndex ==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment