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

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

Issue 2051113002: [stubs] ToNumberStub --> ToNumber builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix full-code on non-x64 platforms 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/mips64/code-stubs-mips64.cc ('k') | src/ppc/code-stubs-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 __ bind(&loop); 165 __ bind(&loop);
166 { 166 {
167 // Check if all parameters done. 167 // Check if all parameters done.
168 __ cmpl(r5, sp); 168 __ cmpl(r5, sp);
169 __ ble(&done_loop); 169 __ ble(&done_loop);
170 170
171 // Load the next parameter tagged value into r3. 171 // Load the next parameter tagged value into r3.
172 __ LoadPU(r3, MemOperand(r5, -kPointerSize)); 172 __ LoadPU(r3, MemOperand(r5, -kPointerSize));
173 173
174 // Load the double value of the parameter into d2, maybe converting the 174 // Load the double value of the parameter into d2, maybe converting the
175 // parameter to a number first using the ToNumberStub if necessary. 175 // parameter to a number first using the ToNumber builtin if necessary.
176 Label convert, convert_smi, convert_number, done_convert; 176 Label convert, convert_smi, convert_number, done_convert;
177 __ bind(&convert); 177 __ bind(&convert);
178 __ JumpIfSmi(r3, &convert_smi); 178 __ JumpIfSmi(r3, &convert_smi);
179 __ LoadP(r7, FieldMemOperand(r3, HeapObject::kMapOffset)); 179 __ LoadP(r7, FieldMemOperand(r3, HeapObject::kMapOffset));
180 __ JumpIfRoot(r7, Heap::kHeapNumberMapRootIndex, &convert_number); 180 __ JumpIfRoot(r7, Heap::kHeapNumberMapRootIndex, &convert_number);
181 { 181 {
182 // Parameter is not a Number, use the ToNumberStub to convert it. 182 // Parameter is not a Number, use the ToNumber builtin to convert it.
183 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 183 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
184 __ SmiTag(r6); 184 __ SmiTag(r6);
185 __ Push(r4, r5, r6); 185 __ Push(r4, r5, r6);
186 ToNumberStub stub(masm->isolate()); 186 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
187 __ CallStub(&stub);
188 __ Pop(r4, r5, r6); 187 __ Pop(r4, r5, r6);
189 __ SmiUntag(r6); 188 __ SmiUntag(r6);
190 { 189 {
191 // Restore the double accumulator value (d1). 190 // Restore the double accumulator value (d1).
192 Label done_restore; 191 Label done_restore;
193 __ SmiToDouble(d1, r4); 192 __ SmiToDouble(d1, r4);
194 __ JumpIfSmi(r4, &done_restore); 193 __ JumpIfSmi(r4, &done_restore);
195 __ lfd(d1, FieldMemOperand(r4, HeapNumber::kValueOffset)); 194 __ lfd(d1, FieldMemOperand(r4, HeapNumber::kValueOffset));
196 __ bind(&done_restore); 195 __ bind(&done_restore);
197 } 196 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 { 251 {
253 __ cmpi(r3, Operand::Zero()); 252 __ cmpi(r3, Operand::Zero());
254 __ beq(&no_arguments); 253 __ beq(&no_arguments);
255 __ subi(r3, r3, Operand(1)); 254 __ subi(r3, r3, Operand(1));
256 __ ShiftLeftImm(r3, r3, Operand(kPointerSizeLog2)); 255 __ ShiftLeftImm(r3, r3, Operand(kPointerSizeLog2));
257 __ LoadPUX(r3, MemOperand(sp, r3)); 256 __ LoadPUX(r3, MemOperand(sp, r3));
258 __ Drop(2); 257 __ Drop(2);
259 } 258 }
260 259
261 // 2a. Convert the first argument to a number. 260 // 2a. Convert the first argument to a number.
262 ToNumberStub stub(masm->isolate()); 261 __ Jump(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
263 __ TailCallStub(&stub);
264 262
265 // 2b. No arguments, return +0. 263 // 2b. No arguments, return +0.
266 __ bind(&no_arguments); 264 __ bind(&no_arguments);
267 __ LoadSmiLiteral(r3, Smi::FromInt(0)); 265 __ LoadSmiLiteral(r3, Smi::FromInt(0));
268 __ Ret(1); 266 __ Ret(1);
269 } 267 }
270 268
271 269
272 // static 270 // static
273 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { 271 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) {
(...skipping 29 matching lines...) Expand all
303 // 3. Make sure r5 is a number. 301 // 3. Make sure r5 is a number.
304 { 302 {
305 Label done_convert; 303 Label done_convert;
306 __ JumpIfSmi(r5, &done_convert); 304 __ JumpIfSmi(r5, &done_convert);
307 __ CompareObjectType(r5, r7, r7, HEAP_NUMBER_TYPE); 305 __ CompareObjectType(r5, r7, r7, HEAP_NUMBER_TYPE);
308 __ beq(&done_convert); 306 __ beq(&done_convert);
309 { 307 {
310 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 308 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
311 __ Push(r4, r6); 309 __ Push(r4, r6);
312 __ mr(r3, r5); 310 __ mr(r3, r5);
313 ToNumberStub stub(masm->isolate()); 311 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
314 __ CallStub(&stub);
315 __ mr(r5, r3); 312 __ mr(r5, r3);
316 __ Pop(r4, r6); 313 __ Pop(r4, r6);
317 } 314 }
318 __ bind(&done_convert); 315 __ bind(&done_convert);
319 } 316 }
320 317
321 // 4. Check if new target and constructor differ. 318 // 4. Check if new target and constructor differ.
322 Label new_object; 319 Label new_object;
323 __ cmp(r4, r6); 320 __ cmp(r4, r6);
324 __ bne(&new_object); 321 __ bne(&new_object);
(...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC); 2758 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC);
2762 __ bne(&runtime, cr0); 2759 __ bne(&runtime, cr0);
2763 __ IndexFromHash(r5, r3); 2760 __ IndexFromHash(r5, r3);
2764 __ blr(); 2761 __ blr();
2765 2762
2766 __ bind(&runtime); 2763 __ bind(&runtime);
2767 __ push(r3); // Push argument. 2764 __ push(r3); // Push argument.
2768 __ TailCallRuntime(Runtime::kStringToNumber); 2765 __ TailCallRuntime(Runtime::kStringToNumber);
2769 } 2766 }
2770 2767
2768 // static
2769 void Builtins::Generate_ToNumber(MacroAssembler* masm) {
2770 // The ToNumber stub takes one argument in r3.
2771 STATIC_ASSERT(kSmiTag == 0);
2772 __ TestIfSmi(r3, r0);
2773 __ Ret(eq, cr0);
2774
2775 __ CompareObjectType(r3, r4, r4, HEAP_NUMBER_TYPE);
2776 // r3: receiver
2777 // r4: receiver instance type
2778 __ Ret(eq);
2779
2780 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(),
2781 RelocInfo::CODE_TARGET);
2782 }
2783
2784 // static
2785 void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) {
2786 // The NonNumberToNumber stub takes one argument in r3.
2787 __ AssertNotNumber(r3);
2788
2789 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE);
2790 // r3: receiver
2791 // r4: receiver instance type
2792 __ Jump(masm->isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET,
2793 lt);
2794
2795 Label not_oddball;
2796 __ cmpi(r4, Operand(ODDBALL_TYPE));
2797 __ bne(&not_oddball);
2798 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset));
2799 __ blr();
2800 __ bind(&not_oddball);
2801
2802 __ push(r3); // Push argument.
2803 __ TailCallRuntime(Runtime::kToNumber);
2804 }
2805
2771 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 2806 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
2772 // ----------- S t a t e ------------- 2807 // ----------- S t a t e -------------
2773 // -- r3 : actual number of arguments 2808 // -- r3 : actual number of arguments
2774 // -- r4 : function (passed through to callee) 2809 // -- r4 : function (passed through to callee)
2775 // -- r5 : expected number of arguments 2810 // -- r5 : expected number of arguments
2776 // -- r6 : new target (passed through to callee) 2811 // -- r6 : new target (passed through to callee)
2777 // ----------------------------------- 2812 // -----------------------------------
2778 2813
2779 Label invoke, dont_adapt_arguments, stack_overflow; 2814 Label invoke, dont_adapt_arguments, stack_overflow;
2780 2815
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2900 __ bkpt(0); 2935 __ bkpt(0);
2901 } 2936 }
2902 } 2937 }
2903 2938
2904 2939
2905 #undef __ 2940 #undef __
2906 } // namespace internal 2941 } // namespace internal
2907 } // namespace v8 2942 } // namespace v8
2908 2943
2909 #endif // V8_TARGET_ARCH_PPC 2944 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698