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

Side by Side Diff: src/ic/arm64/stub-cache-arm64.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/arm64/ic-compiler-arm64.cc ('k') | src/ic/handler-compiler.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 17
16 #define __ ACCESS_MASM(masm) 18 #define __ ACCESS_MASM(masm)
17 19
18 20
19 // Probe primary or secondary table. 21 // Probe primary or secondary table.
20 // If the entry is found in the cache, the generated code jump to the first 22 // If the entry is found in the cache, the generated code jump to the first
21 // instruction of the stub in the cache. 23 // instruction of the stub in the cache.
22 // If there is a miss the code fall trough. 24 // If there is a miss the code fall trough.
23 // 25 //
24 // 'receiver', 'name' and 'offset' registers are preserved on miss. 26 // 'receiver', 'name' and 'offset' registers are preserved on miss.
25 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, 27 static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
26 Code::Flags flags, bool leave_frame, 28 Code::Kind ic_kind, Code::Flags flags, bool leave_frame,
27 StubCache::Table table, Register receiver, Register name, 29 StubCache::Table table, Register receiver, Register name,
28 Register offset, Register scratch, Register scratch2, 30 Register offset, Register scratch, Register scratch2,
29 Register scratch3) { 31 Register scratch3) {
30 // Some code below relies on the fact that the Entry struct contains 32 // Some code below relies on the fact that the Entry struct contains
31 // 3 pointers (name, code, map). 33 // 3 pointers (name, code, map).
32 STATIC_ASSERT(sizeof(StubCache::Entry) == (3 * kPointerSize)); 34 STATIC_ASSERT(sizeof(StubCache::Entry) == (3 * kPointerSize));
33 35
34 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); 36 ExternalReference key_offset(isolate->stub_cache()->key_reference(table));
35 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); 37 ExternalReference value_offset(isolate->stub_cache()->value_reference(table));
36 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); 38 ExternalReference map_offset(isolate->stub_cache()->map_reference(table));
(...skipping 46 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 __ Add(scratch, scratch, Code::kHeaderSize - kHeapObjectTag); 87 __ Add(scratch, scratch, Code::kHeaderSize - kHeapObjectTag);
86 __ Br(scratch); 88 __ Br(scratch);
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 the flags does not name a specific type. 103 // Make sure the flags does not name a specific type.
101 DCHECK(Code::ExtractTypeFromFlags(flags) == 0); 104 DCHECK(Code::ExtractTypeFromFlags(flags) == 0);
102 105
103 // Make sure that there are no register conflicts. 106 // Make sure that there are no register conflicts.
104 DCHECK(!AreAliased(receiver, name, scratch, extra, extra2, extra3)); 107 DCHECK(!AreAliased(receiver, name, scratch, extra, extra2, extra3));
105 108
106 // Make sure extra and extra2 registers are valid. 109 // Make sure extra and extra2 registers are valid.
107 DCHECK(!extra.is(no_reg)); 110 DCHECK(!extra.is(no_reg));
108 DCHECK(!extra2.is(no_reg)); 111 DCHECK(!extra2.is(no_reg));
109 DCHECK(!extra3.is(no_reg)); 112 DCHECK(!extra3.is(no_reg));
110 113
114 #ifdef DEBUG
115 // If vector-based ics are in use, ensure that scratch, extra, extra2 and
116 // extra3 don't conflict with the vector and slot registers, which need
117 // to be preserved for a handler call or miss.
118 if (IC::ICUseVector(ic_kind)) {
119 Register vector = VectorLoadICDescriptor::VectorRegister();
120 Register slot = VectorLoadICDescriptor::SlotRegister();
121 DCHECK(!AreAliased(vector, slot, scratch, extra, extra2, extra3));
122 }
123 #endif
124
111 Counters* counters = masm->isolate()->counters(); 125 Counters* counters = masm->isolate()->counters();
112 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2, 126 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2,
113 extra3); 127 extra3);
114 128
115 // Check that the receiver isn't a smi. 129 // Check that the receiver isn't a smi.
116 __ JumpIfSmi(receiver, &miss); 130 __ JumpIfSmi(receiver, &miss);
117 131
118 // Compute the hash for primary table. 132 // Compute the hash for primary table.
119 __ Ldr(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); 133 __ Ldr(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
120 __ Ldr(extra, FieldMemOperand(receiver, HeapObject::kMapOffset)); 134 __ Ldr(extra, FieldMemOperand(receiver, HeapObject::kMapOffset));
121 __ Add(scratch, scratch, extra); 135 __ Add(scratch, scratch, extra);
122 __ Eor(scratch, scratch, flags); 136 __ Eor(scratch, scratch, flags);
123 // We shift out the last two bits because they are not part of the hash. 137 // We shift out the last two bits because they are not part of the hash.
124 __ Ubfx(scratch, scratch, kCacheIndexShift, 138 __ Ubfx(scratch, scratch, kCacheIndexShift,
125 CountTrailingZeros(kPrimaryTableSize, 64)); 139 CountTrailingZeros(kPrimaryTableSize, 64));
126 140
127 // Probe the primary table. 141 // Probe the primary table.
128 ProbeTable(isolate, masm, flags, leave_frame, kPrimary, receiver, name, 142 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kPrimary, receiver,
129 scratch, extra, extra2, extra3); 143 name, scratch, extra, extra2, extra3);
130 144
131 // Primary miss: Compute hash for secondary table. 145 // Primary miss: Compute hash for secondary table.
132 __ Sub(scratch, scratch, Operand(name, LSR, kCacheIndexShift)); 146 __ Sub(scratch, scratch, Operand(name, LSR, kCacheIndexShift));
133 __ Add(scratch, scratch, flags >> kCacheIndexShift); 147 __ Add(scratch, scratch, flags >> kCacheIndexShift);
134 __ And(scratch, scratch, kSecondaryTableSize - 1); 148 __ And(scratch, scratch, kSecondaryTableSize - 1);
135 149
136 // Probe the secondary table. 150 // Probe the secondary table.
137 ProbeTable(isolate, masm, flags, leave_frame, kSecondary, receiver, name, 151 ProbeTable(isolate, masm, ic_kind, flags, leave_frame, kSecondary, receiver,
138 scratch, extra, extra2, extra3); 152 name, scratch, extra, extra2, extra3);
139 153
140 // Cache miss: Fall-through and let caller handle the miss by 154 // Cache miss: Fall-through and let caller handle the miss by
141 // entering the runtime system. 155 // entering the runtime system.
142 __ Bind(&miss); 156 __ Bind(&miss);
143 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, 157 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2,
144 extra3); 158 extra3);
145 } 159 }
146 } 160 }
147 } // namespace v8::internal 161 } // namespace v8::internal
148 162
149 #endif // V8_TARGET_ARCH_ARM64 163 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/ic/arm64/ic-compiler-arm64.cc ('k') | src/ic/handler-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698