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

Side by Side Diff: src/ic/mips/stub-cache-mips.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/mips/ic-mips.cc ('k') | src/ic/mips64/handler-compiler-mips64.cc » ('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_MIPS 7 #if V8_TARGET_ARCH_MIPS
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 uint32_t key_off_addr = reinterpret_cast<uint32_t>(key_offset.address()); 30 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()); 31 uint32_t value_off_addr = reinterpret_cast<uint32_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 __ Addu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag)); 87 __ Addu(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 106
104 // Make sure the flags does not name a specific type. 107 // Make sure the flags does not name a specific type.
105 DCHECK(Code::ExtractTypeFromFlags(flags) == 0); 108 DCHECK(Code::ExtractTypeFromFlags(flags) == 0);
106 109
107 // Make sure that there are no register conflicts. 110 // Make sure that there are no register conflicts.
108 DCHECK(!scratch.is(receiver)); 111 DCHECK(!AreAliased(receiver, name, scratch, extra, extra2, extra3));
109 DCHECK(!scratch.is(name));
110 DCHECK(!extra.is(receiver));
111 DCHECK(!extra.is(name));
112 DCHECK(!extra.is(scratch));
113 DCHECK(!extra2.is(receiver));
114 DCHECK(!extra2.is(name));
115 DCHECK(!extra2.is(scratch));
116 DCHECK(!extra2.is(extra));
117 112
118 // Check register validity. 113 // Check register validity.
119 DCHECK(!scratch.is(no_reg)); 114 DCHECK(!scratch.is(no_reg));
120 DCHECK(!extra.is(no_reg)); 115 DCHECK(!extra.is(no_reg));
121 DCHECK(!extra2.is(no_reg)); 116 DCHECK(!extra2.is(no_reg));
122 DCHECK(!extra3.is(no_reg)); 117 DCHECK(!extra3.is(no_reg));
123 118
119 #ifdef DEBUG
120 // If vector-based ics are in use, ensure that scratch, extra, extra2 and
121 // extra3 don't conflict with the vector and slot registers, which need
122 // to be preserved for a handler call or miss.
123 if (IC::ICUseVector(ic_kind)) {
124 Register vector = VectorLoadICDescriptor::VectorRegister();
125 Register slot = VectorLoadICDescriptor::SlotRegister();
126 DCHECK(!AreAliased(vector, slot, scratch, extra, extra2, extra3));
127 }
128 #endif
129
124 Counters* counters = masm->isolate()->counters(); 130 Counters* counters = masm->isolate()->counters();
125 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2, 131 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2,
126 extra3); 132 extra3);
127 133
128 // Check that the receiver isn't a smi. 134 // Check that the receiver isn't a smi.
129 __ JumpIfSmi(receiver, &miss); 135 __ JumpIfSmi(receiver, &miss);
130 136
131 // Get the map of the receiver and compute the hash. 137 // Get the map of the receiver and compute the hash.
132 __ lw(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); 138 __ lw(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
133 __ lw(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); 139 __ lw(at, FieldMemOperand(receiver, HeapObject::kMapOffset));
134 __ Addu(scratch, scratch, at); 140 __ Addu(scratch, scratch, at);
135 uint32_t mask = kPrimaryTableSize - 1; 141 uint32_t mask = kPrimaryTableSize - 1;
136 // We shift out the last two bits because they are not part of the hash and 142 // We shift out the last two bits because they are not part of the hash and
137 // they are always 01 for maps. 143 // they are always 01 for maps.
138 __ srl(scratch, scratch, kCacheIndexShift); 144 __ srl(scratch, scratch, kCacheIndexShift);
139 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask)); 145 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask));
140 __ And(scratch, scratch, Operand(mask)); 146 __ And(scratch, scratch, Operand(mask));
141 147
142 // Probe the primary table. 148 // Probe the primary table.
143 ProbeTable(isolate, masm, flags, leave_frame, kPrimary, receiver, name, 149 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kPrimary, receiver,
144 scratch, extra, extra2, extra3); 150 name, scratch, extra, extra2, extra3);
145 151
146 // Primary miss: Compute hash for secondary probe. 152 // Primary miss: Compute hash for secondary probe.
147 __ srl(at, name, kCacheIndexShift); 153 __ srl(at, name, kCacheIndexShift);
148 __ Subu(scratch, scratch, at); 154 __ Subu(scratch, scratch, at);
149 uint32_t mask2 = kSecondaryTableSize - 1; 155 uint32_t mask2 = kSecondaryTableSize - 1;
150 __ Addu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2)); 156 __ Addu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2));
151 __ And(scratch, scratch, Operand(mask2)); 157 __ And(scratch, scratch, Operand(mask2));
152 158
153 // Probe the secondary table. 159 // Probe the secondary table.
154 ProbeTable(isolate, masm, flags, leave_frame, kSecondary, receiver, name, 160 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kSecondary, receiver,
155 scratch, extra, extra2, extra3); 161 name, scratch, extra, extra2, extra3);
156 162
157 // Cache miss: Fall-through and let caller handle the miss by 163 // Cache miss: Fall-through and let caller handle the miss by
158 // entering the runtime system. 164 // entering the runtime system.
159 __ bind(&miss); 165 __ bind(&miss);
160 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, 166 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2,
161 extra3); 167 extra3);
162 } 168 }
163 169
164 170
165 #undef __ 171 #undef __
166 } 172 }
167 } // namespace v8::internal 173 } // namespace v8::internal
168 174
169 #endif // V8_TARGET_ARCH_MIPS 175 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic/mips/ic-mips.cc ('k') | src/ic/mips64/handler-compiler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698