Load(property->value());
frame_->Push(key);
Result ignored = frame_->CallStoreIC();
- // Drop the duplicated receiver and ignore the result.
- frame_->Drop();
break;
}
// Fall through
cgen_->frame()->Push(GetName());
Result answer = cgen_->frame()->CallStoreIC();
cgen_->frame()->Push(&answer);
- cgen_->UnloadReference(this);
+ set_unloaded();
break;
}
if (key->handle()->IsSymbol()) {
VisitForValue(value, kAccumulator);
__ mov(ecx, Immediate(key->handle()));
+ __ mov(edx, Operand(esp, 0));
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
__ call(ic, RelocInfo::CODE_TARGET);
__ nop();
- // StoreIC leaves the receiver on the stack.
break;
}
// Fall through.
// assignment. Right-hand-side value is passed in eax, variable name in
// ecx, and the global object on the stack.
__ mov(ecx, var->name());
- __ push(CodeGenerator::GlobalObject());
+ __ mov(edx, CodeGenerator::GlobalObject());
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
__ call(ic, RelocInfo::CODE_TARGET);
__ nop();
- // Overwrite the receiver on the stack with the result if needed.
- DropAndApply(1, context, eax);
+ Apply(context, eax);
} else if (slot != NULL && slot->type() == Slot::LOOKUP) {
__ push(result_register()); // Value.
// Record source code position before IC call.
SetSourcePosition(expr->position());
__ mov(ecx, prop->key()->AsLiteral()->handle());
+ if (expr->ends_initialization_block()) {
+ __ mov(edx, Operand(esp, 0));
+ } else {
+ __ pop(edx);
+ }
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
__ call(ic, RelocInfo::CODE_TARGET);
__ nop();
__ push(Operand(esp, kPointerSize)); // Receiver is under value.
__ CallRuntime(Runtime::kToFastProperties, 1);
__ pop(eax);
+ DropAndApply(1, context_, eax);
+ } else {
+ Apply(context_, eax);
}
-
- DropAndApply(1, context_, eax);
}
break;
case NAMED_PROPERTY: {
__ mov(ecx, prop->key()->AsLiteral()->handle());
+ __ pop(edx);
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
__ call(ic, RelocInfo::CODE_TARGET);
// This nop signals to the IC that there is no inlined code at the call
// site for it to patch.
__ nop();
if (expr->is_postfix()) {
- __ Drop(1); // Result is on the stack under the receiver.
if (context_ != Expression::kEffect) {
ApplyTOS(context_);
}
} else {
- DropAndApply(1, context_, eax);
+ Apply(context_, eax);
}
break;
}
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
- // -- esp[4] : receiver
// -----------------------------------
- // Get the receiver from the stack and probe the stub cache.
- __ mov(edx, Operand(esp, 4));
Code::Flags flags = Code::ComputeFlags(Code::STORE_IC,
NOT_IN_LOOP,
MONOMORPHIC);
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : transition map
+ // -- edx : receiver
// -- esp[0] : return address
- // -- esp[4] : receiver
// -----------------------------------
__ pop(ebx);
- __ push(Operand(esp, 0)); // receiver
+ __ push(edx); // receiver
__ push(ecx); // transition map
__ push(eax); // value
__ push(ebx); // return address
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
- // -- esp[4] : receiver
// -----------------------------------
__ pop(ebx);
- __ push(Operand(esp, 0));
+ __ push(edx);
__ push(ecx);
__ push(eax);
__ push(ebx);
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
- // -- esp[4] : receiver
// -----------------------------------
Label miss;
- // Get the object from the stack.
- __ mov(ebx, Operand(esp, 1 * kPointerSize));
-
// Generate store field code. Trashes the name register.
GenerateStoreField(masm(),
Builtins::StoreIC_ExtendStorage,
object,
index,
transition,
- ebx, ecx, edx,
+ edx, ecx, ebx,
&miss);
// Handle store cache miss.
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
- // -- esp[4] : receiver
// -----------------------------------
Label miss;
- // Get the object from the stack.
- __ mov(ebx, Operand(esp, 1 * kPointerSize));
-
// Check that the object isn't a smi.
- __ test(ebx, Immediate(kSmiTagMask));
+ __ test(edx, Immediate(kSmiTagMask));
__ j(zero, &miss, not_taken);
// Check that the map of the object hasn't changed.
- __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
+ __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
Immediate(Handle<Map>(object->map())));
__ j(not_equal, &miss, not_taken);
// Perform global security token check if needed.
if (object->IsJSGlobalProxy()) {
- __ CheckAccessGlobalProxy(ebx, edx, &miss);
+ __ CheckAccessGlobalProxy(edx, ebx, &miss);
}
// Stub never generated for non-global objects that require access
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
__ pop(ebx); // remove the return address
- __ push(Operand(esp, 0)); // receiver
+ __ push(edx); // receiver
__ push(Immediate(Handle<AccessorInfo>(callback))); // callback info
__ push(ecx); // name
__ push(eax); // value
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
- // -- esp[4] : receiver
// -----------------------------------
Label miss;
- // Get the object from the stack.
- __ mov(ebx, Operand(esp, 1 * kPointerSize));
-
// Check that the object isn't a smi.
- __ test(ebx, Immediate(kSmiTagMask));
+ __ test(edx, Immediate(kSmiTagMask));
__ j(zero, &miss, not_taken);
// Check that the map of the object hasn't changed.
- __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
+ __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
Immediate(Handle<Map>(receiver->map())));
__ j(not_equal, &miss, not_taken);
// Perform global security token check if needed.
if (receiver->IsJSGlobalProxy()) {
- __ CheckAccessGlobalProxy(ebx, edx, &miss);
+ __ CheckAccessGlobalProxy(edx, ebx, &miss);
}
// Stub never generated for non-global objects that require access
ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded());
__ pop(ebx); // remove the return address
- __ push(Operand(esp, 0)); // receiver
+ __ push(edx); // receiver
__ push(ecx); // name
__ push(eax); // value
__ push(ebx); // restore return address
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
- // -- esp[4] : receiver
// -----------------------------------
Label miss;
// Check that the map of the global has not changed.
- __ mov(ebx, Operand(esp, kPointerSize));
- __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
+ __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
Immediate(Handle<Map>(object->map())));
__ j(not_equal, &miss, not_taken);
Result VirtualFrame::CallStoreIC() {
// Name, value, and receiver are on top of the frame. The IC
- // expects name in ecx, value in eax, and receiver on the stack. It
- // does not drop the receiver.
+ // expects name in ecx, value in eax, and receiver in edx.
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
Result name = Pop();
Result value = Pop();
- PrepareForCall(1, 0); // One stack arg, not callee-dropped.
+ Result receiver = Pop();
+ PrepareForCall(0, 0);
- if (value.is_register() && value.reg().is(ecx)) {
- if (name.is_register() && name.reg().is(eax)) {
+ // Optimized for case in which name is a constant value.
+ if (name.is_register() && (name.reg().is(edx) || name.reg().is(eax))) {
+ if (!is_used(ecx)) {
+ name.ToRegister(ecx);
+ } else if (!is_used(ebx)) {
+ name.ToRegister(ebx);
+ } else {
+ ASSERT(!is_used(edi)); // Only three results are live, so edi is free.
+ name.ToRegister(edi);
+ }
+ }
+ // Now name is not in edx or eax, so we can fix them, then move name to ecx.
+ if (value.is_register() && value.reg().is(edx)) {
+ if (receiver.is_register() && receiver.reg().is(eax)) {
// Wrong registers.
- __ xchg(eax, ecx);
+ __ xchg(eax, edx);
} else {
- // Register eax is free for value, which frees ecx for name.
+ // Register eax is free for value, which frees edx for receiver.
value.ToRegister(eax);
- name.ToRegister(ecx);
+ receiver.ToRegister(edx);
}
} else {
- // Register ecx is free for name, which guarantees eax is free for
+ // Register edx is free for receiver, which guarantees eax is free for
// value.
- name.ToRegister(ecx);
+ receiver.ToRegister(edx);
value.ToRegister(eax);
}
-
+ // Receiver and value are in the right place, so ecx is free for name.
+ name.ToRegister(ecx);
name.Unuse();
value.Unuse();
+ receiver.Unuse();
return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
}