Index: src/arm/ic-arm.cc |
diff --git a/src/arm/ic-arm.cc b/src/arm/ic-arm.cc |
index 506ab64d716864f83968a093132f452eb39dd864..85a7cf52e6a0f1547eb533ae5673975551d7d198 100644 |
--- a/src/arm/ic-arm.cc |
+++ b/src/arm/ic-arm.cc |
@@ -316,6 +316,8 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
// -- lr : return address |
// -- r0 : receiver |
// ----------------------------------- |
+ ASSERT(r0.is(ReceiverRegister())); |
+ ASSERT(r2.is(NameRegister())); |
// Probe the stub cache. |
Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
@@ -333,6 +335,9 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { |
// -- lr : return address |
// -- r0 : receiver |
// ----------------------------------- |
+ ASSERT(r0.is(ReceiverRegister())); |
+ ASSERT(r2.is(NameRegister())); |
+ |
Label miss, slow; |
GenerateNameDictionaryReceiverCheck(masm, r0, r1, r3, r4, &miss); |
@@ -351,18 +356,18 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { |
} |
+// A register that isn't one of the parameters to the load ic. |
+static const Register LoadIC_TempRegister() { return r3; } |
+ |
+ |
void LoadIC::GenerateMiss(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- r2 : name |
- // -- lr : return address |
- // -- r0 : receiver |
- // ----------------------------------- |
+ // The return address is on the stack. |
Isolate* isolate = masm->isolate(); |
__ IncrementCounter(isolate->counters()->load_miss(), 1, r3, r4); |
- __ mov(r3, r0); |
- __ Push(r3, r2); |
+ __ mov(LoadIC_TempRegister(), ReceiverRegister()); |
+ __ Push(LoadIC_TempRegister(), NameRegister()); |
// Perform tail call to the entry. |
ExternalReference ref = |
@@ -372,14 +377,10 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) { |
void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
- // ---------- S t a t e -------------- |
- // -- r2 : name |
- // -- lr : return address |
- // -- r0 : receiver |
- // ----------------------------------- |
+ // The return address is on the stack. |
- __ mov(r3, r0); |
- __ Push(r3, r2); |
+ __ mov(LoadIC_TempRegister(), ReceiverRegister()); |
+ __ Push(LoadIC_TempRegister(), NameRegister()); |
__ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
} |
@@ -476,6 +477,8 @@ void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { |
// -- r0 : key |
// -- r1 : receiver |
// ----------------------------------- |
+ ASSERT(r1.is(ReceiverRegister())); |
+ ASSERT(r0.is(NameRegister())); |
Label slow, notin; |
MemOperand mapped_location = |
GenerateMappedArgumentsLookup(masm, r1, r0, r2, r3, r4, ¬in, &slow); |
@@ -526,16 +529,12 @@ void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { |
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
- // ---------- S t a t e -------------- |
- // -- lr : return address |
- // -- r0 : key |
- // -- r1 : receiver |
- // ----------------------------------- |
+ // The return address is on the stack. |
Isolate* isolate = masm->isolate(); |
__ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r3, r4); |
- __ Push(r1, r0); |
+ __ Push(ReceiverRegister(), NameRegister()); |
// Perform tail call to the entry. |
ExternalReference ref = |
@@ -553,13 +552,9 @@ const Register KeyedLoadIC::NameRegister() { return r0; } |
void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
- // ---------- S t a t e -------------- |
- // -- lr : return address |
- // -- r0 : key |
- // -- r1 : receiver |
- // ----------------------------------- |
+ // The return address is on the stack. |
- __ Push(r1, r0); |
+ __ Push(ReceiverRegister(), NameRegister()); |
__ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
} |
@@ -574,8 +569,10 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
Label slow, check_name, index_smi, index_name, property_array_property; |
Label probe_dictionary, check_number_dictionary; |
- Register key = r0; |
- Register receiver = r1; |
+ Register key = NameRegister(); |
+ Register receiver = ReceiverRegister(); |
+ ASSERT(key.is(r0)); |
+ ASSERT(receiver.is(r1)); |
Isolate* isolate = masm->isolate(); |
@@ -737,17 +734,14 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
- // ---------- S t a t e -------------- |
- // -- lr : return address |
- // -- r0 : key (index) |
- // -- r1 : receiver |
- // ----------------------------------- |
+ // Return address is on the stack. |
Label miss; |
- Register receiver = r1; |
- Register index = r0; |
+ Register receiver = ReceiverRegister(); |
+ Register index = NameRegister(); |
Register scratch = r3; |
Register result = r0; |
+ ASSERT(!scratch.is(receiver) && !scratch.is(index)); |
StringCharAtGenerator char_at_generator(receiver, |
index, |
@@ -769,32 +763,35 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
- // ---------- S t a t e -------------- |
- // -- lr : return address |
- // -- r0 : key |
- // -- r1 : receiver |
- // ----------------------------------- |
+ // Return address is on the stack. |
Label slow; |
+ Register receiver = ReceiverRegister(); |
+ Register key = NameRegister(); |
+ Register scratch1 = r2; |
+ Register scratch2 = r3; |
+ ASSERT(!scratch1.is(receiver) && !scratch1.is(key)); |
+ ASSERT(!scratch2.is(receiver) && !scratch2.is(key)); |
+ |
// Check that the receiver isn't a smi. |
- __ JumpIfSmi(r1, &slow); |
+ __ JumpIfSmi(receiver, &slow); |
// Check that the key is an array index, that is Uint32. |
- __ NonNegativeSmiTst(r0); |
+ __ NonNegativeSmiTst(key); |
__ b(ne, &slow); |
// Get the map of the receiver. |
- __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
+ __ ldr(scratch1, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
// Check that it has indexed interceptor and access checks |
// are not enabled for this object. |
- __ ldrb(r3, FieldMemOperand(r2, Map::kBitFieldOffset)); |
- __ and_(r3, r3, Operand(kSlowCaseBitFieldMask)); |
- __ cmp(r3, Operand(1 << Map::kHasIndexedInterceptor)); |
+ __ ldrb(scratch2, FieldMemOperand(scratch1, Map::kBitFieldOffset)); |
+ __ and_(scratch2, scratch2, Operand(kSlowCaseBitFieldMask)); |
+ __ cmp(scratch2, Operand(1 << Map::kHasIndexedInterceptor)); |
__ b(ne, &slow); |
// Everything is fine, call runtime. |
- __ Push(r1, r0); // Receiver, key. |
+ __ Push(receiver, key); // Receiver, key. |
// Perform tail call to the entry. |
__ TailCallExternalReference( |