OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2516 __ TailCallStub(&stub); | 2516 __ TailCallStub(&stub); |
2517 } | 2517 } |
2518 | 2518 |
2519 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { | 2519 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { |
2520 // The NonNumberToNumber stub takes one argument in r0. | 2520 // The NonNumberToNumber stub takes one argument in r0. |
2521 __ AssertNotNumber(r0); | 2521 __ AssertNotNumber(r0); |
2522 | 2522 |
2523 __ CompareObjectType(r0, r1, r1, FIRST_NONSTRING_TYPE); | 2523 __ CompareObjectType(r0, r1, r1, FIRST_NONSTRING_TYPE); |
2524 // r0: receiver | 2524 // r0: receiver |
2525 // r1: receiver instance type | 2525 // r1: receiver instance type |
2526 StringToNumberStub stub(masm->isolate()); | 2526 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET, lo); |
2527 __ TailCallStub(&stub, lo); | |
2528 | 2527 |
2529 Label not_oddball; | 2528 Label not_oddball; |
2530 __ cmp(r1, Operand(ODDBALL_TYPE)); | 2529 __ cmp(r1, Operand(ODDBALL_TYPE)); |
2531 __ b(ne, ¬_oddball); | 2530 __ b(ne, ¬_oddball); |
2532 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); | 2531 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); |
2533 __ Ret(); | 2532 __ Ret(); |
2534 __ bind(¬_oddball); | 2533 __ bind(¬_oddball); |
2535 | 2534 |
2536 __ Push(r0); // Push argument. | 2535 __ Push(r0); // Push argument. |
2537 __ TailCallRuntime(Runtime::kToNumber); | 2536 __ TailCallRuntime(Runtime::kToNumber); |
2538 } | 2537 } |
2539 | 2538 |
2540 void StringToNumberStub::Generate(MacroAssembler* masm) { | |
2541 // The StringToNumber stub takes one argument in r0. | |
2542 __ AssertString(r0); | |
2543 | |
2544 // Check if string has a cached array index. | |
2545 Label runtime; | |
2546 __ ldr(r2, FieldMemOperand(r0, String::kHashFieldOffset)); | |
2547 __ tst(r2, Operand(String::kContainsCachedArrayIndexMask)); | |
2548 __ b(ne, &runtime); | |
2549 __ IndexFromHash(r2, r0); | |
2550 __ Ret(); | |
2551 | |
2552 __ bind(&runtime); | |
2553 __ Push(r0); // Push argument. | |
2554 __ TailCallRuntime(Runtime::kStringToNumber); | |
2555 } | |
2556 | |
2557 void ToStringStub::Generate(MacroAssembler* masm) { | 2539 void ToStringStub::Generate(MacroAssembler* masm) { |
2558 // The ToString stub takes one argument in r0. | 2540 // The ToString stub takes one argument in r0. |
2559 Label is_number; | 2541 Label is_number; |
2560 __ JumpIfSmi(r0, &is_number); | 2542 __ JumpIfSmi(r0, &is_number); |
2561 | 2543 |
2562 __ CompareObjectType(r0, r1, r1, FIRST_NONSTRING_TYPE); | 2544 __ CompareObjectType(r0, r1, r1, FIRST_NONSTRING_TYPE); |
2563 // r0: receiver | 2545 // r0: receiver |
2564 // r1: receiver instance type | 2546 // r1: receiver instance type |
2565 __ Ret(lo); | 2547 __ Ret(lo); |
2566 | 2548 |
(...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5444 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5426 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5445 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5427 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5446 } | 5428 } |
5447 | 5429 |
5448 #undef __ | 5430 #undef __ |
5449 | 5431 |
5450 } // namespace internal | 5432 } // namespace internal |
5451 } // namespace v8 | 5433 } // namespace v8 |
5452 | 5434 |
5453 #endif // V8_TARGET_ARCH_ARM | 5435 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |