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

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

Issue 2052963003: S390: [stubs] ToNumberStub --> ToNumber builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/full-codegen/s390/full-codegen-s390.cc ('k') | src/s390/code-stubs-s390.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_S390 5 #if V8_TARGET_ARCH_S390
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 { 159 {
160 // Check if all parameters done. 160 // Check if all parameters done.
161 __ CmpLogicalP(r4, sp); 161 __ CmpLogicalP(r4, sp);
162 __ ble(&done_loop); 162 __ ble(&done_loop);
163 163
164 // Load the next parameter tagged value into r2. 164 // Load the next parameter tagged value into r2.
165 __ lay(r4, MemOperand(r4, -kPointerSize)); 165 __ lay(r4, MemOperand(r4, -kPointerSize));
166 __ LoadP(r2, MemOperand(r4)); 166 __ LoadP(r2, MemOperand(r4));
167 167
168 // Load the double value of the parameter into d2, maybe converting the 168 // Load the double value of the parameter into d2, maybe converting the
169 // parameter to a number first using the ToNumberStub if necessary. 169 // parameter to a number first using the ToNumber builtin if necessary.
170 Label convert, convert_smi, convert_number, done_convert; 170 Label convert, convert_smi, convert_number, done_convert;
171 __ bind(&convert); 171 __ bind(&convert);
172 __ JumpIfSmi(r2, &convert_smi); 172 __ JumpIfSmi(r2, &convert_smi);
173 __ LoadP(r6, FieldMemOperand(r2, HeapObject::kMapOffset)); 173 __ LoadP(r6, FieldMemOperand(r2, HeapObject::kMapOffset));
174 __ JumpIfRoot(r6, Heap::kHeapNumberMapRootIndex, &convert_number); 174 __ JumpIfRoot(r6, Heap::kHeapNumberMapRootIndex, &convert_number);
175 { 175 {
176 // Parameter is not a Number, use the ToNumberStub to convert it. 176 // Parameter is not a Number, use the ToNumber builtin to convert it.
177 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 177 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
178 __ SmiTag(r5); 178 __ SmiTag(r5);
179 __ Push(r3, r4, r5); 179 __ Push(r3, r4, r5);
180 ToNumberStub stub(masm->isolate()); 180 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
181 __ CallStub(&stub);
182 __ Pop(r3, r4, r5); 181 __ Pop(r3, r4, r5);
183 __ SmiUntag(r5); 182 __ SmiUntag(r5);
184 { 183 {
185 // Restore the double accumulator value (d1). 184 // Restore the double accumulator value (d1).
186 Label done_restore; 185 Label done_restore;
187 __ SmiToDouble(d1, r3); 186 __ SmiToDouble(d1, r3);
188 __ JumpIfSmi(r3, &done_restore); 187 __ JumpIfSmi(r3, &done_restore);
189 __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset)); 188 __ LoadDouble(d1, FieldMemOperand(r3, HeapNumber::kValueOffset));
190 __ bind(&done_restore); 189 __ bind(&done_restore);
191 } 190 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 __ CmpP(r2, Operand::Zero()); 246 __ CmpP(r2, Operand::Zero());
248 __ beq(&no_arguments); 247 __ beq(&no_arguments);
249 __ SubP(r2, r2, Operand(1)); 248 __ SubP(r2, r2, Operand(1));
250 __ ShiftLeftP(r2, r2, Operand(kPointerSizeLog2)); 249 __ ShiftLeftP(r2, r2, Operand(kPointerSizeLog2));
251 __ la(sp, MemOperand(sp, r2)); 250 __ la(sp, MemOperand(sp, r2));
252 __ LoadP(r2, MemOperand(sp)); 251 __ LoadP(r2, MemOperand(sp));
253 __ Drop(2); 252 __ Drop(2);
254 } 253 }
255 254
256 // 2a. Convert the first argument to a number. 255 // 2a. Convert the first argument to a number.
257 ToNumberStub stub(masm->isolate()); 256 __ Jump(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
258 __ TailCallStub(&stub);
259 257
260 // 2b. No arguments, return +0. 258 // 2b. No arguments, return +0.
261 __ bind(&no_arguments); 259 __ bind(&no_arguments);
262 __ LoadSmiLiteral(r2, Smi::FromInt(0)); 260 __ LoadSmiLiteral(r2, Smi::FromInt(0));
263 __ Ret(1); 261 __ Ret(1);
264 } 262 }
265 263
266 // static 264 // static
267 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { 265 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) {
268 // ----------- S t a t e ------------- 266 // ----------- S t a t e -------------
(...skipping 29 matching lines...) Expand all
298 // 3. Make sure r4 is a number. 296 // 3. Make sure r4 is a number.
299 { 297 {
300 Label done_convert; 298 Label done_convert;
301 __ JumpIfSmi(r4, &done_convert); 299 __ JumpIfSmi(r4, &done_convert);
302 __ CompareObjectType(r4, r6, r6, HEAP_NUMBER_TYPE); 300 __ CompareObjectType(r4, r6, r6, HEAP_NUMBER_TYPE);
303 __ beq(&done_convert); 301 __ beq(&done_convert);
304 { 302 {
305 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 303 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
306 __ Push(r3, r5); 304 __ Push(r3, r5);
307 __ LoadRR(r2, r4); 305 __ LoadRR(r2, r4);
308 ToNumberStub stub(masm->isolate()); 306 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
309 __ CallStub(&stub);
310 __ LoadRR(r4, r2); 307 __ LoadRR(r4, r2);
311 __ Pop(r3, r5); 308 __ Pop(r3, r5);
312 } 309 }
313 __ bind(&done_convert); 310 __ bind(&done_convert);
314 } 311 }
315 312
316 // 4. Check if new target and constructor differ. 313 // 4. Check if new target and constructor differ.
317 Label new_object; 314 Label new_object;
318 __ CmpP(r3, r5); 315 __ CmpP(r3, r5);
319 __ bne(&new_object); 316 __ bne(&new_object);
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 __ And(r0, r4, Operand(String::kContainsCachedArrayIndexMask)); 2725 __ And(r0, r4, Operand(String::kContainsCachedArrayIndexMask));
2729 __ bne(&runtime); 2726 __ bne(&runtime);
2730 __ IndexFromHash(r4, r2); 2727 __ IndexFromHash(r4, r2);
2731 __ Ret(); 2728 __ Ret();
2732 2729
2733 __ bind(&runtime); 2730 __ bind(&runtime);
2734 __ push(r2); // Push argument. 2731 __ push(r2); // Push argument.
2735 __ TailCallRuntime(Runtime::kStringToNumber); 2732 __ TailCallRuntime(Runtime::kStringToNumber);
2736 } 2733 }
2737 2734
2735 // static
2736 void Builtins::Generate_ToNumber(MacroAssembler* masm) {
2737 // The ToNumber stub takes one argument in r2.
2738 STATIC_ASSERT(kSmiTag == 0);
2739 __ TestIfSmi(r2);
2740 __ Ret(eq);
2741
2742 __ CompareObjectType(r2, r3, r3, HEAP_NUMBER_TYPE);
2743 // r2: receiver
2744 // r3: receiver instance type
2745 __ Ret(eq);
2746
2747 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(),
2748 RelocInfo::CODE_TARGET);
2749 }
2750
2751 // static
2752 void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) {
2753 // The NonNumberToNumber stub takes one argument in r2.
2754 __ AssertNotNumber(r2);
2755
2756 __ CompareObjectType(r2, r3, r3, FIRST_NONSTRING_TYPE);
2757 // r2: receiver
2758 // r3: receiver instance type
2759 __ Jump(masm->isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET,
2760 lt);
2761
2762 Label not_oddball;
2763 __ CmpP(r3, Operand(ODDBALL_TYPE));
2764 __ bne(&not_oddball);
2765 __ LoadP(r2, FieldMemOperand(r2, Oddball::kToNumberOffset));
2766 __ Ret();
2767 __ bind(&not_oddball);
2768
2769 __ push(r2); // Push argument.
2770 __ TailCallRuntime(Runtime::kToNumber);
2771 }
2772
2738 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 2773 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
2739 // ----------- S t a t e ------------- 2774 // ----------- S t a t e -------------
2740 // -- r2 : actual number of arguments 2775 // -- r2 : actual number of arguments
2741 // -- r3 : function (passed through to callee) 2776 // -- r3 : function (passed through to callee)
2742 // -- r4 : expected number of arguments 2777 // -- r4 : expected number of arguments
2743 // -- r5 : new target (passed through to callee) 2778 // -- r5 : new target (passed through to callee)
2744 // ----------------------------------- 2779 // -----------------------------------
2745 2780
2746 Label invoke, dont_adapt_arguments, stack_overflow; 2781 Label invoke, dont_adapt_arguments, stack_overflow;
2747 2782
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2865 __ bkpt(0); 2900 __ bkpt(0);
2866 } 2901 }
2867 } 2902 }
2868 2903
2869 #undef __ 2904 #undef __
2870 2905
2871 } // namespace internal 2906 } // namespace internal
2872 } // namespace v8 2907 } // namespace v8
2873 2908
2874 #endif // V8_TARGET_ARCH_S390 2909 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/full-codegen/s390/full-codegen-s390.cc ('k') | src/s390/code-stubs-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698