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

Side by Side Diff: src/ic/s390/ic-s390.cc

Issue 2622003004: [ic] Port {Load,Store}IC_Normal to TF (Closed)
Patch Set: fix nit Created 3 years, 11 months 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/ppc/ic-ppc.cc ('k') | src/ic/x64/ic-x64.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_S390 5 #if V8_TARGET_ARCH_S390
6 6
7 #include "src/ic/ic.h" 7 #include "src/ic/ic.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/ic/ic-compiler.h" 9 #include "src/ic/ic-compiler.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 // ---------------------------------------------------------------------------- 15 // ----------------------------------------------------------------------------
16 // Static IC stub generators. 16 // Static IC stub generators.
17 // 17 //
18 18
19 #define __ ACCESS_MASM(masm) 19 #define __ ACCESS_MASM(masm)
20 20
21 // Helper function used from LoadIC GenerateNormal.
22 //
23 // elements: Property dictionary. It is not clobbered if a jump to the miss
24 // label is done.
25 // name: Property name. It is not clobbered if a jump to the miss label is
26 // done
27 // result: Register for the result. It is only updated if a jump to the miss
28 // label is not done. Can be the same as elements or name clobbering
29 // one of these in the case of not jumping to the miss label.
30 // The two scratch registers need to be different from elements, name and
31 // result.
32 // The generated code assumes that the receiver has slow properties,
33 // is not a global object and does not have interceptors.
34 static void GenerateDictionaryLoad(MacroAssembler* masm, Label* miss,
35 Register elements, Register name,
36 Register result, Register scratch1,
37 Register scratch2) {
38 // Main use of the scratch registers.
39 // scratch1: Used as temporary and to hold the capacity of the property
40 // dictionary.
41 // scratch2: Used as temporary.
42 Label done;
43
44 // Probe the dictionary.
45 NameDictionaryLookupStub::GeneratePositiveLookup(masm, miss, &done, elements,
46 name, scratch1, scratch2);
47
48 // If probing finds an entry check that the value is a normal
49 // property.
50 __ bind(&done); // scratch2 == elements + 4 * index
51 const int kElementsStartOffset =
52 NameDictionary::kHeaderSize +
53 NameDictionary::kElementsStartIndex * kPointerSize;
54 const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
55 __ LoadP(scratch1, FieldMemOperand(scratch2, kDetailsOffset));
56 __ LoadRR(r0, scratch2);
57 __ LoadSmiLiteral(scratch2, Smi::FromInt(PropertyDetails::TypeField::kMask));
58 __ AndP(scratch2, scratch1);
59 __ bne(miss);
60 __ LoadRR(scratch2, r0);
61
62 // Get the value at the masked, scaled index and return.
63 __ LoadP(result,
64 FieldMemOperand(scratch2, kElementsStartOffset + 1 * kPointerSize));
65 }
66
67 // Helper function used from StoreIC::GenerateNormal.
68 //
69 // elements: Property dictionary. It is not clobbered if a jump to the miss
70 // label is done.
71 // name: Property name. It is not clobbered if a jump to the miss label is
72 // done
73 // value: The value to store.
74 // The two scratch registers need to be different from elements, name and
75 // result.
76 // The generated code assumes that the receiver has slow properties,
77 // is not a global object and does not have interceptors.
78 static void GenerateDictionaryStore(MacroAssembler* masm, Label* miss,
79 Register elements, Register name,
80 Register value, Register scratch1,
81 Register scratch2) {
82 // Main use of the scratch registers.
83 // scratch1: Used as temporary and to hold the capacity of the property
84 // dictionary.
85 // scratch2: Used as temporary.
86 Label done;
87
88 // Probe the dictionary.
89 NameDictionaryLookupStub::GeneratePositiveLookup(masm, miss, &done, elements,
90 name, scratch1, scratch2);
91
92 // If probing finds an entry in the dictionary check that the value
93 // is a normal property that is not read only.
94 __ bind(&done); // scratch2 == elements + 4 * index
95 const int kElementsStartOffset =
96 NameDictionary::kHeaderSize +
97 NameDictionary::kElementsStartIndex * kPointerSize;
98 const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
99 int kTypeAndReadOnlyMask =
100 PropertyDetails::TypeField::kMask |
101 PropertyDetails::AttributesField::encode(READ_ONLY);
102 __ LoadP(scratch1, FieldMemOperand(scratch2, kDetailsOffset));
103 __ LoadRR(r0, scratch2);
104 __ LoadSmiLiteral(scratch2, Smi::FromInt(kTypeAndReadOnlyMask));
105 __ AndP(scratch2, scratch1);
106 __ bne(miss /*, cr0*/);
107 __ LoadRR(scratch2, r0);
108
109 // Store the value at the masked, scaled index and return.
110 const int kValueOffset = kElementsStartOffset + kPointerSize;
111 __ AddP(scratch2, Operand(kValueOffset - kHeapObjectTag));
112 __ StoreP(value, MemOperand(scratch2));
113
114 // Update the write barrier. Make sure not to clobber the value.
115 __ LoadRR(scratch1, value);
116 __ RecordWrite(elements, scratch2, scratch1, kLRHasNotBeenSaved,
117 kDontSaveFPRegs);
118 }
119
120 void LoadIC::GenerateNormal(MacroAssembler* masm) {
121 Register dictionary = r2;
122 DCHECK(!dictionary.is(LoadDescriptor::ReceiverRegister()));
123 DCHECK(!dictionary.is(LoadDescriptor::NameRegister()));
124
125 Label slow;
126
127 __ LoadP(dictionary, FieldMemOperand(LoadDescriptor::ReceiverRegister(),
128 JSObject::kPropertiesOffset));
129 GenerateDictionaryLoad(masm, &slow, dictionary,
130 LoadDescriptor::NameRegister(), r2, r5, r6);
131 __ Ret();
132
133 // Dictionary load failed, go slow (but don't miss).
134 __ bind(&slow);
135 GenerateRuntimeGetProperty(masm);
136 }
137
138 // A register that isn't one of the parameters to the load ic.
139 static const Register LoadIC_TempRegister() { return r5; }
140
141 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
142 // The return address is in lr.
143
144 __ LoadRR(LoadIC_TempRegister(), LoadDescriptor::ReceiverRegister());
145 __ Push(LoadIC_TempRegister(), LoadDescriptor::NameRegister());
146
147 // Do tail-call to runtime routine.
148 __ TailCallRuntime(Runtime::kGetProperty);
149 }
150
151 static void StoreIC_PushArgs(MacroAssembler* masm) { 21 static void StoreIC_PushArgs(MacroAssembler* masm) {
152 __ Push(StoreWithVectorDescriptor::ValueRegister(), 22 __ Push(StoreWithVectorDescriptor::ValueRegister(),
153 StoreWithVectorDescriptor::SlotRegister(), 23 StoreWithVectorDescriptor::SlotRegister(),
154 StoreWithVectorDescriptor::VectorRegister(), 24 StoreWithVectorDescriptor::VectorRegister(),
155 StoreWithVectorDescriptor::ReceiverRegister(), 25 StoreWithVectorDescriptor::ReceiverRegister(),
156 StoreWithVectorDescriptor::NameRegister()); 26 StoreWithVectorDescriptor::NameRegister());
157 } 27 }
158 28
159 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { 29 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
160 StoreIC_PushArgs(masm); 30 StoreIC_PushArgs(masm);
161 31
162 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss); 32 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
163 } 33 }
164 34
165 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { 35 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
166 StoreIC_PushArgs(masm); 36 StoreIC_PushArgs(masm);
167 37
168 // The slow case calls into the runtime to complete the store without causing 38 // The slow case calls into the runtime to complete the store without causing
169 // an IC miss that would otherwise cause a transition to the generic stub. 39 // an IC miss that would otherwise cause a transition to the generic stub.
170 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow); 40 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
171 } 41 }
172 42
173 void StoreIC::GenerateMiss(MacroAssembler* masm) {
174 StoreIC_PushArgs(masm);
175
176 // Perform tail call to the entry.
177 __ TailCallRuntime(Runtime::kStoreIC_Miss);
178 }
179
180 void StoreIC::GenerateNormal(MacroAssembler* masm) {
181 Label miss;
182 Register receiver = StoreDescriptor::ReceiverRegister();
183 Register name = StoreDescriptor::NameRegister();
184 Register value = StoreDescriptor::ValueRegister();
185 Register dictionary = r7;
186 DCHECK(receiver.is(r3));
187 DCHECK(name.is(r4));
188 DCHECK(value.is(r2));
189 DCHECK(StoreWithVectorDescriptor::VectorRegister().is(r5));
190 DCHECK(StoreWithVectorDescriptor::SlotRegister().is(r6));
191
192 __ LoadP(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
193
194 GenerateDictionaryStore(masm, &miss, dictionary, name, value, r8, r9);
195 Counters* counters = masm->isolate()->counters();
196 __ IncrementCounter(counters->ic_store_normal_hit(), 1, r8, r9);
197 __ Ret();
198
199 __ bind(&miss);
200 __ IncrementCounter(counters->ic_store_normal_miss(), 1, r8, r9);
201 GenerateMiss(masm);
202 }
203
204 #undef __ 43 #undef __
205 44
206 Condition CompareIC::ComputeCondition(Token::Value op) { 45 Condition CompareIC::ComputeCondition(Token::Value op) {
207 switch (op) { 46 switch (op) {
208 case Token::EQ_STRICT: 47 case Token::EQ_STRICT:
209 case Token::EQ: 48 case Token::EQ:
210 return eq; 49 return eq;
211 case Token::LT: 50 case Token::LT:
212 return lt; 51 return lt;
213 case Token::GT: 52 case Token::GT:
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 patcher.masm()->brcl(cc, Operand(branch_instr & 0xffffffff)); 160 patcher.masm()->brcl(cc, Operand(branch_instr & 0xffffffff));
322 } else { 161 } else {
323 DCHECK(false); 162 DCHECK(false);
324 } 163 }
325 } 164 }
326 165
327 } // namespace internal 166 } // namespace internal
328 } // namespace v8 167 } // namespace v8
329 168
330 #endif // V8_TARGET_ARCH_S390 169 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/ic/ppc/ic-ppc.cc ('k') | src/ic/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698