Index: src/compiler/code-generator.cc |
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
index 6b9a8b86c6560794e57ab33cf8d4032389f69e0c..081dde913fc2b59c2a931b27e3ba98679343d249 100644 |
--- a/src/compiler/code-generator.cc |
+++ b/src/compiler/code-generator.cc |
@@ -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; |
} |