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 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 | 2653 |
2654 | 2654 |
2655 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2655 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
2656 // Load the arguments. | 2656 // Load the arguments. |
2657 ZoneList<Expression*>* args = expr->arguments(); | 2657 ZoneList<Expression*>* args = expr->arguments(); |
2658 int arg_count = args->length(); | 2658 int arg_count = args->length(); |
2659 for (int i = 0; i < arg_count; i++) { | 2659 for (int i = 0; i < arg_count; i++) { |
2660 VisitForStackValue(args->at(i)); | 2660 VisitForStackValue(args->at(i)); |
2661 } | 2661 } |
2662 | 2662 |
| 2663 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
2663 SetCallPosition(expr, arg_count); | 2664 SetCallPosition(expr, arg_count); |
2664 | 2665 |
2665 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2666 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
2666 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); | 2667 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); |
2667 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2668 __ Peek(x1, (arg_count + 1) * kXRegSize); |
2668 // Don't assign a type feedback id to the IC, since type feedback is provided | 2669 // Don't assign a type feedback id to the IC, since type feedback is provided |
2669 // by the vector above. | 2670 // by the vector above. |
2670 CallIC(ic); | 2671 CallIC(ic); |
2671 | 2672 |
2672 RecordJSReturnSite(expr); | 2673 RecordJSReturnSite(expr); |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3606 | 3607 |
3607 | 3608 |
3608 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3609 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
3609 ASM_LOCATION("FullCodeGenerator::EmitCallFunction"); | 3610 ASM_LOCATION("FullCodeGenerator::EmitCallFunction"); |
3610 ZoneList<Expression*>* args = expr->arguments(); | 3611 ZoneList<Expression*>* args = expr->arguments(); |
3611 DCHECK_LE(2, args->length()); | 3612 DCHECK_LE(2, args->length()); |
3612 // Push target, receiver and arguments onto the stack. | 3613 // Push target, receiver and arguments onto the stack. |
3613 for (Expression* const arg : *args) { | 3614 for (Expression* const arg : *args) { |
3614 VisitForStackValue(arg); | 3615 VisitForStackValue(arg); |
3615 } | 3616 } |
| 3617 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
3616 // Move target to x1. | 3618 // Move target to x1. |
3617 int const argc = args->length() - 2; | 3619 int const argc = args->length() - 2; |
3618 __ Peek(x1, (argc + 1) * kXRegSize); | 3620 __ Peek(x1, (argc + 1) * kXRegSize); |
3619 // Call the target. | 3621 // Call the target. |
3620 __ Mov(x0, argc); | 3622 __ Mov(x0, argc); |
3621 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3623 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3622 // Restore context register. | 3624 // Restore context register. |
3623 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3625 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3624 // Discard the function left on TOS. | 3626 // Discard the function left on TOS. |
3625 context()->DropAndPlug(1, x0); | 3627 context()->DropAndPlug(1, x0); |
3626 } | 3628 } |
3627 | 3629 |
3628 | 3630 |
3629 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3631 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3630 ASM_LOCATION("FullCodeGenerator::EmitCallFunction"); | 3632 ASM_LOCATION("FullCodeGenerator::EmitCallFunction"); |
3631 ZoneList<Expression*>* args = expr->arguments(); | 3633 ZoneList<Expression*>* args = expr->arguments(); |
3632 DCHECK(args->length() >= 2); | 3634 DCHECK(args->length() >= 2); |
3633 | 3635 |
3634 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3636 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3635 for (int i = 0; i < arg_count + 1; i++) { | 3637 for (int i = 0; i < arg_count + 1; i++) { |
3636 VisitForStackValue(args->at(i)); | 3638 VisitForStackValue(args->at(i)); |
3637 } | 3639 } |
3638 VisitForAccumulatorValue(args->last()); // Function. | 3640 VisitForAccumulatorValue(args->last()); // Function. |
3639 | 3641 |
| 3642 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
3640 Label runtime, done; | 3643 Label runtime, done; |
3641 // Check for non-function argument (including proxy). | 3644 // Check for non-function argument (including proxy). |
3642 __ JumpIfSmi(x0, &runtime); | 3645 __ JumpIfSmi(x0, &runtime); |
3643 __ JumpIfNotObjectType(x0, x1, x1, JS_FUNCTION_TYPE, &runtime); | 3646 __ JumpIfNotObjectType(x0, x1, x1, JS_FUNCTION_TYPE, &runtime); |
3644 | 3647 |
3645 // InvokeFunction requires the function in x1. Move it in there. | 3648 // InvokeFunction requires the function in x1. Move it in there. |
3646 __ Mov(x1, x0); | 3649 __ Mov(x1, x0); |
3647 ParameterCount count(arg_count); | 3650 ParameterCount count(arg_count); |
3648 __ InvokeFunction(x1, count, CALL_FUNCTION, NullCallWrapper()); | 3651 __ InvokeFunction(x1, count, CALL_FUNCTION, NullCallWrapper()); |
3649 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3652 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5175 } | 5178 } |
5176 | 5179 |
5177 return INTERRUPT; | 5180 return INTERRUPT; |
5178 } | 5181 } |
5179 | 5182 |
5180 | 5183 |
5181 } // namespace internal | 5184 } // namespace internal |
5182 } // namespace v8 | 5185 } // namespace v8 |
5183 | 5186 |
5184 #endif // V8_TARGET_ARCH_ARM64 | 5187 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |