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

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

Issue 1902373002: [builtins] Introduce a proper BUILTIN frame type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
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(a3, a3, Operand(1));
166 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); 168 __ Branch(&done_loop, lt, a3, 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, a3, 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 ToNumberStub if necessary. 175 // parameter to a number first using the ToNumberStub 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 ToNumberStub to convert it. 182 // Parameter is not a Number, use the ToNumberStub 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 ToNumberStub stub(masm->isolate()); 191 ToNumberStub stub(masm->isolate());
187 __ CallStub(&stub); 192 __ CallStub(&stub);
188 __ mov(a2, v0); 193 __ mov(a2, v0);
189 __ Pop(a0, a1, a3); 194 __ Pop(a0, t1, 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(t1, &restore_smi);
194 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); 199 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset));
195 __ jmp(&done_restore); 200 __ jmp(&done_restore);
196 __ bind(&restore_smi); 201 __ bind(&restore_smi);
197 __ SmiToDoubleFPURegister(a1, f0, a4); 202 __ SmiToDoubleFPURegister(t1, f0, a4);
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, a4); 215 __ SmiToDoubleFPURegister(a2, f2, a4);
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; 222 Label compare_nan;
216 __ BranchF(nullptr, &compare_nan, eq, f0, f2); 223 __ BranchF(nullptr, &compare_nan, eq, f0, f2);
217 __ Move(a4, f0); 224 __ Move(a4, 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, f0); 231 __ Move(at, f0);
225 __ Branch(&loop, eq, a4, Operand(at)); 232 __ Branch(&loop, eq, a4, Operand(at));
226 __ mov(a1, a2); 233 __ mov(t1, a2);
227 __ jmp(&loop); 234 __ jmp(&loop);
228 235
229 // At least one side is NaN, which means that the result will be NaN too. 236 // At least one side is NaN, which means that the result will be NaN too.
230 __ bind(&compare_nan); 237 __ bind(&compare_nan);
231 __ LoadRoot(a1, Heap::kNanValueRootIndex); 238 __ LoadRoot(t1, Heap::kNanValueRootIndex);
232 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); 239 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset));
233 __ jmp(&loop); 240 __ jmp(&loop);
234 } 241 }
235 242
236 __ bind(&done_loop); 243 __ bind(&done_loop);
237 __ Dlsa(sp, sp, a3, kPointerSizeLog2); 244 __ Dlsa(sp, sp, a3, kPointerSizeLog2);
245 __ Dsubu(sp, sp, kPointerSize);
238 __ Ret(USE_DELAY_SLOT); 246 __ Ret(USE_DELAY_SLOT);
239 __ mov(v0, a1); // In delay slot. 247 __ mov(v0, t1); // In delay slot.
240 } 248 }
241 249
242 // static 250 // static
243 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { 251 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) {
244 // ----------- S t a t e ------------- 252 // ----------- S t a t e -------------
245 // -- a0 : number of arguments 253 // -- a0 : number of arguments
246 // -- a1 : constructor function 254 // -- a1 : constructor function
247 // -- ra : return address 255 // -- ra : return address
248 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) 256 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based)
249 // -- sp[argc * 8] : receiver 257 // -- sp[argc * 8] : receiver
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after
2847 } 2855 }
2848 } 2856 }
2849 2857
2850 2858
2851 #undef __ 2859 #undef __
2852 2860
2853 } // namespace internal 2861 } // namespace internal
2854 } // namespace v8 2862 } // namespace v8
2855 2863
2856 #endif // V8_TARGET_ARCH_MIPS64 2864 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« src/frames.cc ('K') | « 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