| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 #include "src/interface-descriptors.h" | 10 #include "src/interface-descriptors.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 #define __ ACCESS_MASM(masm) | 15 #define __ ACCESS_MASM(masm) |
| 16 | 16 |
| 17 | |
| 18 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, | 17 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, |
| 19 Code::Kind ic_kind, Code::Flags flags, | 18 Code::Flags flags, StubCache::Table table, |
| 20 StubCache::Table table, Register receiver, Register name, | 19 Register receiver, Register name, |
| 21 // Number of the cache entry, not scaled. | 20 // Number of the cache entry, not scaled. |
| 22 Register offset, Register scratch, Register scratch2, | 21 Register offset, Register scratch, Register scratch2, |
| 23 Register offset_scratch) { | 22 Register offset_scratch) { |
| 24 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); | 23 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); |
| 25 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); | 24 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); |
| 26 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); | 25 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); |
| 27 | 26 |
| 28 uint32_t key_off_addr = reinterpret_cast<uint32_t>(key_offset.address()); | 27 uint32_t key_off_addr = reinterpret_cast<uint32_t>(key_offset.address()); |
| 29 uint32_t value_off_addr = reinterpret_cast<uint32_t>(value_offset.address()); | 28 uint32_t value_off_addr = reinterpret_cast<uint32_t>(value_offset.address()); |
| 30 uint32_t map_off_addr = reinterpret_cast<uint32_t>(map_offset.address()); | 29 uint32_t map_off_addr = reinterpret_cast<uint32_t>(map_offset.address()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 __ lw(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 134 __ lw(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 136 __ Addu(scratch, scratch, at); | 135 __ Addu(scratch, scratch, at); |
| 137 uint32_t mask = kPrimaryTableSize - 1; | 136 uint32_t mask = kPrimaryTableSize - 1; |
| 138 // We shift out the last two bits because they are not part of the hash and | 137 // We shift out the last two bits because they are not part of the hash and |
| 139 // they are always 01 for maps. | 138 // they are always 01 for maps. |
| 140 __ srl(scratch, scratch, kCacheIndexShift); | 139 __ srl(scratch, scratch, kCacheIndexShift); |
| 141 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); | 140 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); |
| 142 __ And(scratch, scratch, Operand(mask)); | 141 __ And(scratch, scratch, Operand(mask)); |
| 143 | 142 |
| 144 // Probe the primary table. | 143 // Probe the primary table. |
| 145 ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch, | 144 ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra, |
| 146 extra, extra2, extra3); | 145 extra2, extra3); |
| 147 | 146 |
| 148 // Primary miss: Compute hash for secondary probe. | 147 // Primary miss: Compute hash for secondary probe. |
| 149 __ srl(at, name, kCacheIndexShift); | 148 __ srl(at, name, kCacheIndexShift); |
| 150 __ Subu(scratch, scratch, at); | 149 __ Subu(scratch, scratch, at); |
| 151 uint32_t mask2 = kSecondaryTableSize - 1; | 150 uint32_t mask2 = kSecondaryTableSize - 1; |
| 152 __ Addu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); | 151 __ Addu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); |
| 153 __ And(scratch, scratch, Operand(mask2)); | 152 __ And(scratch, scratch, Operand(mask2)); |
| 154 | 153 |
| 155 // Probe the secondary table. | 154 // Probe the secondary table. |
| 156 ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch, | 155 ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra, |
| 157 extra, extra2, extra3); | 156 extra2, extra3); |
| 158 | 157 |
| 159 // Cache miss: Fall-through and let caller handle the miss by | 158 // Cache miss: Fall-through and let caller handle the miss by |
| 160 // entering the runtime system. | 159 // entering the runtime system. |
| 161 __ bind(&miss); | 160 __ bind(&miss); |
| 162 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, | 161 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, |
| 163 extra3); | 162 extra3); |
| 164 } | 163 } |
| 165 | 164 |
| 166 | 165 |
| 167 #undef __ | 166 #undef __ |
| 168 } // namespace internal | 167 } // namespace internal |
| 169 } // namespace v8 | 168 } // namespace v8 |
| 170 | 169 |
| 171 #endif // V8_TARGET_ARCH_MIPS | 170 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |