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

Side by Side Diff: src/mips64/builtins-mips64.cc

Issue 2069423002: [builtins] Introduce a proper BUILTIN frame type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix clobbered reg in mips Created 4 years, 6 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/mips/builtins-mips.cc ('k') | src/x64/builtins-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 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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 137 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
138 ArrayConstructorStub stub(masm->isolate()); 138 ArrayConstructorStub stub(masm->isolate());
139 __ TailCallStub(&stub); 139 __ TailCallStub(&stub);
140 } 140 }
141 141
142 142
143 // static 143 // static
144 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { 144 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
145 // ----------- S t a t e ------------- 145 // ----------- S t a t e -------------
146 // -- a0 : number of arguments 146 // -- a0 : number of arguments
147 // -- a1 : function
148 // -- cp : context
147 // -- ra : return address 149 // -- ra : return address
148 // -- sp[(argc - n) * 8] : arg[n] (zero-based) 150 // -- sp[(argc - n) * 8] : arg[n] (zero-based)
149 // -- sp[(argc + 1) * 8] : receiver 151 // -- sp[(argc + 1) * 8] : receiver
150 // ----------------------------------- 152 // -----------------------------------
151 Heap::RootListIndex const root_index = 153 Heap::RootListIndex const root_index =
152 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex 154 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex
153 : Heap::kMinusInfinityValueRootIndex; 155 : Heap::kMinusInfinityValueRootIndex;
154 156
155 // Load the accumulator with the default return value (either -Infinity or 157 // Load the accumulator with the default return value (either -Infinity or
156 // +Infinity), with the tagged value in a1 and the double value in f0. 158 // +Infinity), with the tagged value in t1 and the double value in f0.
157 __ LoadRoot(a1, root_index); 159 __ LoadRoot(t1, root_index);
158 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); 160 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset));
159 __ Addu(a3, a0, 1); 161 __ Addu(a3, a0, 1);
160 162
161 Label done_loop, loop; 163 Label done_loop, loop;
162 __ bind(&loop); 164 __ bind(&loop);
163 { 165 {
164 // Check if all parameters done. 166 // Check if all parameters done.
165 __ Dsubu(a0, a0, Operand(1)); 167 __ Dsubu(a0, a0, Operand(1));
166 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); 168 __ Branch(&done_loop, lt, a0, Operand(zero_reg));
167 169
168 // Load the next parameter tagged value into a2. 170 // Load the next parameter tagged value into a2.
169 __ Dlsa(at, sp, a0, kPointerSizeLog2); 171 __ Dlsa(at, sp, a0, kPointerSizeLog2);
170 __ ld(a2, MemOperand(at)); 172 __ ld(a2, MemOperand(at));
171 173
172 // Load the double value of the parameter into f2, maybe converting the 174 // Load the double value of the parameter into f2, maybe converting the
173 // parameter to a number first using the ToNumber builtin if necessary. 175 // parameter to a number first using the ToNumber builtin if necessary.
174 Label convert, convert_smi, convert_number, done_convert; 176 Label convert, convert_smi, convert_number, done_convert;
175 __ bind(&convert); 177 __ bind(&convert);
176 __ JumpIfSmi(a2, &convert_smi); 178 __ JumpIfSmi(a2, &convert_smi);
177 __ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset)); 179 __ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset));
178 __ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &convert_number); 180 __ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &convert_number);
179 { 181 {
180 // Parameter is not a Number, use the ToNumber builtin to convert it. 182 // Parameter is not a Number, use the ToNumber builtin to convert it.
181 FrameScope scope(masm, StackFrame::INTERNAL); 183 FrameScope scope(masm, StackFrame::MANUAL);
184 __ Push(ra, fp);
185 __ Move(fp, sp);
186 __ Push(cp, a1);
182 __ SmiTag(a0); 187 __ SmiTag(a0);
183 __ SmiTag(a3); 188 __ SmiTag(a3);
184 __ Push(a0, a1, a3); 189 __ Push(a0, t1, a3);
185 __ mov(a0, a2); 190 __ mov(a0, a2);
186 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); 191 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
187 __ mov(a2, v0); 192 __ mov(a2, v0);
188 __ Pop(a0, a1, a3); 193 __ Pop(a0, t1, a3);
189 { 194 {
190 // Restore the double accumulator value (f0). 195 // Restore the double accumulator value (f0).
191 Label restore_smi, done_restore; 196 Label restore_smi, done_restore;
192 __ JumpIfSmi(a1, &restore_smi); 197 __ JumpIfSmi(t1, &restore_smi);
193 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); 198 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset));
194 __ jmp(&done_restore); 199 __ jmp(&done_restore);
195 __ bind(&restore_smi); 200 __ bind(&restore_smi);
196 __ SmiToDoubleFPURegister(a1, f0, a4); 201 __ SmiToDoubleFPURegister(t1, f0, a4);
197 __ bind(&done_restore); 202 __ bind(&done_restore);
198 } 203 }
199 __ SmiUntag(a3); 204 __ SmiUntag(a3);
200 __ SmiUntag(a0); 205 __ SmiUntag(a0);
206 __ Pop(cp, a1);
207 __ Pop(ra, fp);
201 } 208 }
202 __ jmp(&convert); 209 __ jmp(&convert);
203 __ bind(&convert_number); 210 __ bind(&convert_number);
204 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset)); 211 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset));
205 __ jmp(&done_convert); 212 __ jmp(&done_convert);
206 __ bind(&convert_smi); 213 __ bind(&convert_smi);
207 __ SmiToDoubleFPURegister(a2, f2, a4); 214 __ SmiToDoubleFPURegister(a2, f2, a4);
208 __ bind(&done_convert); 215 __ bind(&done_convert);
209 216
210 // Perform the actual comparison with using Min/Max macro instructions the 217 // Perform the actual comparison with using Min/Max macro instructions the
211 // accumulator value on the left hand side (f0) and the next parameter value 218 // accumulator value on the left hand side (f0) and the next parameter value
212 // on the right hand side (f2). 219 // on the right hand side (f2).
213 // We need to work out which HeapNumber (or smi) the result came from. 220 // We need to work out which HeapNumber (or smi) the result came from.
214 Label compare_nan; 221 Label compare_nan;
215 __ BranchF(nullptr, &compare_nan, eq, f0, f2); 222 __ BranchF(nullptr, &compare_nan, eq, f0, f2);
216 __ Move(a4, f0); 223 __ Move(a4, f0);
217 if (kind == MathMaxMinKind::kMin) { 224 if (kind == MathMaxMinKind::kMin) {
218 __ MinNaNCheck_d(f0, f0, f2); 225 __ MinNaNCheck_d(f0, f0, f2);
219 } else { 226 } else {
220 DCHECK(kind == MathMaxMinKind::kMax); 227 DCHECK(kind == MathMaxMinKind::kMax);
221 __ MaxNaNCheck_d(f0, f0, f2); 228 __ MaxNaNCheck_d(f0, f0, f2);
222 } 229 }
223 __ Move(at, f0); 230 __ Move(at, f0);
224 __ Branch(&loop, eq, a4, Operand(at)); 231 __ Branch(&loop, eq, a4, Operand(at));
225 __ mov(a1, a2); 232 __ mov(t1, a2);
226 __ jmp(&loop); 233 __ jmp(&loop);
227 234
228 // At least one side is NaN, which means that the result will be NaN too. 235 // At least one side is NaN, which means that the result will be NaN too.
229 __ bind(&compare_nan); 236 __ bind(&compare_nan);
230 __ LoadRoot(a1, Heap::kNanValueRootIndex); 237 __ LoadRoot(t1, Heap::kNanValueRootIndex);
231 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); 238 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset));
232 __ jmp(&loop); 239 __ jmp(&loop);
233 } 240 }
234 241
235 __ bind(&done_loop); 242 __ bind(&done_loop);
236 __ Dlsa(sp, sp, a3, kPointerSizeLog2); 243 __ Dlsa(sp, sp, a3, kPointerSizeLog2);
237 __ Ret(USE_DELAY_SLOT); 244 __ Ret(USE_DELAY_SLOT);
238 __ mov(v0, a1); // In delay slot. 245 __ mov(v0, t1); // In delay slot.
239 } 246 }
240 247
241 // static 248 // static
242 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { 249 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) {
243 // ----------- S t a t e ------------- 250 // ----------- S t a t e -------------
244 // -- a0 : number of arguments 251 // -- a0 : number of arguments
245 // -- a1 : constructor function 252 // -- a1 : constructor function
246 // -- ra : return address 253 // -- ra : return address
247 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) 254 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based)
248 // -- sp[argc * 8] : receiver 255 // -- sp[argc * 8] : receiver
(...skipping 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 } 2953 }
2947 } 2954 }
2948 2955
2949 2956
2950 #undef __ 2957 #undef __
2951 2958
2952 } // namespace internal 2959 } // namespace internal
2953 } // namespace v8 2960 } // namespace v8
2954 2961
2955 #endif // V8_TARGET_ARCH_MIPS64 2962 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698