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" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 | 38 |
39 Label miss; | 39 Label miss; |
40 Register base_addr = scratch; | 40 Register base_addr = scratch; |
41 scratch = no_reg; | 41 scratch = no_reg; |
42 | 42 |
43 // Multiply by 3 because there are 3 fields per entry (name, code, map). | 43 // Multiply by 3 because there are 3 fields per entry (name, code, map). |
44 __ Dlsa(offset_scratch, offset, offset, 1); | 44 __ Dlsa(offset_scratch, offset, offset, 1); |
45 | 45 |
46 // Calculate the base address of the entry. | 46 // Calculate the base address of the entry. |
47 __ li(base_addr, Operand(key_offset)); | 47 __ li(base_addr, Operand(key_offset)); |
48 __ Dlsa(base_addr, base_addr, offset_scratch, kPointerSizeLog2); | 48 __ Dlsa(base_addr, base_addr, offset_scratch, |
49 kPointerSizeLog2 - StubCache::kCacheIndexShift); | |
49 | 50 |
50 // Check that the key in the entry matches the name. | 51 // Check that the key in the entry matches the name. |
51 __ ld(at, MemOperand(base_addr, 0)); | 52 __ ld(at, MemOperand(base_addr, 0)); |
52 __ Branch(&miss, ne, name, Operand(at)); | 53 __ Branch(&miss, ne, name, Operand(at)); |
53 | 54 |
54 // Check the map matches. | 55 // Check the map matches. |
55 __ ld(at, MemOperand(base_addr, | 56 __ ld(at, MemOperand(base_addr, |
56 static_cast<int32_t>(map_off_addr - key_off_addr))); | 57 static_cast<int32_t>(map_off_addr - key_off_addr))); |
57 __ ld(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 58 __ ld(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
58 __ Branch(&miss, ne, at, Operand(scratch2)); | 59 __ Branch(&miss, ne, at, Operand(scratch2)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 #endif | 128 #endif |
128 | 129 |
129 Counters* counters = masm->isolate()->counters(); | 130 Counters* counters = masm->isolate()->counters(); |
130 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2, | 131 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2, |
131 extra3); | 132 extra3); |
132 | 133 |
133 // Check that the receiver isn't a smi. | 134 // Check that the receiver isn't a smi. |
134 __ JumpIfSmi(receiver, &miss); | 135 __ JumpIfSmi(receiver, &miss); |
135 | 136 |
136 // Get the map of the receiver and compute the hash. | 137 // Get the map of the receiver and compute the hash. |
137 __ ld(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); | 138 __ lwu(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); |
138 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 139 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
139 __ Daddu(scratch, scratch, at); | 140 __ Addu(scratch, scratch, at); |
140 uint64_t mask = kPrimaryTableSize - 1; | 141 __ Xor(scratch, scratch, Operand(flags)); |
141 // We shift out the last two bits because they are not part of the hash and | 142 __ li(at, Operand(kPrimaryTableSize - 1)); |
142 // they are always 01 for maps. | 143 __ sll(at, at, kCacheIndexShift); |
Jakob Kummerow
2016/07/20 12:09:45
Same comment as for mips32 here.
Igor Sheludko
2016/07/20 13:40:26
Done.
| |
143 __ dsrl(scratch, scratch, kCacheIndexShift); | 144 __ And(scratch, scratch, at); |
144 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); | |
145 __ And(scratch, scratch, Operand(mask)); | |
146 | 145 |
147 // Probe the primary table. | 146 // Probe the primary table. |
148 ProbeTable(this, masm, flags, kPrimary, receiver, name, scratch, extra, | 147 ProbeTable(this, masm, flags, kPrimary, receiver, name, scratch, extra, |
149 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 __ Subu(scratch, scratch, name); |
153 __ Dsubu(scratch, scratch, at); | 152 __ Addu(scratch, scratch, flags); |
154 uint64_t mask2 = kSecondaryTableSize - 1; | 153 __ li(at, Operand(kSecondaryTableSize - 1)); |
155 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); | 154 __ sll(at, at, kCacheIndexShift); |
156 __ And(scratch, scratch, Operand(mask2)); | 155 __ And(scratch, scratch, at); |
157 | 156 |
158 // Probe the secondary table. | 157 // Probe the secondary table. |
159 ProbeTable(this, masm, flags, kSecondary, receiver, name, scratch, extra, | 158 ProbeTable(this, masm, flags, kSecondary, receiver, name, scratch, extra, |
160 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 |