Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 46d91a05f131349428b2cafca81673ab3c4e142d..fea141bcca3caeb76176fc688132474b4c685736 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -1372,8 +1372,8 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, |
// All extension objects were empty and it is safe to use a global |
// load IC call. |
- __ movp(rax, GlobalObjectOperand()); |
- __ Move(rcx, var->name()); |
+ __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
+ __ Move(LoadIC::NameRegister(), var->name()); |
ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
? NOT_CONTEXTUAL |
: CONTEXTUAL; |
@@ -1452,10 +1452,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
switch (var->location()) { |
case Variable::UNALLOCATED: { |
Comment cmnt(masm_, "[ Global variable"); |
- // Use inline caching. Variable name is passed in rcx and the global |
- // object on the stack. |
- __ Move(rcx, var->name()); |
- __ movp(rax, GlobalObjectOperand()); |
+ __ Move(LoadIC::NameRegister(), var->name()); |
+ __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
CallLoadIC(CONTEXTUAL); |
context()->Plug(rax); |
break; |
@@ -2044,6 +2042,11 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
// receiver = iter; f = 'next'; arg = received; |
__ bind(&l_next); |
+ Register keyedload_receiver = KeyedLoadIC::ReceiverRegister(); |
+ Register keyedload_name = KeyedLoadIC::NameRegister(); |
+ ASSERT(keyedload_receiver.is(rdx)); |
+ ASSERT(keyedload_name.is(rax)); |
+ |
__ LoadRoot(rcx, Heap::knext_stringRootIndex); // "next" |
__ Push(rcx); |
__ Push(Operand(rsp, 2 * kPointerSize)); // iter |
@@ -2051,8 +2054,8 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
// result = receiver[f](arg); |
__ bind(&l_call); |
- __ movp(rdx, Operand(rsp, kPointerSize)); |
- __ movp(rax, Operand(rsp, 2 * kPointerSize)); |
+ __ movp(keyedload_receiver, Operand(rsp, kPointerSize)); |
+ __ movp(keyedload_name, Operand(rsp, 2 * kPointerSize)); |
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
CallIC(ic, TypeFeedbackId::None()); |
__ movp(rdi, rax); |
@@ -2065,17 +2068,22 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
// if (!result.done) goto l_try; |
__ bind(&l_loop); |
- __ Push(rax); // save result |
- __ LoadRoot(rcx, Heap::kdone_stringRootIndex); // "done" |
- CallLoadIC(NOT_CONTEXTUAL); // result.done in rax |
+ Register load_receiver = LoadIC::ReceiverRegister(); |
+ Register load_name = LoadIC::NameRegister(); |
+ ASSERT(load_receiver.is(rax)); |
+ ASSERT(load_name.is(rcx)); |
+ |
+ __ Push(load_receiver); // save result |
+ __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
+ CallLoadIC(NOT_CONTEXTUAL); // rax=result.done |
Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
CallIC(bool_ic); |
__ testp(result_register(), result_register()); |
__ j(zero, &l_try); |
// result.value |
- __ Pop(rax); // result |
- __ LoadRoot(rcx, Heap::kvalue_stringRootIndex); // "value" |
+ __ Pop(load_receiver); // result |
+ __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
CallLoadIC(NOT_CONTEXTUAL); // result.value in rax |
context()->DropAndPlug(2, rax); // drop iter and g |
break; |
@@ -2236,7 +2244,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
SetSourcePosition(prop->position()); |
Literal* key = prop->key()->AsLiteral(); |
- __ Move(rcx, key->value()); |
+ __ Move(LoadIC::NameRegister(), key->value()); |
CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
} |
@@ -2495,13 +2503,15 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
if (key->IsPropertyName()) { |
VisitForAccumulatorValue(expr->obj()); |
+ ASSERT(rax.is(LoadIC::ReceiverRegister())); |
EmitNamedPropertyLoad(expr); |
PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
context()->Plug(rax); |
} else { |
VisitForStackValue(expr->obj()); |
VisitForAccumulatorValue(expr->key()); |
- __ Pop(rdx); |
+ ASSERT(rax.is(KeyedLoadIC::NameRegister())); |
+ __ Pop(KeyedLoadIC::ReceiverRegister()); |
EmitKeyedPropertyLoad(expr); |
context()->Plug(rax); |
} |
@@ -2534,7 +2544,7 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
} else { |
// Load the function from the receiver. |
ASSERT(callee->IsProperty()); |
- __ movp(rax, Operand(rsp, 0)); |
+ __ movp(LoadIC::ReceiverRegister(), Operand(rsp, 0)); |
EmitNamedPropertyLoad(callee->AsProperty()); |
PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
// Push the target function under the receiver. |
@@ -2551,12 +2561,13 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, |
Expression* key) { |
// Load the key. |
VisitForAccumulatorValue(key); |
+ ASSERT(rax.is(KeyedLoadIC::NameRegister())); |
Expression* callee = expr->expression(); |
// Load the function from the receiver. |
ASSERT(callee->IsProperty()); |
- __ movp(rdx, Operand(rsp, 0)); |
+ __ movp(KeyedLoadIC::ReceiverRegister(), Operand(rsp, 0)); |
EmitKeyedPropertyLoad(callee->AsProperty()); |
PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
@@ -4034,8 +4045,8 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
__ Push(FieldOperand(rax, GlobalObject::kBuiltinsOffset)); |
// Load the function from the receiver. |
- __ movp(rax, Operand(rsp, 0)); |
- __ Move(rcx, expr->name()); |
+ __ movp(LoadIC::ReceiverRegister(), Operand(rsp, 0)); |
+ __ Move(LoadIC::NameRegister(), expr->name()); |
CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
// Push the target function under the receiver. |
@@ -4214,13 +4225,17 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
} |
if (assign_type == NAMED_PROPERTY) { |
VisitForAccumulatorValue(prop->obj()); |
+ ASSERT(rax.is(LoadIC::ReceiverRegister())); |
__ Push(rax); // Copy of receiver, needed for later store. |
EmitNamedPropertyLoad(prop); |
} else { |
VisitForStackValue(prop->obj()); |
VisitForAccumulatorValue(prop->key()); |
- __ movp(rdx, Operand(rsp, 0)); // Leave receiver on stack |
- __ Push(rax); // Copy of key, needed for later store. |
+ ASSERT(rax.is(KeyedLoadIC::NameRegister())); |
+ // Leave receiver on stack |
+ __ movp(KeyedLoadIC::ReceiverRegister(), Operand(rsp, 0)); |
+ // Copy of key, needed for later store. |
+ __ Push(KeyedLoadIC::NameRegister()); |
EmitKeyedPropertyLoad(prop); |
} |
} |
@@ -4373,8 +4388,8 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
if (proxy != NULL && proxy->var()->IsUnallocated()) { |
Comment cmnt(masm_, "[ Global variable"); |
- __ Move(rcx, proxy->name()); |
- __ movp(rax, GlobalObjectOperand()); |
+ __ Move(LoadIC::NameRegister(), proxy->name()); |
+ __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
// Use a regular load, not a contextual load, to avoid a reference |
// error. |
CallLoadIC(NOT_CONTEXTUAL); |