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

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

Issue 2050853003: [stubs] StringToNumberStub --> StringToNumber 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/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 3123
3124 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { 3124 void NonNumberToNumberStub::Generate(MacroAssembler* masm) {
3125 // The NonNumberToNumber stub takes one argument in x0. 3125 // The NonNumberToNumber stub takes one argument in x0.
3126 __ AssertNotNumber(x0); 3126 __ AssertNotNumber(x0);
3127 3127
3128 Label not_string; 3128 Label not_string;
3129 __ CompareObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE); 3129 __ CompareObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE);
3130 // x0: receiver 3130 // x0: receiver
3131 // x1: receiver instance type 3131 // x1: receiver instance type
3132 __ B(hs, &not_string); 3132 __ B(hs, &not_string);
3133 StringToNumberStub stub(masm->isolate()); 3133 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET);
3134 __ TailCallStub(&stub);
3135 __ Bind(&not_string); 3134 __ Bind(&not_string);
3136 3135
3137 Label not_oddball; 3136 Label not_oddball;
3138 __ Cmp(x1, ODDBALL_TYPE); 3137 __ Cmp(x1, ODDBALL_TYPE);
3139 __ B(ne, &not_oddball); 3138 __ B(ne, &not_oddball);
3140 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset)); 3139 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset));
3141 __ Ret(); 3140 __ Ret();
3142 __ Bind(&not_oddball); 3141 __ Bind(&not_oddball);
3143 3142
3144 __ Push(x0); // Push argument. 3143 __ Push(x0); // Push argument.
3145 __ TailCallRuntime(Runtime::kToNumber); 3144 __ TailCallRuntime(Runtime::kToNumber);
3146 } 3145 }
3147 3146
3148 void StringToNumberStub::Generate(MacroAssembler* masm) {
3149 // The StringToNumber stub takes one argument in x0.
3150 __ AssertString(x0);
3151
3152 // Check if string has a cached array index.
3153 Label runtime;
3154 __ Ldr(x2, FieldMemOperand(x0, String::kHashFieldOffset));
3155 __ Tst(x2, Operand(String::kContainsCachedArrayIndexMask));
3156 __ B(ne, &runtime);
3157 __ IndexFromHash(x2, x0);
3158 __ Ret();
3159
3160 __ Bind(&runtime);
3161 __ Push(x0); // Push argument.
3162 __ TailCallRuntime(Runtime::kStringToNumber);
3163 }
3164
3165 void ToStringStub::Generate(MacroAssembler* masm) { 3147 void ToStringStub::Generate(MacroAssembler* masm) {
3166 // The ToString stub takes one argument in x0. 3148 // The ToString stub takes one argument in x0.
3167 Label is_number; 3149 Label is_number;
3168 __ JumpIfSmi(x0, &is_number); 3150 __ JumpIfSmi(x0, &is_number);
3169 3151
3170 Label not_string; 3152 Label not_string;
3171 __ JumpIfObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE, &not_string, hs); 3153 __ JumpIfObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE, &not_string, hs);
3172 // x0: receiver 3154 // x0: receiver
3173 // x1: receiver instance type 3155 // x1: receiver instance type
3174 __ Ret(); 3156 __ Ret();
(...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after
5840 kStackUnwindSpace, NULL, spill_offset, 5822 kStackUnwindSpace, NULL, spill_offset,
5841 return_value_operand, NULL); 5823 return_value_operand, NULL);
5842 } 5824 }
5843 5825
5844 #undef __ 5826 #undef __
5845 5827
5846 } // namespace internal 5828 } // namespace internal
5847 } // namespace v8 5829 } // namespace v8
5848 5830
5849 #endif // V8_TARGET_ARCH_ARM64 5831 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698