Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 37a3c4f42df25f37f9600b789bed5c1e8a083866..d760d6d8e2cda6d69eae874b6ad25c67eb9a39f4 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -1238,30 +1238,44 @@ void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, |
Handle<AccessorInfo> callback, |
Handle<String> name, |
Label* miss) { |
+ ASSERT(!receiver.is(scratch2)); |
+ ASSERT(!receiver.is(scratch3)); |
Register dictionary = scratch1; |
- Register index = scratch2; |
+ bool must_preserve_dictionary_reg = receiver.is(dictionary); |
+ |
+ // Load the properties dictionary. |
+ if (must_preserve_dictionary_reg) { |
+ __ push(dictionary); |
Erik Corry
2012/08/14 11:03:33
This is slow on ARM and unnecessary when there are
Michael Starzinger
2012/08/14 11:44:05
Done.
|
+ } |
__ ldr(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
// Probe the dictionary. |
- Label probe_done; |
+ Label probe_done, pop_and_miss; |
StringDictionaryLookupStub::GeneratePositiveLookup(masm(), |
- miss, |
+ &pop_and_miss, |
&probe_done, |
dictionary, |
name_reg, |
- index, // Set if we hit. |
+ scratch2, |
scratch3); |
+ __ bind(&pop_and_miss); |
+ if (must_preserve_dictionary_reg) { |
+ __ pop(dictionary); |
+ } |
+ __ jmp(miss); |
__ bind(&probe_done); |
+ if (must_preserve_dictionary_reg) { |
+ __ pop(dictionary); |
+ } |
- // If probing finds an entry in the dictionary, check that the value is the |
- // callback. |
- const int kElementsStartOffset = |
- StringDictionary::kHeaderSize + |
+ // If probing finds an entry in the dictionary, scratch3 contains the |
+ // pointer into the dictionary. Check that the value is the callback. |
+ Register pointer = scratch3; |
+ const int kElementsStartOffset = StringDictionary::kHeaderSize + |
StringDictionary::kElementsStartIndex * kPointerSize; |
const int kValueOffset = kElementsStartOffset + kPointerSize; |
- __ add(scratch1, dictionary, Operand(kValueOffset - kHeapObjectTag)); |
- __ ldr(scratch3, MemOperand(scratch1, index, LSL, kPointerSizeLog2)); |
- __ cmp(scratch3, Operand(callback)); |
+ __ ldr(scratch2, FieldMemOperand(pointer, kValueOffset)); |
+ __ cmp(scratch2, Operand(callback)); |
__ b(ne, miss); |
} |
@@ -1285,7 +1299,7 @@ void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, |
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
GenerateDictionaryLoadCallback( |
- receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); |
+ reg, name_reg, scratch1, scratch2, scratch3, callback, name, miss); |
} |
// Build AccessorInfo::args_ list on the stack and push property name below |