| 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 | 17 |
| 18 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, | 18 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, |
| 19 Code::Kind ic_kind, Code::Flags flags, bool leave_frame, | 19 Code::Kind ic_kind, Code::Flags flags, |
| 20 StubCache::Table table, Register receiver, Register name, | 20 StubCache::Table table, Register receiver, Register name, |
| 21 // Number of the cache entry, not scaled. | 21 // Number of the cache entry, not scaled. |
| 22 Register offset, Register scratch, Register scratch2, | 22 Register offset, Register scratch, Register scratch2, |
| 23 Register offset_scratch) { | 23 Register offset_scratch) { |
| 24 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); | 24 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); |
| 25 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); | 25 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); |
| 26 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); | 26 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); |
| 27 | 27 |
| 28 uint64_t key_off_addr = reinterpret_cast<uint64_t>(key_offset.address()); | 28 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()); | 29 uint64_t value_off_addr = reinterpret_cast<uint64_t>(value_offset.address()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 __ Branch(&miss, ne, flags_reg, Operand(flags)); | 74 __ Branch(&miss, ne, flags_reg, Operand(flags)); |
| 75 | 75 |
| 76 #ifdef DEBUG | 76 #ifdef DEBUG |
| 77 if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) { | 77 if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) { |
| 78 __ jmp(&miss); | 78 __ jmp(&miss); |
| 79 } else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) { | 79 } else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) { |
| 80 __ jmp(&miss); | 80 __ jmp(&miss); |
| 81 } | 81 } |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 if (leave_frame) __ LeaveFrame(StackFrame::INTERNAL); | |
| 85 | |
| 86 // Jump to the first instruction in the code stub. | 84 // Jump to the first instruction in the code stub. |
| 87 __ Daddu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag)); | 85 __ Daddu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 88 __ Jump(at); | 86 __ Jump(at); |
| 89 | 87 |
| 90 // Miss: fall through. | 88 // Miss: fall through. |
| 91 __ bind(&miss); | 89 __ bind(&miss); |
| 92 } | 90 } |
| 93 | 91 |
| 94 | 92 |
| 95 void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind, | 93 void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind, |
| 96 Code::Flags flags, bool leave_frame, | 94 Code::Flags flags, Register receiver, |
| 97 Register receiver, Register name, | 95 Register name, Register scratch, Register extra, |
| 98 Register scratch, Register extra, Register extra2, | 96 Register extra2, Register extra3) { |
| 99 Register extra3) { | |
| 100 Isolate* isolate = masm->isolate(); | 97 Isolate* isolate = masm->isolate(); |
| 101 Label miss; | 98 Label miss; |
| 102 | 99 |
| 103 // Make sure that code is valid. The multiplying code relies on the | 100 // Make sure that code is valid. The multiplying code relies on the |
| 104 // entry size being 12. | 101 // entry size being 12. |
| 105 // DCHECK(sizeof(Entry) == 12); | 102 // DCHECK(sizeof(Entry) == 12); |
| 106 // DCHECK(sizeof(Entry) == 3 * kPointerSize); | 103 // DCHECK(sizeof(Entry) == 3 * kPointerSize); |
| 107 | 104 |
| 108 // Make sure the flags does not name a specific type. | 105 // Make sure the flags does not name a specific type. |
| 109 DCHECK(Code::ExtractTypeFromFlags(flags) == 0); | 106 DCHECK(Code::ExtractTypeFromFlags(flags) == 0); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 140 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 137 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 141 __ Daddu(scratch, scratch, at); | 138 __ Daddu(scratch, scratch, at); |
| 142 uint64_t mask = kPrimaryTableSize - 1; | 139 uint64_t mask = kPrimaryTableSize - 1; |
| 143 // 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 |
| 144 // they are always 01 for maps. | 141 // they are always 01 for maps. |
| 145 __ dsrl(scratch, scratch, kCacheIndexShift); | 142 __ dsrl(scratch, scratch, kCacheIndexShift); |
| 146 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); | 143 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); |
| 147 __ And(scratch, scratch, Operand(mask)); | 144 __ And(scratch, scratch, Operand(mask)); |
| 148 | 145 |
| 149 // Probe the primary table. | 146 // Probe the primary table. |
| 150 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kPrimary, receiver, | 147 ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch, |
| 151 name, scratch, extra, extra2, extra3); | 148 extra, extra2, extra3); |
| 152 | 149 |
| 153 // Primary miss: Compute hash for secondary probe. | 150 // Primary miss: Compute hash for secondary probe. |
| 154 __ dsrl(at, name, kCacheIndexShift); | 151 __ dsrl(at, name, kCacheIndexShift); |
| 155 __ Dsubu(scratch, scratch, at); | 152 __ Dsubu(scratch, scratch, at); |
| 156 uint64_t mask2 = kSecondaryTableSize - 1; | 153 uint64_t mask2 = kSecondaryTableSize - 1; |
| 157 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); | 154 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); |
| 158 __ And(scratch, scratch, Operand(mask2)); | 155 __ And(scratch, scratch, Operand(mask2)); |
| 159 | 156 |
| 160 // Probe the secondary table. | 157 // Probe the secondary table. |
| 161 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kSecondary, receiver, | 158 ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch, |
| 162 name, scratch, extra, extra2, extra3); | 159 extra, extra2, extra3); |
| 163 | 160 |
| 164 // Cache miss: Fall-through and let caller handle the miss by | 161 // Cache miss: Fall-through and let caller handle the miss by |
| 165 // entering the runtime system. | 162 // entering the runtime system. |
| 166 __ bind(&miss); | 163 __ bind(&miss); |
| 167 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, | 164 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, |
| 168 extra3); | 165 extra3); |
| 169 } | 166 } |
| 170 | 167 |
| 171 | 168 |
| 172 #undef __ | 169 #undef __ |
| 173 } // namespace internal | 170 } // namespace internal |
| 174 } // namespace v8 | 171 } // namespace v8 |
| 175 | 172 |
| 176 #endif // V8_TARGET_ARCH_MIPS64 | 173 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |