Index: src/mips/ic-mips.cc |
=================================================================== |
--- src/mips/ic-mips.cc (revision 10474) |
+++ src/mips/ic-mips.cc (working copy) |
@@ -1038,21 +1038,27 @@ |
// Load the key (consisting of map and symbol) from the cache and |
// check for match. |
- Label try_second_entry, hit_on_first_entry, load_in_object_property; |
+ Label load_in_object_property; |
+ static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket; |
+ Label hit_on_nth_entry[kEntriesPerBucket]; |
ExternalReference cache_keys = |
ExternalReference::keyed_lookup_cache_keys(isolate); |
__ li(t0, Operand(cache_keys)); |
__ sll(at, a3, kPointerSizeLog2 + 1); |
__ addu(t0, t0, at); |
- __ lw(t1, MemOperand(t0)); |
- __ Branch(&try_second_entry, ne, a2, Operand(t1)); |
- __ lw(t1, MemOperand(t0, kPointerSize)); |
- __ Branch(&hit_on_first_entry, eq, a0, Operand(t1)); |
- __ bind(&try_second_entry); |
- __ lw(t1, MemOperand(t0, kPointerSize * 2)); |
+ for (int i = 0; i < kEntriesPerBucket - 1; i++) { |
+ Label try_next_entry; |
+ __ lw(t1, MemOperand(t0, kPointerSize * i * 2)); |
+ __ Branch(&try_next_entry, ne, a2, Operand(t1)); |
+ __ lw(t1, MemOperand(t0, kPointerSize * (i * 2 + 1))); |
+ __ Branch(&hit_on_nth_entry[i], eq, a0, Operand(t1)); |
+ __ bind(&try_next_entry); |
+ } |
+ |
+ __ lw(t1, MemOperand(t0, kPointerSize * (kEntriesPerBucket - 1) * 2)); |
__ Branch(&slow, ne, a2, Operand(t1)); |
- __ lw(t1, MemOperand(t0, kPointerSize * 3)); |
+ __ lw(t1, MemOperand(t0, kPointerSize * ((kEntriesPerBucket - 1) * 2 + 1))); |
__ Branch(&slow, ne, a0, Operand(t1)); |
// Get field offset. |
@@ -1063,26 +1069,20 @@ |
ExternalReference cache_field_offsets = |
ExternalReference::keyed_lookup_cache_field_offsets(isolate); |
- // Hit on second entry. |
- __ li(t0, Operand(cache_field_offsets)); |
- __ sll(at, a3, kPointerSizeLog2); |
- __ addu(at, t0, at); |
- __ lw(t1, MemOperand(at, kPointerSize)); |
- __ lbu(t2, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); |
- __ Subu(t1, t1, t2); |
- __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); |
- __ Branch(&load_in_object_property); |
+ // Hit on nth entry. |
+ for (int i = kEntriesPerBucket - 1; i >= 0; i--) { |
+ __ bind(&hit_on_nth_entry[i]); |
+ __ li(t0, Operand(cache_field_offsets)); |
+ __ sll(at, a3, kPointerSizeLog2); |
+ __ addu(at, t0, at); |
+ __ lw(t1, MemOperand(at, kPointerSize * i)); |
+ __ lbu(t2, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); |
+ __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); |
+ if (i != 0) { |
+ __ Branch(&load_in_object_property); |
+ } |
+ } |
- // Hit on first entry. |
- __ bind(&hit_on_first_entry); |
- __ li(t0, Operand(cache_field_offsets)); |
- __ sll(at, a3, kPointerSizeLog2); |
- __ addu(at, t0, at); |
- __ lw(t1, MemOperand(at)); |
- __ lbu(t2, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); |
- __ Subu(t1, t1, t2); |
- __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); |
- |
// Load in-object property. |
__ bind(&load_in_object_property); |
__ lbu(t2, FieldMemOperand(a2, Map::kInstanceSizeOffset)); |