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