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

Side by Side Diff: src/s390/code-stubs-s390.cc

Issue 1825593003: S390: [stubs] Split ToNumberStub into reusable subparts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: PS1 Created 4 years, 9 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 | « no previous file | src/s390/macro-assembler-s390.h » ('j') | src/s390/macro-assembler-s390.cc » ('J')
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/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 StringCharAtGenerator generator(r2, r5, r4, r2, &runtime, &runtime, &runtime, 2705 StringCharAtGenerator generator(r2, r5, r4, r2, &runtime, &runtime, &runtime,
2706 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); 2706 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING);
2707 generator.GenerateFast(masm); 2707 generator.GenerateFast(masm);
2708 __ Drop(3); 2708 __ Drop(3);
2709 __ Ret(); 2709 __ Ret();
2710 generator.SkipSlow(masm, &runtime); 2710 generator.SkipSlow(masm, &runtime);
2711 } 2711 }
2712 2712
2713 void ToNumberStub::Generate(MacroAssembler* masm) { 2713 void ToNumberStub::Generate(MacroAssembler* masm) {
2714 // The ToNumber stub takes one argument in r2. 2714 // The ToNumber stub takes one argument in r2.
2715 Label not_smi; 2715 STATIC_ASSERT(kSmiTag == 0);
2716 __ JumpIfNotSmi(r2, &not_smi); 2716 __ TestIfSmi(r2);
2717 __ b(r14); 2717 __ Ret(eq);
2718 __ bind(&not_smi);
2719 2718
2720 __ CompareObjectType(r2, r3, r3, HEAP_NUMBER_TYPE); 2719 __ CompareObjectType(r2, r3, r3, HEAP_NUMBER_TYPE);
2721 // r2: receiver 2720 // r2: receiver
2722 // r3: receiver instance type 2721 // r3: receiver instance type
2723 Label not_heap_number; 2722 Label not_heap_number;
2724 __ bne(&not_heap_number); 2723 __ bne(&not_heap_number);
2725 __ Ret(); 2724 __ Ret();
2726 __ bind(&not_heap_number); 2725 __ bind(&not_heap_number);
2727 2726
2728 Label not_string, slow_string; 2727 NonNumberToNumberStub stub(masm->isolate());
2729 __ CmpLogicalP(r3, Operand(FIRST_NONSTRING_TYPE)); 2728 __ TailCallStub(&stub);
2730 __ bge(&not_string, Label::kNear); 2729 }
2731 // Check if string has a cached array index. 2730
2732 __ LoadlW(r4, FieldMemOperand(r2, String::kHashFieldOffset)); 2731 void NonNumberToNumberStub::Generate(MacroAssembler* masm) {
2733 __ AndP(r0, r4, Operand(String::kContainsCachedArrayIndexMask)); 2732 // The NonNumberToNumber stub takes one argument in r2.
2734 __ bne(&slow_string, Label::kNear); 2733 __ AssertNotNumber(r2);
2735 __ IndexFromHash(r4, r2); 2734
2736 __ b(r14); 2735 __ CompareObjectType(r2, r3, r3, FIRST_NONSTRING_TYPE);
2737 __ bind(&slow_string); 2736 // r2: receiver
2738 __ push(r2); // Push argument. 2737 // r3: receiver instance type
2739 __ TailCallRuntime(Runtime::kStringToNumber); 2738 StringToNumberStub stub(masm->isolate());
2740 __ bind(&not_string); 2739 __ TailCallStub(&stub, lt);
2741 2740
2742 Label not_oddball; 2741 Label not_oddball;
2743 __ CmpP(r3, Operand(ODDBALL_TYPE)); 2742 __ CmpP(r3, Operand(ODDBALL_TYPE));
2744 __ bne(&not_oddball, Label::kNear); 2743 __ bne(&not_oddball, Label::kNear);
2745 __ LoadP(r2, FieldMemOperand(r2, Oddball::kToNumberOffset)); 2744 __ LoadP(r2, FieldMemOperand(r2, Oddball::kToNumberOffset));
2746 __ b(r14); 2745 __ b(r14);
2747 __ bind(&not_oddball); 2746 __ bind(&not_oddball);
2748 2747
2749 __ push(r2); // Push argument. 2748 __ push(r2); // Push argument.
2750 __ TailCallRuntime(Runtime::kToNumber); 2749 __ TailCallRuntime(Runtime::kToNumber);
2751 } 2750 }
2752 2751
2752 void StringToNumberStub::Generate(MacroAssembler* masm) {
2753 // The StringToNumber stub takes one argument in r2.
2754 __ AssertString(r2);
2755
2756 // Check if string has a cached array index.
2757 Label runtime;
2758 __ LoadlW(r4, FieldMemOperand(r2, String::kHashFieldOffset));
2759 __ And(r0, r4, Operand(String::kContainsCachedArrayIndexMask));
2760 __ bne(&runtime);
2761 __ IndexFromHash(r4, r2);
2762 __ Ret();
2763
2764 __ bind(&runtime);
2765 __ push(r2); // Push argument.
2766 __ TailCallRuntime(Runtime::kStringToNumber);
2767 }
2768
2753 void ToLengthStub::Generate(MacroAssembler* masm) { 2769 void ToLengthStub::Generate(MacroAssembler* masm) {
2754 // The ToLength stub takes one argument in r2. 2770 // The ToLength stub takes one argument in r2.
2755 Label not_smi; 2771 Label not_smi;
2756 __ JumpIfNotSmi(r2, &not_smi); 2772 __ JumpIfNotSmi(r2, &not_smi);
2757 STATIC_ASSERT(kSmiTag == 0); 2773 STATIC_ASSERT(kSmiTag == 0);
2758 __ CmpP(r2, Operand::Zero()); 2774 __ CmpP(r2, Operand::Zero());
2759 Label positive; 2775 Label positive;
2760 __ bgt(&positive); 2776 __ bgt(&positive);
2761 __ LoadImmP(r2, Operand::Zero()); 2777 __ LoadImmP(r2, Operand::Zero());
2762 __ bind(&positive); 2778 __ bind(&positive);
(...skipping 2951 matching lines...) Expand 10 before | Expand all | Expand 10 after
5714 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5730 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5715 kStackUnwindSpace, NULL, return_value_operand, NULL); 5731 kStackUnwindSpace, NULL, return_value_operand, NULL);
5716 } 5732 }
5717 5733
5718 #undef __ 5734 #undef __
5719 5735
5720 } // namespace internal 5736 } // namespace internal
5721 } // namespace v8 5737 } // namespace v8
5722 5738
5723 #endif // V8_TARGET_ARCH_S390 5739 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « no previous file | src/s390/macro-assembler-s390.h » ('j') | src/s390/macro-assembler-s390.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698