X87: Use IC register definitions in platform files.

port r22035

original commit message:
  Use IC register definitions in platform files.

BUG=
R=weiliang.lin@intel.com

Review URL: https://codereview.chromium.org/356133005

Patch from Chunyang Dai <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22047 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 903b94d4
...@@ -92,34 +92,6 @@ void RegExpConstructResultStub::InitializeInterfaceDescriptor( ...@@ -92,34 +92,6 @@ void RegExpConstructResultStub::InitializeInterfaceDescriptor(
} }
void LoadFieldStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { edx };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { edx };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void StringLengthStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { edx, ecx };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void KeyedStringLengthStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { edx, ecx };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { edx, ecx, eax }; Register registers[] = { edx, ecx, eax };
......
...@@ -180,11 +180,9 @@ void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) { ...@@ -180,11 +180,9 @@ void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) {
void DebugCodegen::GenerateLoadICDebugBreak(MacroAssembler* masm) { void DebugCodegen::GenerateLoadICDebugBreak(MacroAssembler* masm) {
// Register state for IC load call (from ic-x87.cc). // Register state for IC load call (from ic-x87.cc).
// ----------- S t a t e ------------- Register receiver = LoadIC::ReceiverRegister();
// -- ecx : name Register name = LoadIC::NameRegister();
// -- edx : receiver Generate_DebugBreakCallHelper(masm, receiver.bit() | name.bit(), 0, false);
// -----------------------------------
Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false);
} }
...@@ -202,11 +200,9 @@ void DebugCodegen::GenerateStoreICDebugBreak(MacroAssembler* masm) { ...@@ -202,11 +200,9 @@ void DebugCodegen::GenerateStoreICDebugBreak(MacroAssembler* masm) {
void DebugCodegen::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { void DebugCodegen::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) {
// Register state for keyed IC load call (from ic-x87.cc). // Register state for keyed IC load call (from ic-x87.cc).
// ----------- S t a t e ------------- Register receiver = KeyedLoadIC::ReceiverRegister();
// -- ecx : key Register name = KeyedLoadIC::NameRegister();
// -- edx : receiver Generate_DebugBreakCallHelper(masm, receiver.bit() | name.bit(), 0, false);
// -----------------------------------
Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false);
} }
......
...@@ -1334,8 +1334,8 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, ...@@ -1334,8 +1334,8 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
// All extension objects were empty and it is safe to use a global // All extension objects were empty and it is safe to use a global
// load IC call. // load IC call.
__ mov(edx, GlobalObjectOperand()); __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand());
__ mov(ecx, var->name()); __ mov(LoadIC::NameRegister(), var->name());
ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ContextualMode mode = (typeof_state == INSIDE_TYPEOF)
? NOT_CONTEXTUAL ? NOT_CONTEXTUAL
: CONTEXTUAL; : CONTEXTUAL;
...@@ -1415,10 +1415,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { ...@@ -1415,10 +1415,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
switch (var->location()) { switch (var->location()) {
case Variable::UNALLOCATED: { case Variable::UNALLOCATED: {
Comment cmnt(masm_, "[ Global variable"); Comment cmnt(masm_, "[ Global variable");
// Use inline caching. Variable name is passed in ecx and the global __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand());
// object in eax. __ mov(LoadIC::NameRegister(), var->name());
__ mov(edx, GlobalObjectOperand());
__ mov(ecx, var->name());
CallLoadIC(CONTEXTUAL); CallLoadIC(CONTEXTUAL);
context()->Plug(eax); context()->Plug(eax);
break; break;
...@@ -2005,14 +2003,20 @@ void FullCodeGenerator::VisitYield(Yield* expr) { ...@@ -2005,14 +2003,20 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
// receiver = iter; f = iter.next; arg = received; // receiver = iter; f = iter.next; arg = received;
__ bind(&l_next); __ bind(&l_next);
__ mov(ecx, isolate()->factory()->next_string()); // "next" Register keyedload_receiver = KeyedLoadIC::ReceiverRegister();
__ push(ecx); Register keyedload_name = KeyedLoadIC::NameRegister();
ASSERT(keyedload_receiver.is(edx));
ASSERT(keyedload_name.is(ecx));
__ mov(keyedload_name,
isolate()->factory()->next_string()); // "next"
__ push(keyedload_name);
__ push(Operand(esp, 2 * kPointerSize)); // iter __ push(Operand(esp, 2 * kPointerSize)); // iter
__ push(eax); // received __ push(eax); // received
// result = receiver[f](arg); // result = receiver[f](arg);
__ bind(&l_call); __ bind(&l_call);
__ mov(edx, Operand(esp, kPointerSize)); __ mov(keyedload_receiver, Operand(esp, kPointerSize));
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
CallIC(ic, TypeFeedbackId::None()); CallIC(ic, TypeFeedbackId::None());
__ mov(edi, eax); __ mov(edi, eax);
...@@ -2026,8 +2030,13 @@ void FullCodeGenerator::VisitYield(Yield* expr) { ...@@ -2026,8 +2030,13 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
// if (!result.done) goto l_try; // if (!result.done) goto l_try;
__ bind(&l_loop); __ bind(&l_loop);
__ push(eax); // save result __ push(eax); // save result
__ mov(edx, eax); // result Register load_receiver = LoadIC::ReceiverRegister();
__ mov(ecx, isolate()->factory()->done_string()); // "done" Register load_name = LoadIC::NameRegister();
ASSERT(load_receiver.is(edx));
ASSERT(load_name.is(ecx));
__ mov(load_receiver, eax); // result
__ mov(load_name,
isolate()->factory()->done_string()); // "done"
CallLoadIC(NOT_CONTEXTUAL); // result.done in eax CallLoadIC(NOT_CONTEXTUAL); // result.done in eax
Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
CallIC(bool_ic); CallIC(bool_ic);
...@@ -2035,8 +2044,9 @@ void FullCodeGenerator::VisitYield(Yield* expr) { ...@@ -2035,8 +2044,9 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
__ j(zero, &l_try); __ j(zero, &l_try);
// result.value // result.value
__ pop(edx); // result __ pop(load_receiver); // result
__ mov(ecx, isolate()->factory()->value_string()); // "value" __ mov(load_name,
isolate()->factory()->value_string()); // "value"
CallLoadIC(NOT_CONTEXTUAL); // result.value in eax CallLoadIC(NOT_CONTEXTUAL); // result.value in eax
context()->DropAndPlug(2, eax); // drop iter and g context()->DropAndPlug(2, eax); // drop iter and g
break; break;
...@@ -2196,7 +2206,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { ...@@ -2196,7 +2206,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
SetSourcePosition(prop->position()); SetSourcePosition(prop->position());
Literal* key = prop->key()->AsLiteral(); Literal* key = prop->key()->AsLiteral();
ASSERT(!key->value()->IsSmi()); ASSERT(!key->value()->IsSmi());
__ mov(ecx, Immediate(key->value())); __ mov(LoadIC::NameRegister(), Immediate(key->value()));
CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
} }
...@@ -2494,15 +2504,15 @@ void FullCodeGenerator::VisitProperty(Property* expr) { ...@@ -2494,15 +2504,15 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
if (key->IsPropertyName()) { if (key->IsPropertyName()) {
VisitForAccumulatorValue(expr->obj()); VisitForAccumulatorValue(expr->obj());
__ mov(edx, result_register()); __ mov(LoadIC::ReceiverRegister(), result_register());
EmitNamedPropertyLoad(expr); EmitNamedPropertyLoad(expr);
PrepareForBailoutForId(expr->LoadId(), TOS_REG); PrepareForBailoutForId(expr->LoadId(), TOS_REG);
context()->Plug(eax); context()->Plug(eax);
} else { } else {
VisitForStackValue(expr->obj()); VisitForStackValue(expr->obj());
VisitForAccumulatorValue(expr->key()); VisitForAccumulatorValue(expr->key());
__ pop(edx); // Object. __ pop(KeyedLoadIC::ReceiverRegister()); // Object.
__ mov(ecx, result_register()); // Key. __ mov(KeyedLoadIC::NameRegister(), result_register()); // Key.
EmitKeyedPropertyLoad(expr); EmitKeyedPropertyLoad(expr);
context()->Plug(eax); context()->Plug(eax);
} }
...@@ -2535,7 +2545,7 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { ...@@ -2535,7 +2545,7 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
} else { } else {
// Load the function from the receiver. // Load the function from the receiver.
ASSERT(callee->IsProperty()); ASSERT(callee->IsProperty());
__ mov(edx, Operand(esp, 0)); __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0));
EmitNamedPropertyLoad(callee->AsProperty()); EmitNamedPropertyLoad(callee->AsProperty());
PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
// Push the target function under the receiver. // Push the target function under the receiver.
...@@ -2557,9 +2567,9 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, ...@@ -2557,9 +2567,9 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
// Load the function from the receiver. // Load the function from the receiver.
ASSERT(callee->IsProperty()); ASSERT(callee->IsProperty());
__ mov(edx, Operand(esp, 0)); __ mov(KeyedLoadIC::ReceiverRegister(), Operand(esp, 0));
// Move the key into the right register for the keyed load IC. // Move the key into the right register for the keyed load IC.
__ mov(ecx, eax); __ mov(KeyedLoadIC::NameRegister(), eax);
EmitKeyedPropertyLoad(callee->AsProperty()); EmitKeyedPropertyLoad(callee->AsProperty());
PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
...@@ -4016,8 +4026,8 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { ...@@ -4016,8 +4026,8 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
__ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset));
// Load the function from the receiver. // Load the function from the receiver.
__ mov(edx, Operand(esp, 0)); __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0));
__ mov(ecx, Immediate(expr->name())); __ mov(LoadIC::NameRegister(), Immediate(expr->name()));
CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
// Push the target function under the receiver. // Push the target function under the receiver.
...@@ -4200,14 +4210,16 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4200,14 +4210,16 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
if (assign_type == NAMED_PROPERTY) { if (assign_type == NAMED_PROPERTY) {
// Put the object both on the stack and in edx. // Put the object both on the stack and in edx.
VisitForAccumulatorValue(prop->obj()); VisitForAccumulatorValue(prop->obj());
ASSERT(!eax.is(LoadIC::ReceiverRegister()));
__ push(eax); __ push(eax);
__ mov(edx, eax); __ mov(LoadIC::ReceiverRegister(), eax);
EmitNamedPropertyLoad(prop); EmitNamedPropertyLoad(prop);
} else { } else {
VisitForStackValue(prop->obj()); VisitForStackValue(prop->obj());
VisitForStackValue(prop->key()); VisitForStackValue(prop->key());
__ mov(edx, Operand(esp, kPointerSize)); // Object. __ mov(KeyedLoadIC::ReceiverRegister(),
__ mov(ecx, Operand(esp, 0)); // Key. Operand(esp, kPointerSize)); // Object.
__ mov(KeyedLoadIC::NameRegister(), Operand(esp, 0)); // Key.
EmitKeyedPropertyLoad(prop); EmitKeyedPropertyLoad(prop);
} }
} }
...@@ -4364,8 +4376,8 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { ...@@ -4364,8 +4376,8 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
if (proxy != NULL && proxy->var()->IsUnallocated()) { if (proxy != NULL && proxy->var()->IsUnallocated()) {
Comment cmnt(masm_, "[ Global variable"); Comment cmnt(masm_, "[ Global variable");
__ mov(edx, GlobalObjectOperand()); __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand());
__ mov(ecx, Immediate(proxy->name())); __ mov(LoadIC::NameRegister(), Immediate(proxy->name()));
// Use a regular load, not a contextual load, to avoid a reference // Use a regular load, not a contextual load, to avoid a reference
// error. // error.
CallLoadIC(NOT_CONTEXTUAL); CallLoadIC(NOT_CONTEXTUAL);
......
...@@ -388,6 +388,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { ...@@ -388,6 +388,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// -- edx : receiver // -- edx : receiver
// -- esp[0] : return address // -- esp[0] : return address
// ----------------------------------- // -----------------------------------
ASSERT(edx.is(ReceiverRegister()));
ASSERT(ecx.is(NameRegister()));
Label slow, check_name, index_smi, index_name, property_array_property; Label slow, check_name, index_smi, index_name, property_array_property;
Label probe_dictionary, check_number_dictionary; Label probe_dictionary, check_number_dictionary;
...@@ -560,18 +562,25 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { ...@@ -560,18 +562,25 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
} }
// A register that isn't one of the parameters to the load ic.
static const Register LoadIC_TempRegister() { return ebx; }
// A register that isn't one of the parameters to the load ic.
static const Register KeyedLoadIC_TempRegister() {
return LoadIC_TempRegister();
}
void KeyedLoadIC::GenerateString(MacroAssembler* masm) { void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
// ----------- S t a t e ------------- // Return address is on the stack.
// -- ecx : key (index)
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss; Label miss;
Register receiver = edx; Register receiver = ReceiverRegister();
Register index = ecx; Register index = NameRegister();
Register scratch = ebx; Register scratch = KeyedLoadIC_TempRegister();
Register result = eax; Register result = eax;
ASSERT(!result.is(scratch));
StringCharAtGenerator char_at_generator(receiver, StringCharAtGenerator char_at_generator(receiver,
index, index,
...@@ -593,35 +602,36 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) { ...@@ -593,35 +602,36 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
// ----------- S t a t e ------------- // Return address is on the stack.
// -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label slow; Label slow;
Register receiver = ReceiverRegister();
Register key = NameRegister();
Register scratch = eax;
ASSERT(!scratch.is(receiver) && !scratch.is(key));
// Check that the receiver isn't a smi. // Check that the receiver isn't a smi.
__ JumpIfSmi(edx, &slow); __ JumpIfSmi(receiver, &slow);
// Check that the key is an array index, that is Uint32. // Check that the key is an array index, that is Uint32.
__ test(ecx, Immediate(kSmiTagMask | kSmiSignMask)); __ test(key, Immediate(kSmiTagMask | kSmiSignMask));
__ j(not_zero, &slow); __ j(not_zero, &slow);
// Get the map of the receiver. // Get the map of the receiver.
__ mov(eax, FieldOperand(edx, HeapObject::kMapOffset)); __ mov(scratch, FieldOperand(receiver, HeapObject::kMapOffset));
// Check that it has indexed interceptor and access checks // Check that it has indexed interceptor and access checks
// are not enabled for this object. // are not enabled for this object.
__ movzx_b(eax, FieldOperand(eax, Map::kBitFieldOffset)); __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset));
__ and_(eax, Immediate(kSlowCaseBitFieldMask)); __ and_(scratch, Immediate(kSlowCaseBitFieldMask));
__ cmp(eax, Immediate(1 << Map::kHasIndexedInterceptor)); __ cmp(scratch, Immediate(1 << Map::kHasIndexedInterceptor));
__ j(not_zero, &slow); __ j(not_zero, &slow);
// Everything is fine, call runtime. // Everything is fine, call runtime.
__ pop(eax); __ pop(scratch);
__ push(edx); // receiver __ push(receiver); // receiver
__ push(ecx); // key __ push(key); // key
__ push(eax); // return address __ push(scratch); // return address
// Perform tail call to the entry. // Perform tail call to the entry.
ExternalReference ref = ExternalReference ref =
...@@ -640,6 +650,8 @@ void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { ...@@ -640,6 +650,8 @@ void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
// -- edx : receiver // -- edx : receiver
// -- esp[0] : return address // -- esp[0] : return address
// ----------------------------------- // -----------------------------------
ASSERT(edx.is(ReceiverRegister()));
ASSERT(ecx.is(NameRegister()));
Label slow, notin; Label slow, notin;
Factory* factory = masm->isolate()->factory(); Factory* factory = masm->isolate()->factory();
Operand mapped_location = Operand mapped_location =
...@@ -930,6 +942,8 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { ...@@ -930,6 +942,8 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
// -- edx : receiver // -- edx : receiver
// -- esp[0] : return address // -- esp[0] : return address
// ----------------------------------- // -----------------------------------
ASSERT(edx.is(ReceiverRegister()));
ASSERT(ecx.is(NameRegister()));
// Probe the stub cache. // Probe the stub cache.
Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
...@@ -947,6 +961,9 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { ...@@ -947,6 +961,9 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
// -- edx : receiver // -- edx : receiver
// -- esp[0] : return address // -- esp[0] : return address
// ----------------------------------- // -----------------------------------
ASSERT(edx.is(ReceiverRegister()));
ASSERT(ecx.is(NameRegister()));
Label miss, slow; Label miss, slow;
GenerateNameDictionaryReceiverCheck(masm, edx, eax, ebx, &miss); GenerateNameDictionaryReceiverCheck(masm, edx, eax, ebx, &miss);
...@@ -967,18 +984,13 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { ...@@ -967,18 +984,13 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
void LoadIC::GenerateMiss(MacroAssembler* masm) { void LoadIC::GenerateMiss(MacroAssembler* masm) {
// ----------- S t a t e ------------- // Return address is on the stack.
// -- ecx : name
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(masm->isolate()->counters()->load_miss(), 1); __ IncrementCounter(masm->isolate()->counters()->load_miss(), 1);
__ pop(ebx); __ pop(LoadIC_TempRegister());
__ push(edx); // receiver __ push(ReceiverRegister()); // receiver
__ push(ecx); // name __ push(NameRegister()); // name
__ push(ebx); // return address __ push(LoadIC_TempRegister()); // return address
// Perform tail call to the entry. // Perform tail call to the entry.
ExternalReference ref = ExternalReference ref =
...@@ -988,16 +1000,11 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) { ...@@ -988,16 +1000,11 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// ----------- S t a t e ------------- // Return address is on the stack.
// -- ecx : key __ pop(LoadIC_TempRegister());
// -- edx : receiver __ push(ReceiverRegister()); // receiver
// -- esp[0] : return address __ push(NameRegister()); // name
// ----------------------------------- __ push(LoadIC_TempRegister()); // return address
__ pop(ebx);
__ push(edx); // receiver
__ push(ecx); // name
__ push(ebx); // return address
// Perform tail call to the entry. // Perform tail call to the entry.
__ TailCallRuntime(Runtime::kGetProperty, 2, 1); __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
...@@ -1005,18 +1012,13 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { ...@@ -1005,18 +1012,13 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
// ----------- S t a t e ------------- // Return address is on the stack.
// -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1);
__ pop(ebx); __ pop(KeyedLoadIC_TempRegister());
__ push(edx); // receiver __ push(ReceiverRegister()); // receiver
__ push(ecx); // name __ push(NameRegister()); // name
__ push(ebx); // return address __ push(KeyedLoadIC_TempRegister()); // return address
// Perform tail call to the entry. // Perform tail call to the entry.
ExternalReference ref = ExternalReference ref =
...@@ -1039,16 +1041,11 @@ const Register KeyedLoadIC::NameRegister() { return LoadIC::NameRegister(); } ...@@ -1039,16 +1041,11 @@ const Register KeyedLoadIC::NameRegister() { return LoadIC::NameRegister(); }
void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// ----------- S t a t e ------------- // Return address is on the stack.
// -- ecx : key __ pop(KeyedLoadIC_TempRegister());
// -- edx : receiver __ push(ReceiverRegister()); // receiver
// -- esp[0] : return address __ push(NameRegister()); // name
// ----------------------------------- __ push(KeyedLoadIC_TempRegister()); // return address
__ pop(ebx);
__ push(edx); // receiver
__ push(ecx); // name
__ push(ebx); // return address
// Perform tail call to the entry. // Perform tail call to the entry.
__ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
......
...@@ -2967,10 +2967,10 @@ void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { ...@@ -2967,10 +2967,10 @@ void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
ASSERT(ToRegister(instr->context()).is(esi)); ASSERT(ToRegister(instr->context()).is(esi));
ASSERT(ToRegister(instr->global_object()).is(edx)); ASSERT(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister()));
ASSERT(ToRegister(instr->result()).is(eax)); ASSERT(ToRegister(instr->result()).is(eax));
__ mov(ecx, instr->name()); __ mov(LoadIC::NameRegister(), instr->name());
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
...@@ -3099,10 +3099,10 @@ void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { ...@@ -3099,10 +3099,10 @@ void LCodeGen::EmitPushTaggedOperand(LOperand* operand) {
void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
ASSERT(ToRegister(instr->context()).is(esi)); ASSERT(ToRegister(instr->context()).is(esi));
ASSERT(ToRegister(instr->object()).is(edx)); ASSERT(ToRegister(instr->object()).is(LoadIC::ReceiverRegister()));
ASSERT(ToRegister(instr->result()).is(eax)); ASSERT(ToRegister(instr->result()).is(eax));
__ mov(ecx, instr->name()); __ mov(LoadIC::NameRegister(), instr->name());
Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
} }
...@@ -3337,8 +3337,8 @@ Operand LCodeGen::BuildFastArrayOperand( ...@@ -3337,8 +3337,8 @@ Operand LCodeGen::BuildFastArrayOperand(
void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
ASSERT(ToRegister(instr->context()).is(esi)); ASSERT(ToRegister(instr->context()).is(esi));
ASSERT(ToRegister(instr->object()).is(edx)); ASSERT(ToRegister(instr->object()).is(KeyedLoadIC::ReceiverRegister()));
ASSERT(ToRegister(instr->key()).is(ecx)); ASSERT(ToRegister(instr->key()).is(KeyedLoadIC::NameRegister()));
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
......
...@@ -2071,7 +2071,8 @@ LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { ...@@ -2071,7 +2071,8 @@ LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
LOperand* context = UseFixed(instr->context(), esi); LOperand* context = UseFixed(instr->context(), esi);
LOperand* global_object = UseFixed(instr->global_object(), edx); LOperand* global_object = UseFixed(instr->global_object(),
LoadIC::ReceiverRegister());
LLoadGlobalGeneric* result = LLoadGlobalGeneric* result =
new(zone()) LLoadGlobalGeneric(context, global_object); new(zone()) LLoadGlobalGeneric(context, global_object);
return MarkAsCall(DefineFixed(result, eax), instr); return MarkAsCall(DefineFixed(result, eax), instr);
...@@ -2126,7 +2127,7 @@ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { ...@@ -2126,7 +2127,7 @@ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
LOperand* context = UseFixed(instr->context(), esi); LOperand* context = UseFixed(instr->context(), esi);
LOperand* object = UseFixed(instr->object(), edx); LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister());
LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context, object); LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context, object);
return MarkAsCall(DefineFixed(result, eax), instr); return MarkAsCall(DefineFixed(result, eax), instr);
} }
...@@ -2184,8 +2185,8 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { ...@@ -2184,8 +2185,8 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
LOperand* context = UseFixed(instr->context(), esi); LOperand* context = UseFixed(instr->context(), esi);
LOperand* object = UseFixed(instr->object(), edx); LOperand* object = UseFixed(instr->object(), KeyedLoadIC::ReceiverRegister());
LOperand* key = UseFixed(instr->key(), ecx); LOperand* key = UseFixed(instr->key(), KeyedLoadIC::NameRegister());
LLoadKeyedGeneric* result = LLoadKeyedGeneric* result =
new(zone()) LLoadKeyedGeneric(context, object, key); new(zone()) LLoadKeyedGeneric(context, object, key);
......
...@@ -1453,6 +1453,8 @@ void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( ...@@ -1453,6 +1453,8 @@ void KeyedLoadStubCompiler::GenerateLoadDictionaryElement(
// -- edx : receiver // -- edx : receiver
// -- esp[0] : return address // -- esp[0] : return address
// ----------------------------------- // -----------------------------------
ASSERT(edx.is(KeyedLoadIC::ReceiverRegister()));
ASSERT(ecx.is(KeyedLoadIC::NameRegister()));
Label slow, miss; Label slow, miss;
// This stub is meant to be tail-jumped to, the receiver must already // This stub is meant to be tail-jumped to, the receiver must already
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment