Index: src/compiler/arm/code-generator-arm.cc |
diff --git a/src/compiler/arm/code-generator-arm.cc b/src/compiler/arm/code-generator-arm.cc |
index 4c5b2924c58275d1a7fefccf29708956673d401f..21415c4dee6a9e85fd6440637d66f4b8e84b07d4 100644 |
--- a/src/compiler/arm/code-generator-arm.cc |
+++ b/src/compiler/arm/code-generator-arm.cc |
@@ -1018,17 +1018,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. |
- __ 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 { |
__ Move(dst, src_object); |
} |