[x86] Improve code generation for context materialization.
On Intel targets, it is cheaper to load the context from the frame instead of loading the context as a constant (which usually involves a PropertyCell because the context is in new space when we compile the function). R=jarin@chromium.org Review URL: https://codereview.chromium.org/970803002 Cr-Commit-Position: refs/heads/master@{#26935}
This commit is contained in:
parent
155278d6f2
commit
502898ef60
@ -1119,7 +1119,19 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
Constant src_constant = g.ToConstant(source);
|
||||
if (src_constant.type() == Constant::kHeapObject) {
|
||||
Handle<HeapObject> src = src_constant.ToHeapObject();
|
||||
if (destination->IsRegister()) {
|
||||
if (info()->IsOptimizing() && src.is_identical_to(info()->context())) {
|
||||
// Loading the context from the frame is way cheaper than materializing
|
||||
// the actual context heap object address.
|
||||
if (destination->IsRegister()) {
|
||||
Register dst = g.ToRegister(destination);
|
||||
__ mov(dst, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
} else {
|
||||
DCHECK(destination->IsStackSlot());
|
||||
Operand dst = g.ToOperand(destination);
|
||||
__ push(Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
__ pop(dst);
|
||||
}
|
||||
} else if (destination->IsRegister()) {
|
||||
Register dst = g.ToRegister(destination);
|
||||
__ LoadHeapObject(dst, src);
|
||||
} else {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user