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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 __ Mov(x13, Smi::FromInt(scope()->start_position())); | 2621 __ Mov(x13, Smi::FromInt(scope()->start_position())); |
2622 | 2622 |
2623 // Push. | 2623 // Push. |
2624 __ Push(x10, x11, x12, x13); | 2624 __ Push(x10, x11, x12, x13); |
2625 | 2625 |
2626 // Do the runtime call. | 2626 // Do the runtime call. |
2627 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2627 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
2628 } | 2628 } |
2629 | 2629 |
2630 | 2630 |
2631 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* expr) { | |
2632 DCHECK(super_ref != NULL); | |
2633 __ ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
2634 __ Push(x0); | |
2635 __ CallRuntime(Runtime::kGetPrototype, 1); | |
2636 } | |
2637 | |
2638 | |
2639 void FullCodeGenerator::VisitCall(Call* expr) { | 2631 void FullCodeGenerator::VisitCall(Call* expr) { |
2640 #ifdef DEBUG | 2632 #ifdef DEBUG |
2641 // We want to verify that RecordJSReturnSite gets called on all paths | 2633 // We want to verify that RecordJSReturnSite gets called on all paths |
2642 // through this function. Avoid early returns. | 2634 // through this function. Avoid early returns. |
2643 expr->return_is_recorded_ = false; | 2635 expr->return_is_recorded_ = false; |
2644 #endif | 2636 #endif |
2645 | 2637 |
2646 Comment cmnt(masm_, "[ Call"); | 2638 Comment cmnt(masm_, "[ Call"); |
2647 Expression* callee = expr->expression(); | 2639 Expression* callee = expr->expression(); |
2648 Call::CallType call_type = expr->GetCallType(isolate()); | 2640 Call::CallType call_type = expr->GetCallType(isolate()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 VisitForStackValue(property->obj()); | 2739 VisitForStackValue(property->obj()); |
2748 } | 2740 } |
2749 if (is_named_call) { | 2741 if (is_named_call) { |
2750 EmitCallWithLoadIC(expr); | 2742 EmitCallWithLoadIC(expr); |
2751 } else { | 2743 } else { |
2752 EmitKeyedCallWithLoadIC(expr, property->key()); | 2744 EmitKeyedCallWithLoadIC(expr, property->key()); |
2753 } | 2745 } |
2754 } | 2746 } |
2755 } else if (call_type == Call::SUPER_CALL) { | 2747 } else if (call_type == Call::SUPER_CALL) { |
2756 SuperReference* super_ref = callee->AsSuperReference(); | 2748 SuperReference* super_ref = callee->AsSuperReference(); |
2757 EmitLoadSuperConstructor(super_ref); | 2749 DCHECK(super_ref != NULL); |
| 2750 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2751 __ Push(x0); |
| 2752 __ CallRuntime(Runtime::kGetPrototype, 1); |
2758 __ Push(result_register()); | 2753 __ Push(result_register()); |
2759 VisitForStackValue(super_ref->this_var()); | 2754 VisitForStackValue(super_ref->this_var()); |
2760 EmitCall(expr, CallICState::METHOD); | 2755 EmitCall(expr, CallICState::METHOD); |
2761 } else { | 2756 } else { |
2762 DCHECK(call_type == Call::OTHER_CALL); | 2757 DCHECK(call_type == Call::OTHER_CALL); |
2763 // Call to an arbitrary expression not handled specially above. | 2758 // Call to an arbitrary expression not handled specially above. |
2764 { PreservePositionScope scope(masm()->positions_recorder()); | 2759 { PreservePositionScope scope(masm()->positions_recorder()); |
2765 VisitForStackValue(callee); | 2760 VisitForStackValue(callee); |
2766 } | 2761 } |
2767 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex); | 2762 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex); |
(...skipping 11 matching lines...) Expand all Loading... |
2779 | 2774 |
2780 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 2775 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
2781 Comment cmnt(masm_, "[ CallNew"); | 2776 Comment cmnt(masm_, "[ CallNew"); |
2782 // According to ECMA-262, section 11.2.2, page 44, the function | 2777 // According to ECMA-262, section 11.2.2, page 44, the function |
2783 // expression in new calls must be evaluated before the | 2778 // expression in new calls must be evaluated before the |
2784 // arguments. | 2779 // arguments. |
2785 | 2780 |
2786 // Push constructor on the stack. If it's not a function it's used as | 2781 // Push constructor on the stack. If it's not a function it's used as |
2787 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is | 2782 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
2788 // ignored. | 2783 // ignored. |
2789 if (expr->expression()->IsSuperReference()) { | 2784 VisitForStackValue(expr->expression()); |
2790 EmitLoadSuperConstructor(expr->expression()->AsSuperReference()); | |
2791 __ Push(result_register()); | |
2792 } else { | |
2793 VisitForStackValue(expr->expression()); | |
2794 } | |
2795 | 2785 |
2796 // Push the arguments ("left-to-right") on the stack. | 2786 // Push the arguments ("left-to-right") on the stack. |
2797 ZoneList<Expression*>* args = expr->arguments(); | 2787 ZoneList<Expression*>* args = expr->arguments(); |
2798 int arg_count = args->length(); | 2788 int arg_count = args->length(); |
2799 for (int i = 0; i < arg_count; i++) { | 2789 for (int i = 0; i < arg_count; i++) { |
2800 VisitForStackValue(args->at(i)); | 2790 VisitForStackValue(args->at(i)); |
2801 } | 2791 } |
2802 | 2792 |
2803 // Call the construct call builtin that handles allocation and | 2793 // Call the construct call builtin that handles allocation and |
2804 // constructor invocation. | 2794 // constructor invocation. |
(...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5257 return previous_; | 5247 return previous_; |
5258 } | 5248 } |
5259 | 5249 |
5260 | 5250 |
5261 #undef __ | 5251 #undef __ |
5262 | 5252 |
5263 | 5253 |
5264 } } // namespace v8::internal | 5254 } } // namespace v8::internal |
5265 | 5255 |
5266 #endif // V8_TARGET_ARCH_ARM64 | 5256 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |