| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 uintptr_t key_off_addr = reinterpret_cast<uintptr_t>(key_offset.address()); | 27 uintptr_t key_off_addr = reinterpret_cast<uintptr_t>(key_offset.address()); |
| 29 uintptr_t value_off_addr = | 28 uintptr_t value_off_addr = |
| 30 reinterpret_cast<uintptr_t>(value_offset.address()); | 29 reinterpret_cast<uintptr_t>(value_offset.address()); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // Get the map of the receiver and compute the hash. | 155 // Get the map of the receiver and compute the hash. |
| 157 __ lwz(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); | 156 __ lwz(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); |
| 158 __ LoadP(ip, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 157 __ LoadP(ip, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 159 __ add(scratch, scratch, ip); | 158 __ add(scratch, scratch, ip); |
| 160 __ xori(scratch, scratch, Operand(flags)); | 159 __ xori(scratch, scratch, Operand(flags)); |
| 161 // The mask omits the last two bits because they are not part of the hash. | 160 // The mask omits the last two bits because they are not part of the hash. |
| 162 __ andi(scratch, scratch, | 161 __ andi(scratch, scratch, |
| 163 Operand((kPrimaryTableSize - 1) << kCacheIndexShift)); | 162 Operand((kPrimaryTableSize - 1) << kCacheIndexShift)); |
| 164 | 163 |
| 165 // Probe the primary table. | 164 // Probe the primary table. |
| 166 ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch, | 165 ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra, |
| 167 extra, extra2, extra3); | 166 extra2, extra3); |
| 168 | 167 |
| 169 // Primary miss: Compute hash for secondary probe. | 168 // Primary miss: Compute hash for secondary probe. |
| 170 __ sub(scratch, scratch, name); | 169 __ sub(scratch, scratch, name); |
| 171 __ addi(scratch, scratch, Operand(flags)); | 170 __ addi(scratch, scratch, Operand(flags)); |
| 172 __ andi(scratch, scratch, | 171 __ andi(scratch, scratch, |
| 173 Operand((kSecondaryTableSize - 1) << kCacheIndexShift)); | 172 Operand((kSecondaryTableSize - 1) << kCacheIndexShift)); |
| 174 | 173 |
| 175 // Probe the secondary table. | 174 // Probe the secondary table. |
| 176 ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch, | 175 ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra, |
| 177 extra, extra2, extra3); | 176 extra2, extra3); |
| 178 | 177 |
| 179 // Cache miss: Fall-through and let caller handle the miss by | 178 // Cache miss: Fall-through and let caller handle the miss by |
| 180 // entering the runtime system. | 179 // entering the runtime system. |
| 181 __ bind(&miss); | 180 __ bind(&miss); |
| 182 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, | 181 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, |
| 183 extra3); | 182 extra3); |
| 184 } | 183 } |
| 185 | 184 |
| 186 | 185 |
| 187 #undef __ | 186 #undef __ |
| 188 } // namespace internal | 187 } // namespace internal |
| 189 } // namespace v8 | 188 } // namespace v8 |
| 190 | 189 |
| 191 #endif // V8_TARGET_ARCH_PPC | 190 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |