OLD | NEW |
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 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3255 | 3255 |
3256 | 3256 |
3257 void ToNumberStub::Generate(MacroAssembler* masm) { | 3257 void ToNumberStub::Generate(MacroAssembler* masm) { |
3258 // The ToNumber stub takes one argument in x0. | 3258 // The ToNumber stub takes one argument in x0. |
3259 Label not_smi; | 3259 Label not_smi; |
3260 __ JumpIfNotSmi(x0, ¬_smi); | 3260 __ JumpIfNotSmi(x0, ¬_smi); |
3261 __ Ret(); | 3261 __ Ret(); |
3262 __ Bind(¬_smi); | 3262 __ Bind(¬_smi); |
3263 | 3263 |
3264 Label not_heap_number; | 3264 Label not_heap_number; |
3265 __ Ldr(x1, FieldMemOperand(x0, HeapObject::kMapOffset)); | 3265 __ CompareObjectType(x0, x1, x1, HEAP_NUMBER_TYPE); |
3266 __ Ldrb(x1, FieldMemOperand(x1, Map::kInstanceTypeOffset)); | 3266 // x0: receiver |
3267 // x0: object | 3267 // x1: receiver instance type |
3268 // x1: instance type | |
3269 __ Cmp(x1, HEAP_NUMBER_TYPE); | |
3270 __ B(ne, ¬_heap_number); | 3268 __ B(ne, ¬_heap_number); |
3271 __ Ret(); | 3269 __ Ret(); |
3272 __ Bind(¬_heap_number); | 3270 __ Bind(¬_heap_number); |
3273 | 3271 |
3274 Label not_string, slow_string; | 3272 NonNumberToNumberStub stub(masm->isolate()); |
3275 __ Cmp(x1, FIRST_NONSTRING_TYPE); | 3273 __ TailCallStub(&stub); |
| 3274 } |
| 3275 |
| 3276 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { |
| 3277 // The NonNumberToNumber stub takes one argument in x0. |
| 3278 __ AssertNotNumber(x0); |
| 3279 |
| 3280 Label not_string; |
| 3281 __ CompareObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE); |
| 3282 // x0: receiver |
| 3283 // x1: receiver instance type |
3276 __ B(hs, ¬_string); | 3284 __ B(hs, ¬_string); |
3277 // Check if string has a cached array index. | 3285 StringToNumberStub stub(masm->isolate()); |
3278 __ Ldr(x2, FieldMemOperand(x0, String::kHashFieldOffset)); | 3286 __ TailCallStub(&stub); |
3279 __ Tst(x2, Operand(String::kContainsCachedArrayIndexMask)); | |
3280 __ B(ne, &slow_string); | |
3281 __ IndexFromHash(x2, x0); | |
3282 __ Ret(); | |
3283 __ Bind(&slow_string); | |
3284 __ Push(x0); // Push argument. | |
3285 __ TailCallRuntime(Runtime::kStringToNumber); | |
3286 __ Bind(¬_string); | 3287 __ Bind(¬_string); |
3287 | 3288 |
3288 Label not_oddball; | 3289 Label not_oddball; |
3289 __ Cmp(x1, ODDBALL_TYPE); | 3290 __ Cmp(x1, ODDBALL_TYPE); |
3290 __ B(ne, ¬_oddball); | 3291 __ B(ne, ¬_oddball); |
3291 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset)); | 3292 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset)); |
3292 __ Ret(); | 3293 __ Ret(); |
3293 __ Bind(¬_oddball); | 3294 __ Bind(¬_oddball); |
3294 | 3295 |
3295 __ Push(x0); // Push argument. | 3296 __ Push(x0); // Push argument. |
3296 __ TailCallRuntime(Runtime::kToNumber); | 3297 __ TailCallRuntime(Runtime::kToNumber); |
3297 } | 3298 } |
3298 | 3299 |
| 3300 void StringToNumberStub::Generate(MacroAssembler* masm) { |
| 3301 // The StringToNumber stub takes one argument in x0. |
| 3302 __ AssertString(x0); |
| 3303 |
| 3304 // Check if string has a cached array index. |
| 3305 Label runtime; |
| 3306 __ Ldr(x2, FieldMemOperand(x0, String::kHashFieldOffset)); |
| 3307 __ Tst(x2, Operand(String::kContainsCachedArrayIndexMask)); |
| 3308 __ B(ne, &runtime); |
| 3309 __ IndexFromHash(x2, x0); |
| 3310 __ Ret(); |
| 3311 |
| 3312 __ Bind(&runtime); |
| 3313 __ Push(x0); // Push argument. |
| 3314 __ TailCallRuntime(Runtime::kStringToNumber); |
| 3315 } |
3299 | 3316 |
3300 void ToLengthStub::Generate(MacroAssembler* masm) { | 3317 void ToLengthStub::Generate(MacroAssembler* masm) { |
3301 // The ToLength stub takes one argument in x0. | 3318 // The ToLength stub takes one argument in x0. |
3302 Label not_smi; | 3319 Label not_smi; |
3303 __ JumpIfNotSmi(x0, ¬_smi); | 3320 __ JumpIfNotSmi(x0, ¬_smi); |
3304 STATIC_ASSERT(kSmiTag == 0); | 3321 STATIC_ASSERT(kSmiTag == 0); |
3305 __ Tst(x0, x0); | 3322 __ Tst(x0, x0); |
3306 __ Csel(x0, x0, Operand(0), ge); | 3323 __ Csel(x0, x0, Operand(0), ge); |
3307 __ Ret(); | 3324 __ Ret(); |
3308 __ Bind(¬_smi); | 3325 __ Bind(¬_smi); |
(...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5952 return_value_operand, NULL); | 5969 return_value_operand, NULL); |
5953 } | 5970 } |
5954 | 5971 |
5955 | 5972 |
5956 #undef __ | 5973 #undef __ |
5957 | 5974 |
5958 } // namespace internal | 5975 } // namespace internal |
5959 } // namespace v8 | 5976 } // namespace v8 |
5960 | 5977 |
5961 #endif // V8_TARGET_ARCH_ARM64 | 5978 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |