Index: src/compiler/arm64/code-generator-arm64.cc |
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc |
index 964ef3813102582422c230c6c8ec2d350e469c09..e65a0b7e615a1316eb8cda240b2e5c805a01c470 100644 |
--- a/src/compiler/arm64/code-generator-arm64.cc |
+++ b/src/compiler/arm64/code-generator-arm64.cc |
@@ -1128,17 +1128,12 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, |
: scope.AcquireX(); |
if (src.type() == 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. |
- __ Ldr(dst, MemOperand(fp, 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. |
- __ Ldr(dst, |
- MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ Heap::RootListIndex index; |
+ int offset; |
+ if (IsMaterializableFromFrame(src_object, &offset)) { |
+ __ Ldr(dst, MemOperand(fp, offset)); |
+ } else if (IsMaterializableFromRoot(src_object, &index)) { |
+ __ LoadRoot(dst, index); |
} else { |
__ LoadObject(dst, src_object); |
} |