Index: src/compiler/ppc/code-generator-ppc.cc |
diff --git a/src/compiler/ppc/code-generator-ppc.cc b/src/compiler/ppc/code-generator-ppc.cc |
index 8644c36941776acc47c62446a25b9a00c4697016..2ebb840a9d290c6fbd748357920e9dba12b28f4d 100644 |
--- a/src/compiler/ppc/code-generator-ppc.cc |
+++ b/src/compiler/ppc/code-generator-ppc.cc |
@@ -1348,9 +1348,25 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, |
case Constant::kExternalReference: |
__ mov(dst, Operand(src.ToExternalReference())); |
break; |
- case Constant::kHeapObject: |
- __ Move(dst, src.ToHeapObject()); |
+ 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. |
+ __ LoadP(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. |
+ __ LoadP(dst, |
+ MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ } else { |
+ __ Move(dst, src_object); |
+ } |
break; |
+ } |
case Constant::kRpoNumber: |
UNREACHABLE(); // TODO(dcarney): loading RPO constants on PPC. |
break; |