Index: src/compiler/code-generator.cc |
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
index 6b9a8b86c6560794e57ab33cf8d4032389f69e0c..2e56dd0a484e00cf091f699e8077dcbf2612b06e 100644 |
--- a/src/compiler/code-generator.cc |
+++ b/src/compiler/code-generator.cc |
@@ -220,8 +220,12 @@ 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); |
+ Heap::RootListIndex index; |
+ if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall() && |
+ isolate()->heap()->GetRootListIndex(*object, &index) && |
+ !Heap::RootCanBeWrittenAfterInitialization(index)) { |
+ *index_return = index; |
+ return true; |
} |
return false; |
} |