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

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

Powered by Google App Engine
This is Rietveld 408576698