Commit 888b4eca authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Use RootIndexMap to speed up IsMaterializableFromRoot predicate.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28980}
parent 64ba57ce
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "src/compiler/code-generator-impl.h" #include "src/compiler/code-generator-impl.h"
#include "src/compiler/linkage.h" #include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h" #include "src/compiler/pipeline.h"
#include "src/snapshot/serialize.h" // TODO(turbofan): RootIndexMap
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -238,15 +239,11 @@ bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object, ...@@ -238,15 +239,11 @@ 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()) {
// Check if {object} is one of the non-smi roots that cannot be written RootIndexMap map(isolate());
// after initialization. int root_index = map.Lookup(*object);
for (int i = 0; i < Heap::kSmiRootsStart; ++i) { if (root_index != RootIndexMap::kInvalidRootIndex) {
Heap::RootListIndex const index = static_cast<Heap::RootListIndex>(i); *index_return = static_cast<Heap::RootListIndex>(root_index);
if (!Heap::RootCanBeWrittenAfterInitialization(index) && return true;
*object == isolate()->heap()->root(index)) {
*index_return = index;
return true;
}
} }
} }
return false; return false;
......
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