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-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 3476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3487 // Convert the object to an integer. | 3487 // Convert the object to an integer. |
3488 Label done_convert; | 3488 Label done_convert; |
3489 __ JumpIfSmi(x0, &done_convert); | 3489 __ JumpIfSmi(x0, &done_convert); |
3490 __ Push(x0); | 3490 __ Push(x0); |
3491 __ CallRuntime(Runtime::kToInteger, 1); | 3491 __ CallRuntime(Runtime::kToInteger, 1); |
3492 __ bind(&done_convert); | 3492 __ bind(&done_convert); |
3493 context()->Plug(x0); | 3493 context()->Plug(x0); |
3494 } | 3494 } |
3495 | 3495 |
3496 | 3496 |
3497 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | |
3498 ZoneList<Expression*>* args = expr->arguments(); | |
3499 DCHECK_EQ(args->length(), 1); | |
3500 | |
3501 // Load the argument into x0 and call the stub. | |
3502 VisitForAccumulatorValue(args->at(0)); | |
3503 | |
3504 NumberToStringStub stub(isolate()); | |
3505 __ CallStub(&stub); | |
3506 context()->Plug(x0); | |
3507 } | |
3508 | |
3509 | |
3510 void FullCodeGenerator::EmitToLength(CallRuntime* expr) { | |
3511 ZoneList<Expression*>* args = expr->arguments(); | |
3512 DCHECK_EQ(1, args->length()); | |
3513 | |
3514 // Load the argument into x0 and convert it. | |
3515 VisitForAccumulatorValue(args->at(0)); | |
3516 | |
3517 ToLengthStub stub(isolate()); | |
3518 __ CallStub(&stub); | |
3519 context()->Plug(x0); | |
3520 } | |
3521 | |
3522 | |
3523 void FullCodeGenerator::EmitToString(CallRuntime* expr) { | |
3524 ZoneList<Expression*>* args = expr->arguments(); | |
3525 DCHECK_EQ(1, args->length()); | |
3526 | |
3527 // Load the argument into x0 and convert it. | |
3528 VisitForAccumulatorValue(args->at(0)); | |
3529 | |
3530 ToStringStub stub(isolate()); | |
3531 __ CallStub(&stub); | |
3532 context()->Plug(x0); | |
3533 } | |
3534 | |
3535 | |
3536 void FullCodeGenerator::EmitToNumber(CallRuntime* expr) { | |
3537 ZoneList<Expression*>* args = expr->arguments(); | |
3538 DCHECK_EQ(1, args->length()); | |
3539 | |
3540 // Load the argument into x0 and convert it. | |
3541 VisitForAccumulatorValue(args->at(0)); | |
3542 | |
3543 ToNumberStub stub(isolate()); | |
3544 __ CallStub(&stub); | |
3545 context()->Plug(x0); | |
3546 } | |
3547 | |
3548 | |
3549 void FullCodeGenerator::EmitToName(CallRuntime* expr) { | 3497 void FullCodeGenerator::EmitToName(CallRuntime* expr) { |
3550 ZoneList<Expression*>* args = expr->arguments(); | 3498 ZoneList<Expression*>* args = expr->arguments(); |
3551 DCHECK_EQ(1, args->length()); | 3499 DCHECK_EQ(1, args->length()); |
3552 | 3500 |
3553 // Load the argument into x0 and convert it. | 3501 // Load the argument into x0 and convert it. |
3554 VisitForAccumulatorValue(args->at(0)); | 3502 VisitForAccumulatorValue(args->at(0)); |
3555 | 3503 |
3556 Label convert, done_convert; | 3504 Label convert, done_convert; |
3557 __ JumpIfSmi(x0, &convert); | 3505 __ JumpIfSmi(x0, &convert); |
3558 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 3506 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
3559 __ JumpIfObjectType(x0, x1, x1, LAST_NAME_TYPE, &done_convert, ls); | 3507 __ JumpIfObjectType(x0, x1, x1, LAST_NAME_TYPE, &done_convert, ls); |
3560 __ Bind(&convert); | 3508 __ Bind(&convert); |
3561 __ Push(x0); | 3509 __ Push(x0); |
3562 __ CallRuntime(Runtime::kToName, 1); | 3510 __ CallRuntime(Runtime::kToName, 1); |
3563 __ Bind(&done_convert); | 3511 __ Bind(&done_convert); |
3564 context()->Plug(x0); | 3512 context()->Plug(x0); |
3565 } | 3513 } |
3566 | 3514 |
3567 | 3515 |
3568 void FullCodeGenerator::EmitToObject(CallRuntime* expr) { | |
3569 ZoneList<Expression*>* args = expr->arguments(); | |
3570 DCHECK_EQ(1, args->length()); | |
3571 | |
3572 // Load the argument into x0 and convert it. | |
3573 VisitForAccumulatorValue(args->at(0)); | |
3574 | |
3575 ToObjectStub stub(isolate()); | |
3576 __ CallStub(&stub); | |
3577 context()->Plug(x0); | |
3578 } | |
3579 | |
3580 | |
3581 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 3516 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
3582 ZoneList<Expression*>* args = expr->arguments(); | 3517 ZoneList<Expression*>* args = expr->arguments(); |
3583 DCHECK(args->length() == 1); | 3518 DCHECK(args->length() == 1); |
3584 | 3519 |
3585 VisitForAccumulatorValue(args->at(0)); | 3520 VisitForAccumulatorValue(args->at(0)); |
3586 | 3521 |
3587 Label done; | 3522 Label done; |
3588 Register code = x0; | 3523 Register code = x0; |
3589 Register result = x1; | 3524 Register result = x1; |
3590 | 3525 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3806 __ Peek(x1, Operand(x0, LSL, kPointerSizeLog2)); | 3741 __ Peek(x1, Operand(x0, LSL, kPointerSizeLog2)); |
3807 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | 3742 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
3808 | 3743 |
3809 // Restore context register. | 3744 // Restore context register. |
3810 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3745 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3811 | 3746 |
3812 context()->DropAndPlug(1, x0); | 3747 context()->DropAndPlug(1, x0); |
3813 } | 3748 } |
3814 | 3749 |
3815 | 3750 |
3816 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | |
3817 RegExpConstructResultStub stub(isolate()); | |
3818 ZoneList<Expression*>* args = expr->arguments(); | |
3819 DCHECK(args->length() == 3); | |
3820 VisitForStackValue(args->at(0)); | |
3821 VisitForStackValue(args->at(1)); | |
3822 VisitForAccumulatorValue(args->at(2)); | |
3823 __ Pop(x1, x2); | |
3824 __ CallStub(&stub); | |
3825 context()->Plug(x0); | |
3826 } | |
3827 | |
3828 | |
3829 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3751 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
3830 ZoneList<Expression*>* args = expr->arguments(); | 3752 ZoneList<Expression*>* args = expr->arguments(); |
3831 VisitForAccumulatorValue(args->at(0)); | 3753 VisitForAccumulatorValue(args->at(0)); |
3832 | 3754 |
3833 Label materialize_true, materialize_false; | 3755 Label materialize_true, materialize_false; |
3834 Label* if_true = NULL; | 3756 Label* if_true = NULL; |
3835 Label* if_false = NULL; | 3757 Label* if_false = NULL; |
3836 Label* fall_through = NULL; | 3758 Label* fall_through = NULL; |
3837 context()->PrepareTest(&materialize_true, &materialize_false, | 3759 context()->PrepareTest(&materialize_true, &materialize_false, |
3838 &if_true, &if_false, &fall_through); | 3760 &if_true, &if_false, &fall_through); |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5289 } | 5211 } |
5290 | 5212 |
5291 return INTERRUPT; | 5213 return INTERRUPT; |
5292 } | 5214 } |
5293 | 5215 |
5294 | 5216 |
5295 } // namespace internal | 5217 } // namespace internal |
5296 } // namespace v8 | 5218 } // namespace v8 |
5297 | 5219 |
5298 #endif // V8_TARGET_ARCH_ARM64 | 5220 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |