Index: src/ia32/ic-ia32.cc |
diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc |
index 0b3d110d1148948a7c5a4f0cc8234d2cfd4a3c5d..f2899964e4b713f3e94161cded588216e9dc87b3 100644 |
--- a/src/ia32/ic-ia32.cc |
+++ b/src/ia32/ic-ia32.cc |
@@ -388,6 +388,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
// -- edx : receiver |
// -- esp[0] : return address |
// ----------------------------------- |
+ ASSERT(edx.is(ReceiverRegister())); |
+ ASSERT(ecx.is(NameRegister())); |
Label slow, check_name, index_smi, index_name, property_array_property; |
Label probe_dictionary, check_number_dictionary; |
@@ -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) { |
- // ----------- S t a t e ------------- |
- // -- ecx : key (index) |
- // -- edx : receiver |
- // -- esp[0] : return address |
- // ----------------------------------- |
+ // Return address is on the stack. |
Label miss; |
- Register receiver = edx; |
- Register index = ecx; |
- Register scratch = ebx; |
+ Register receiver = ReceiverRegister(); |
+ Register index = NameRegister(); |
+ Register scratch = KeyedLoadIC_TempRegister(); |
Register result = eax; |
+ ASSERT(!result.is(scratch)); |
StringCharAtGenerator char_at_generator(receiver, |
index, |
@@ -593,35 +602,36 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- ecx : key |
- // -- edx : receiver |
- // -- esp[0] : return address |
- // ----------------------------------- |
+ // Return address is on the stack. |
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. |
- __ JumpIfSmi(edx, &slow); |
+ __ JumpIfSmi(receiver, &slow); |
// 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); |
// 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 |
// are not enabled for this object. |
- __ movzx_b(eax, FieldOperand(eax, Map::kBitFieldOffset)); |
- __ and_(eax, Immediate(kSlowCaseBitFieldMask)); |
- __ cmp(eax, Immediate(1 << Map::kHasIndexedInterceptor)); |
+ __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); |
+ __ and_(scratch, Immediate(kSlowCaseBitFieldMask)); |
+ __ cmp(scratch, Immediate(1 << Map::kHasIndexedInterceptor)); |
__ j(not_zero, &slow); |
// Everything is fine, call runtime. |
- __ pop(eax); |
- __ push(edx); // receiver |
- __ push(ecx); // key |
- __ push(eax); // return address |
+ __ pop(scratch); |
+ __ push(receiver); // receiver |
+ __ push(key); // key |
+ __ push(scratch); // return address |
// Perform tail call to the entry. |
ExternalReference ref = |
@@ -640,6 +650,8 @@ void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { |
// -- edx : receiver |
// -- esp[0] : return address |
// ----------------------------------- |
+ ASSERT(edx.is(ReceiverRegister())); |
+ ASSERT(ecx.is(NameRegister())); |
Label slow, notin; |
Factory* factory = masm->isolate()->factory(); |
Operand mapped_location = |
@@ -930,6 +942,8 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
// -- edx : receiver |
// -- esp[0] : return address |
// ----------------------------------- |
+ ASSERT(edx.is(ReceiverRegister())); |
+ ASSERT(ecx.is(NameRegister())); |
// Probe the stub cache. |
Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
@@ -947,6 +961,9 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { |
// -- edx : receiver |
// -- esp[0] : return address |
// ----------------------------------- |
+ ASSERT(edx.is(ReceiverRegister())); |
+ ASSERT(ecx.is(NameRegister())); |
+ |
Label miss, slow; |
GenerateNameDictionaryReceiverCheck(masm, edx, eax, ebx, &miss); |
@@ -967,18 +984,13 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { |
void LoadIC::GenerateMiss(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- edx : receiver |
- // -- esp[0] : return address |
- // ----------------------------------- |
- |
+ // Return address is on the stack. |
__ IncrementCounter(masm->isolate()->counters()->load_miss(), 1); |
- __ pop(ebx); |
- __ push(edx); // receiver |
- __ push(ecx); // name |
- __ push(ebx); // return address |
+ __ pop(LoadIC_TempRegister()); |
+ __ push(ReceiverRegister()); // receiver |
+ __ push(NameRegister()); // name |
+ __ push(LoadIC_TempRegister()); // return address |
// Perform tail call to the entry. |
ExternalReference ref = |
@@ -988,16 +1000,11 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) { |
void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- ecx : key |
- // -- edx : receiver |
- // -- esp[0] : return address |
- // ----------------------------------- |
- |
- __ pop(ebx); |
- __ push(edx); // receiver |
- __ push(ecx); // name |
- __ push(ebx); // return address |
+ // Return address is on the stack. |
+ __ pop(LoadIC_TempRegister()); |
+ __ push(ReceiverRegister()); // receiver |
+ __ push(NameRegister()); // name |
+ __ push(LoadIC_TempRegister()); // return address |
// Perform tail call to the entry. |
__ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
@@ -1005,18 +1012,13 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- ecx : key |
- // -- edx : receiver |
- // -- esp[0] : return address |
- // ----------------------------------- |
- |
+ // Return address is on the stack. |
__ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); |
- __ pop(ebx); |
- __ push(edx); // receiver |
- __ push(ecx); // name |
- __ push(ebx); // return address |
+ __ pop(KeyedLoadIC_TempRegister()); |
+ __ push(ReceiverRegister()); // receiver |
+ __ push(NameRegister()); // name |
+ __ push(KeyedLoadIC_TempRegister()); // return address |
// Perform tail call to the entry. |
ExternalReference ref = |
@@ -1039,16 +1041,11 @@ const Register KeyedLoadIC::NameRegister() { return LoadIC::NameRegister(); } |
void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- ecx : key |
- // -- edx : receiver |
- // -- esp[0] : return address |
- // ----------------------------------- |
- |
- __ pop(ebx); |
- __ push(edx); // receiver |
- __ push(ecx); // name |
- __ push(ebx); // return address |
+ // Return address is on the stack. |
+ __ pop(KeyedLoadIC_TempRegister()); |
+ __ push(ReceiverRegister()); // receiver |
+ __ push(NameRegister()); // name |
+ __ push(KeyedLoadIC_TempRegister()); // return address |
// Perform tail call to the entry. |
__ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |