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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 uint64_t key_off_addr = reinterpret_cast<uint64_t>(key_offset.address()); | 27 uint64_t key_off_addr = reinterpret_cast<uint64_t>(key_offset.address()); |
29 uint64_t value_off_addr = reinterpret_cast<uint64_t>(value_offset.address()); | 28 uint64_t value_off_addr = reinterpret_cast<uint64_t>(value_offset.address()); |
30 uint64_t map_off_addr = reinterpret_cast<uint64_t>(map_offset.address()); | 29 uint64_t map_off_addr = reinterpret_cast<uint64_t>(map_offset.address()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 137 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
139 __ Daddu(scratch, scratch, at); | 138 __ Daddu(scratch, scratch, at); |
140 uint64_t mask = kPrimaryTableSize - 1; | 139 uint64_t mask = kPrimaryTableSize - 1; |
141 // We shift out the last two bits because they are not part of the hash and | 140 // We shift out the last two bits because they are not part of the hash and |
142 // they are always 01 for maps. | 141 // they are always 01 for maps. |
143 __ dsrl(scratch, scratch, kCacheIndexShift); | 142 __ dsrl(scratch, scratch, kCacheIndexShift); |
144 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); | 143 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); |
145 __ And(scratch, scratch, Operand(mask)); | 144 __ And(scratch, scratch, Operand(mask)); |
146 | 145 |
147 // Probe the primary table. | 146 // Probe the primary table. |
148 ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch, | 147 ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra, |
149 extra, extra2, extra3); | 148 extra2, extra3); |
150 | 149 |
151 // Primary miss: Compute hash for secondary probe. | 150 // Primary miss: Compute hash for secondary probe. |
152 __ dsrl(at, name, kCacheIndexShift); | 151 __ dsrl(at, name, kCacheIndexShift); |
153 __ Dsubu(scratch, scratch, at); | 152 __ Dsubu(scratch, scratch, at); |
154 uint64_t mask2 = kSecondaryTableSize - 1; | 153 uint64_t mask2 = kSecondaryTableSize - 1; |
155 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); | 154 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); |
156 __ And(scratch, scratch, Operand(mask2)); | 155 __ And(scratch, scratch, Operand(mask2)); |
157 | 156 |
158 // Probe the secondary table. | 157 // Probe the secondary table. |
159 ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch, | 158 ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra, |
160 extra, extra2, extra3); | 159 extra2, extra3); |
161 | 160 |
162 // Cache miss: Fall-through and let caller handle the miss by | 161 // Cache miss: Fall-through and let caller handle the miss by |
163 // entering the runtime system. | 162 // entering the runtime system. |
164 __ bind(&miss); | 163 __ bind(&miss); |
165 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, | 164 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, |
166 extra3); | 165 extra3); |
167 } | 166 } |
168 | 167 |
169 | 168 |
170 #undef __ | 169 #undef __ |
171 } // namespace internal | 170 } // namespace internal |
172 } // namespace v8 | 171 } // namespace v8 |
173 | 172 |
174 #endif // V8_TARGET_ARCH_MIPS64 | 173 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |