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/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 3767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 VisitForAccumulatorValue(args->at(1)); | 3778 VisitForAccumulatorValue(args->at(1)); |
3779 | 3779 |
3780 __ Pop(x1); | 3780 __ Pop(x1); |
3781 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); | 3781 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); |
3782 __ CallStub(&stub); | 3782 __ CallStub(&stub); |
3783 | 3783 |
3784 context()->Plug(x0); | 3784 context()->Plug(x0); |
3785 } | 3785 } |
3786 | 3786 |
3787 | 3787 |
| 3788 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 3789 ASM_LOCATION("FullCodeGenerator::EmitCallFunction"); |
| 3790 ZoneList<Expression*>* args = expr->arguments(); |
| 3791 DCHECK_LE(2, args->length()); |
| 3792 // Push target, receiver and arguments onto the stack. |
| 3793 for (Expression* const arg : *args) { |
| 3794 VisitForStackValue(arg); |
| 3795 } |
| 3796 // Move target to x1. |
| 3797 int const argc = args->length() - 2; |
| 3798 __ Peek(x1, (argc + 1) * kXRegSize); |
| 3799 // Call the target. |
| 3800 __ Mov(x0, argc); |
| 3801 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 3802 // Restore context register. |
| 3803 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3804 // Discard the function left on TOS. |
| 3805 context()->DropAndPlug(1, x0); |
| 3806 } |
| 3807 |
| 3808 |
3788 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3809 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3789 ASM_LOCATION("FullCodeGenerator::EmitCallFunction"); | 3810 ASM_LOCATION("FullCodeGenerator::EmitCallFunction"); |
3790 ZoneList<Expression*>* args = expr->arguments(); | 3811 ZoneList<Expression*>* args = expr->arguments(); |
3791 DCHECK(args->length() >= 2); | 3812 DCHECK(args->length() >= 2); |
3792 | 3813 |
3793 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3814 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3794 for (int i = 0; i < arg_count + 1; i++) { | 3815 for (int i = 0; i < arg_count + 1; i++) { |
3795 VisitForStackValue(args->at(i)); | 3816 VisitForStackValue(args->at(i)); |
3796 } | 3817 } |
3797 VisitForAccumulatorValue(args->last()); // Function. | 3818 VisitForAccumulatorValue(args->last()); // Function. |
3798 | 3819 |
3799 Label runtime, done; | 3820 Label runtime, done; |
3800 // Check for non-function argument (including proxy). | 3821 // Check for non-function argument (including proxy). |
3801 __ JumpIfSmi(x0, &runtime); | 3822 __ JumpIfSmi(x0, &runtime); |
3802 __ JumpIfNotObjectType(x0, x1, x1, JS_FUNCTION_TYPE, &runtime); | 3823 __ JumpIfNotObjectType(x0, x1, x1, JS_FUNCTION_TYPE, &runtime); |
3803 | 3824 |
3804 // InvokeFunction requires the function in x1. Move it in there. | 3825 // InvokeFunction requires the function in x1. Move it in there. |
3805 __ Mov(x1, x0); | 3826 __ Mov(x1, x0); |
3806 ParameterCount count(arg_count); | 3827 ParameterCount count(arg_count); |
3807 __ InvokeFunction(x1, count, CALL_FUNCTION, NullCallWrapper()); | 3828 __ InvokeFunction(x1, count, CALL_FUNCTION, NullCallWrapper()); |
3808 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3829 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3809 __ B(&done); | 3830 __ B(&done); |
3810 | 3831 |
3811 __ Bind(&runtime); | 3832 __ Bind(&runtime); |
3812 __ Push(x0); | 3833 __ Push(x0); |
3813 __ CallRuntime(Runtime::kCall, args->length()); | 3834 __ CallRuntime(Runtime::kCallFunction, args->length()); |
3814 __ Bind(&done); | 3835 __ Bind(&done); |
3815 | 3836 |
3816 context()->Plug(x0); | 3837 context()->Plug(x0); |
3817 } | 3838 } |
3818 | 3839 |
3819 | 3840 |
3820 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3841 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3821 ZoneList<Expression*>* args = expr->arguments(); | 3842 ZoneList<Expression*>* args = expr->arguments(); |
3822 DCHECK(args->length() == 2); | 3843 DCHECK(args->length() == 2); |
3823 | 3844 |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5348 } | 5369 } |
5349 | 5370 |
5350 return INTERRUPT; | 5371 return INTERRUPT; |
5351 } | 5372 } |
5352 | 5373 |
5353 | 5374 |
5354 } // namespace internal | 5375 } // namespace internal |
5355 } // namespace v8 | 5376 } // namespace v8 |
5356 | 5377 |
5357 #endif // V8_TARGET_ARCH_ARM64 | 5378 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |