Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: src/ic/mips64/stub-cache-mips64.cc

Issue 767743002: Hydrogen code stubs for vector-based ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/ic/stub-cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/ic.h"
10 #include "src/ic/stub-cache.h" 11 #include "src/ic/stub-cache.h"
12 #include "src/interface-descriptors.h"
11 13
12 namespace v8 { 14 namespace v8 {
13 namespace internal { 15 namespace internal {
14 16
15 #define __ ACCESS_MASM(masm) 17 #define __ ACCESS_MASM(masm)
16 18
17 19
18 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, 20 static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
19 Code::Flags flags, bool leave_frame, 21 Code::Kind ic_kind, Code::Flags flags, bool leave_frame,
20 StubCache::Table table, Register receiver, Register name, 22 StubCache::Table table, Register receiver, Register name,
21 // Number of the cache entry, not scaled. 23 // Number of the cache entry, not scaled.
22 Register offset, Register scratch, Register scratch2, 24 Register offset, Register scratch, Register scratch2,
23 Register offset_scratch) { 25 Register offset_scratch) {
24 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); 26 ExternalReference key_offset(isolate->stub_cache()->key_reference(table));
25 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); 27 ExternalReference value_offset(isolate->stub_cache()->value_reference(table));
26 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); 28 ExternalReference map_offset(isolate->stub_cache()->map_reference(table));
27 29
28 uint64_t key_off_addr = reinterpret_cast<uint64_t>(key_offset.address()); 30 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()); 31 uint64_t value_off_addr = reinterpret_cast<uint64_t>(value_offset.address());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 85
84 // Jump to the first instruction in the code stub. 86 // Jump to the first instruction in the code stub.
85 __ Daddu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag)); 87 __ Daddu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag));
86 __ Jump(at); 88 __ Jump(at);
87 89
88 // Miss: fall through. 90 // Miss: fall through.
89 __ bind(&miss); 91 __ bind(&miss);
90 } 92 }
91 93
92 94
93 void StubCache::GenerateProbe(MacroAssembler* masm, Code::Flags flags, 95 void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
94 bool leave_frame, Register receiver, 96 Code::Flags flags, bool leave_frame,
95 Register name, Register scratch, Register extra, 97 Register receiver, Register name,
96 Register extra2, Register extra3) { 98 Register scratch, Register extra, Register extra2,
99 Register extra3) {
97 Isolate* isolate = masm->isolate(); 100 Isolate* isolate = masm->isolate();
98 Label miss; 101 Label miss;
99 102
100 // Make sure that code is valid. The multiplying code relies on the 103 // Make sure that code is valid. The multiplying code relies on the
101 // entry size being 12. 104 // entry size being 12.
102 // DCHECK(sizeof(Entry) == 12); 105 // DCHECK(sizeof(Entry) == 12);
103 // DCHECK(sizeof(Entry) == 3 * kPointerSize); 106 // DCHECK(sizeof(Entry) == 3 * kPointerSize);
104 107
105 // Make sure the flags does not name a specific type. 108 // Make sure the flags does not name a specific type.
106 DCHECK(Code::ExtractTypeFromFlags(flags) == 0); 109 DCHECK(Code::ExtractTypeFromFlags(flags) == 0);
107 110
108 // Make sure that there are no register conflicts. 111 // Make sure that there are no register conflicts.
109 DCHECK(!scratch.is(receiver)); 112 DCHECK(!AreAliased(receiver, name, scratch, extra, extra2, extra3));
110 DCHECK(!scratch.is(name));
111 DCHECK(!extra.is(receiver));
112 DCHECK(!extra.is(name));
113 DCHECK(!extra.is(scratch));
114 DCHECK(!extra2.is(receiver));
115 DCHECK(!extra2.is(name));
116 DCHECK(!extra2.is(scratch));
117 DCHECK(!extra2.is(extra));
118 113
119 // Check register validity. 114 // Check register validity.
120 DCHECK(!scratch.is(no_reg)); 115 DCHECK(!scratch.is(no_reg));
121 DCHECK(!extra.is(no_reg)); 116 DCHECK(!extra.is(no_reg));
122 DCHECK(!extra2.is(no_reg)); 117 DCHECK(!extra2.is(no_reg));
123 DCHECK(!extra3.is(no_reg)); 118 DCHECK(!extra3.is(no_reg));
124 119
120 #ifdef DEBUG
121 // If vector-based ics are in use, ensure that scratch, extra, extra2 and
122 // extra3 don't conflict with the vector and slot registers, which need
123 // to be preserved for a handler call or miss.
124 if (IC::ICUseVector(ic_kind)) {
125 Register vector = VectorLoadICDescriptor::VectorRegister();
126 Register slot = VectorLoadICDescriptor::SlotRegister();
127 DCHECK(!AreAliased(vector, slot, scratch, extra, extra2, extra3));
128 }
129 #endif
130
125 Counters* counters = masm->isolate()->counters(); 131 Counters* counters = masm->isolate()->counters();
126 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2, 132 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2,
127 extra3); 133 extra3);
128 134
129 // Check that the receiver isn't a smi. 135 // Check that the receiver isn't a smi.
130 __ JumpIfSmi(receiver, &miss); 136 __ JumpIfSmi(receiver, &miss);
131 137
132 // Get the map of the receiver and compute the hash. 138 // Get the map of the receiver and compute the hash.
133 __ ld(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); 139 __ ld(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
134 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); 140 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset));
135 __ Daddu(scratch, scratch, at); 141 __ Daddu(scratch, scratch, at);
136 uint64_t mask = kPrimaryTableSize - 1; 142 uint64_t mask = kPrimaryTableSize - 1;
137 // We shift out the last two bits because they are not part of the hash and 143 // We shift out the last two bits because they are not part of the hash and
138 // they are always 01 for maps. 144 // they are always 01 for maps.
139 __ dsrl(scratch, scratch, kCacheIndexShift); 145 __ dsrl(scratch, scratch, kCacheIndexShift);
140 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); 146 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask));
141 __ And(scratch, scratch, Operand(mask)); 147 __ And(scratch, scratch, Operand(mask));
142 148
143 // Probe the primary table. 149 // Probe the primary table.
144 ProbeTable(isolate, masm, flags, leave_frame, kPrimary, receiver, name, 150 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kPrimary, receiver,
145 scratch, extra, extra2, extra3); 151 name, scratch, extra, extra2, extra3);
146 152
147 // Primary miss: Compute hash for secondary probe. 153 // Primary miss: Compute hash for secondary probe.
148 __ dsrl(at, name, kCacheIndexShift); 154 __ dsrl(at, name, kCacheIndexShift);
149 __ Dsubu(scratch, scratch, at); 155 __ Dsubu(scratch, scratch, at);
150 uint64_t mask2 = kSecondaryTableSize - 1; 156 uint64_t mask2 = kSecondaryTableSize - 1;
151 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); 157 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2));
152 __ And(scratch, scratch, Operand(mask2)); 158 __ And(scratch, scratch, Operand(mask2));
153 159
154 // Probe the secondary table. 160 // Probe the secondary table.
155 ProbeTable(isolate, masm, flags, leave_frame, kSecondary, receiver, name, 161 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kSecondary, receiver,
156 scratch, extra, extra2, extra3); 162 name, scratch, extra, extra2, extra3);
157 163
158 // Cache miss: Fall-through and let caller handle the miss by 164 // Cache miss: Fall-through and let caller handle the miss by
159 // entering the runtime system. 165 // entering the runtime system.
160 __ bind(&miss); 166 __ bind(&miss);
161 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, 167 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2,
162 extra3); 168 extra3);
163 } 169 }
164 170
165 171
166 #undef __ 172 #undef __
167 } 173 }
168 } // namespace v8::internal 174 } // namespace v8::internal
169 175
170 #endif // V8_TARGET_ARCH_MIPS64 176 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/ic/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698