| 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 db5a448adc9a0ee689421edeedbd843c58ad2dba..be28bf74d589b5ef08359d6349af79a277c88ef6 100644
|
| --- a/src/compiler/x64/code-generator-x64.cc
|
| +++ b/src/compiler/x64/code-generator-x64.cc
|
| @@ -1309,9 +1309,18 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
| case Constant::kExternalReference:
|
| __ Move(dst, 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.
|
| + __ movp(dst, Operand(rbp, StandardFrameConstants::kContextOffset));
|
| + } else {
|
| + __ Move(dst, src_object);
|
| + }
|
| break;
|
| + }
|
| case Constant::kRpoNumber:
|
| UNREACHABLE(); // TODO(dcarney): load of labels on x64.
|
| break;
|
|
|