Index: src/compiler/x64/code-generator-x64.cc |
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc |
index 4213c9f135131957dc51e93505a2b7f4444df20f..f4b90e92624750a8148953cb0dd27dcabfcd62ee 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -1531,17 +1531,12 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, |
break; |
case Constant::kHeapObject: { |
Handle<HeapObject> src_object = src.ToHeapObject(); |
- if (info()->IsOptimizing() && |
- src_object.is_identical_to(info()->context())) { |
- // Loading the context from the frame is way cheaper than |
- // materializing the actual context heap object address. |
- __ movp(dst, Operand(rbp, StandardFrameConstants::kContextOffset)); |
- } else if (info()->IsOptimizing() && |
- src_object.is_identical_to(info()->closure())) { |
- // Loading the JSFunction from the frame is way cheaper than |
- // materializing the actual JSFunction heap object address. |
- __ movp(dst, |
- Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
+ Heap::RootListIndex index; |
+ int offset; |
+ if (IsMaterializableFromFrame(src_object, &offset)) { |
+ __ movp(dst, Operand(rbp, offset)); |
+ } else if (IsMaterializableFromRoot(src_object, &index)) { |
+ __ LoadRoot(dst, index); |
} else { |
__ Move(dst, src_object); |
} |