| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 | 2577 |
| 2578 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { | 2578 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
| 2579 // Load the arguments. | 2579 // Load the arguments. |
| 2580 ZoneList<Expression*>* args = expr->arguments(); | 2580 ZoneList<Expression*>* args = expr->arguments(); |
| 2581 int arg_count = args->length(); | 2581 int arg_count = args->length(); |
| 2582 for (int i = 0; i < arg_count; i++) { | 2582 for (int i = 0; i < arg_count; i++) { |
| 2583 VisitForStackValue(args->at(i)); | 2583 VisitForStackValue(args->at(i)); |
| 2584 } | 2584 } |
| 2585 | 2585 |
| 2586 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 2586 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 2587 SetCallPosition(expr, arg_count); | 2587 SetCallPosition(expr); |
| 2588 | 2588 |
| 2589 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); | 2589 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); |
| 2590 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); | 2590 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); |
| 2591 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2591 __ Peek(x1, (arg_count + 1) * kXRegSize); |
| 2592 // Don't assign a type feedback id to the IC, since type feedback is provided | 2592 // Don't assign a type feedback id to the IC, since type feedback is provided |
| 2593 // by the vector above. | 2593 // by the vector above. |
| 2594 CallIC(ic); | 2594 CallIC(ic); |
| 2595 | 2595 |
| 2596 RecordJSReturnSite(expr); | 2596 RecordJSReturnSite(expr); |
| 2597 // Restore context register. | 2597 // Restore context register. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2686 __ Peek(x10, (arg_count + 1) * kPointerSize); | 2686 __ Peek(x10, (arg_count + 1) * kPointerSize); |
| 2687 __ Push(x10); | 2687 __ Push(x10); |
| 2688 EmitResolvePossiblyDirectEval(arg_count); | 2688 EmitResolvePossiblyDirectEval(arg_count); |
| 2689 | 2689 |
| 2690 // Touch up the stack with the resolved function. | 2690 // Touch up the stack with the resolved function. |
| 2691 __ Poke(x0, (arg_count + 1) * kPointerSize); | 2691 __ Poke(x0, (arg_count + 1) * kPointerSize); |
| 2692 | 2692 |
| 2693 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2693 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| 2694 | 2694 |
| 2695 // Record source position for debugger. | 2695 // Record source position for debugger. |
| 2696 SetCallPosition(expr, arg_count); | 2696 SetCallPosition(expr); |
| 2697 | 2697 |
| 2698 // Call the evaluated function. | 2698 // Call the evaluated function. |
| 2699 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2699 __ Peek(x1, (arg_count + 1) * kXRegSize); |
| 2700 __ Mov(x0, arg_count); | 2700 __ Mov(x0, arg_count); |
| 2701 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2701 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 2702 RecordJSReturnSite(expr); | 2702 RecordJSReturnSite(expr); |
| 2703 // Restore context register. | 2703 // Restore context register. |
| 2704 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2704 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2705 context()->DropAndPlug(1, x0); | 2705 context()->DropAndPlug(1, x0); |
| 2706 } | 2706 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2720 | 2720 |
| 2721 // Push the arguments ("left-to-right") on the stack. | 2721 // Push the arguments ("left-to-right") on the stack. |
| 2722 ZoneList<Expression*>* args = expr->arguments(); | 2722 ZoneList<Expression*>* args = expr->arguments(); |
| 2723 int arg_count = args->length(); | 2723 int arg_count = args->length(); |
| 2724 for (int i = 0; i < arg_count; i++) { | 2724 for (int i = 0; i < arg_count; i++) { |
| 2725 VisitForStackValue(args->at(i)); | 2725 VisitForStackValue(args->at(i)); |
| 2726 } | 2726 } |
| 2727 | 2727 |
| 2728 // Call the construct call builtin that handles allocation and | 2728 // Call the construct call builtin that handles allocation and |
| 2729 // constructor invocation. | 2729 // constructor invocation. |
| 2730 SetConstructCallPosition(expr, arg_count); | 2730 SetConstructCallPosition(expr); |
| 2731 | 2731 |
| 2732 // Load function and argument count into x1 and x0. | 2732 // Load function and argument count into x1 and x0. |
| 2733 __ Mov(x0, arg_count); | 2733 __ Mov(x0, arg_count); |
| 2734 __ Peek(x1, arg_count * kXRegSize); | 2734 __ Peek(x1, arg_count * kXRegSize); |
| 2735 | 2735 |
| 2736 // Record call targets in unoptimized code. | 2736 // Record call targets in unoptimized code. |
| 2737 __ EmitLoadTypeFeedbackVector(x2); | 2737 __ EmitLoadTypeFeedbackVector(x2); |
| 2738 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); | 2738 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); |
| 2739 | 2739 |
| 2740 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); | 2740 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2756 | 2756 |
| 2757 // Push the arguments ("left-to-right") on the stack. | 2757 // Push the arguments ("left-to-right") on the stack. |
| 2758 ZoneList<Expression*>* args = expr->arguments(); | 2758 ZoneList<Expression*>* args = expr->arguments(); |
| 2759 int arg_count = args->length(); | 2759 int arg_count = args->length(); |
| 2760 for (int i = 0; i < arg_count; i++) { | 2760 for (int i = 0; i < arg_count; i++) { |
| 2761 VisitForStackValue(args->at(i)); | 2761 VisitForStackValue(args->at(i)); |
| 2762 } | 2762 } |
| 2763 | 2763 |
| 2764 // Call the construct call builtin that handles allocation and | 2764 // Call the construct call builtin that handles allocation and |
| 2765 // constructor invocation. | 2765 // constructor invocation. |
| 2766 SetConstructCallPosition(expr, arg_count); | 2766 SetConstructCallPosition(expr); |
| 2767 | 2767 |
| 2768 // Load new target into x3. | 2768 // Load new target into x3. |
| 2769 VisitForAccumulatorValue(super_call_ref->new_target_var()); | 2769 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
| 2770 __ Mov(x3, result_register()); | 2770 __ Mov(x3, result_register()); |
| 2771 | 2771 |
| 2772 // Load function and argument count into x1 and x0. | 2772 // Load function and argument count into x1 and x0. |
| 2773 __ Mov(x0, arg_count); | 2773 __ Mov(x0, arg_count); |
| 2774 __ Peek(x1, arg_count * kXRegSize); | 2774 __ Peek(x1, arg_count * kXRegSize); |
| 2775 | 2775 |
| 2776 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 2776 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3486 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3486 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
| 3487 ZoneList<Expression*>* args = expr->arguments(); | 3487 ZoneList<Expression*>* args = expr->arguments(); |
| 3488 DCHECK(args->length() == 2); | 3488 DCHECK(args->length() == 2); |
| 3489 | 3489 |
| 3490 // Evaluate new.target and super constructor. | 3490 // Evaluate new.target and super constructor. |
| 3491 VisitForStackValue(args->at(0)); | 3491 VisitForStackValue(args->at(0)); |
| 3492 VisitForStackValue(args->at(1)); | 3492 VisitForStackValue(args->at(1)); |
| 3493 | 3493 |
| 3494 // Call the construct call builtin that handles allocation and | 3494 // Call the construct call builtin that handles allocation and |
| 3495 // constructor invocation. | 3495 // constructor invocation. |
| 3496 SetConstructCallPosition(expr, 0); | 3496 SetConstructCallPosition(expr); |
| 3497 | 3497 |
| 3498 // Load new target into x3. | 3498 // Load new target into x3. |
| 3499 __ Peek(x3, 1 * kPointerSize); | 3499 __ Peek(x3, 1 * kPointerSize); |
| 3500 | 3500 |
| 3501 // Check if the calling frame is an arguments adaptor frame. | 3501 // Check if the calling frame is an arguments adaptor frame. |
| 3502 Label adaptor_frame, args_set_up, runtime; | 3502 Label adaptor_frame, args_set_up, runtime; |
| 3503 __ Ldr(x11, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3503 __ Ldr(x11, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 3504 __ Ldr(x12, MemOperand(x11, StandardFrameConstants::kContextOffset)); | 3504 __ Ldr(x12, MemOperand(x11, StandardFrameConstants::kContextOffset)); |
| 3505 __ Cmp(x12, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 3505 __ Cmp(x12, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
| 3506 __ B(eq, &adaptor_frame); | 3506 __ B(eq, &adaptor_frame); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3851 __ Push(x0); | 3851 __ Push(x0); |
| 3852 | 3852 |
| 3853 __ LoadNativeContextSlot(expr->context_index(), x0); | 3853 __ LoadNativeContextSlot(expr->context_index(), x0); |
| 3854 } | 3854 } |
| 3855 | 3855 |
| 3856 | 3856 |
| 3857 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3857 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 3858 ZoneList<Expression*>* args = expr->arguments(); | 3858 ZoneList<Expression*>* args = expr->arguments(); |
| 3859 int arg_count = args->length(); | 3859 int arg_count = args->length(); |
| 3860 | 3860 |
| 3861 SetCallPosition(expr, arg_count); | 3861 SetCallPosition(expr); |
| 3862 __ Peek(x1, (arg_count + 1) * kPointerSize); | 3862 __ Peek(x1, (arg_count + 1) * kPointerSize); |
| 3863 __ Mov(x0, arg_count); | 3863 __ Mov(x0, arg_count); |
| 3864 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3864 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
| 3865 RelocInfo::CODE_TARGET); | 3865 RelocInfo::CODE_TARGET); |
| 3866 } | 3866 } |
| 3867 | 3867 |
| 3868 | 3868 |
| 3869 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 3869 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
| 3870 ZoneList<Expression*>* args = expr->arguments(); | 3870 ZoneList<Expression*>* args = expr->arguments(); |
| 3871 int arg_count = args->length(); | 3871 int arg_count = args->length(); |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4612 // result = receiver[f](arg); | 4612 // result = receiver[f](arg); |
| 4613 __ Bind(&l_call); | 4613 __ Bind(&l_call); |
| 4614 __ Peek(load_receiver, 1 * kPointerSize); | 4614 __ Peek(load_receiver, 1 * kPointerSize); |
| 4615 __ Peek(load_name, 2 * kPointerSize); | 4615 __ Peek(load_name, 2 * kPointerSize); |
| 4616 __ Mov(LoadDescriptor::SlotRegister(), | 4616 __ Mov(LoadDescriptor::SlotRegister(), |
| 4617 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 4617 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
| 4618 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 4618 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
| 4619 CallIC(ic, TypeFeedbackId::None()); | 4619 CallIC(ic, TypeFeedbackId::None()); |
| 4620 __ Mov(x1, x0); | 4620 __ Mov(x1, x0); |
| 4621 __ Poke(x1, 2 * kPointerSize); | 4621 __ Poke(x1, 2 * kPointerSize); |
| 4622 SetCallPosition(expr, 1); | 4622 SetCallPosition(expr); |
| 4623 __ Mov(x0, 1); | 4623 __ Mov(x0, 1); |
| 4624 __ Call( | 4624 __ Call( |
| 4625 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), | 4625 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), |
| 4626 RelocInfo::CODE_TARGET); | 4626 RelocInfo::CODE_TARGET); |
| 4627 | 4627 |
| 4628 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4628 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 4629 __ Drop(1); // The function is still on the stack; drop it. | 4629 __ Drop(1); // The function is still on the stack; drop it. |
| 4630 | 4630 |
| 4631 // if (!result.done) goto l_try; | 4631 // if (!result.done) goto l_try; |
| 4632 __ Bind(&l_loop); | 4632 __ Bind(&l_loop); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4982 } | 4982 } |
| 4983 | 4983 |
| 4984 return INTERRUPT; | 4984 return INTERRUPT; |
| 4985 } | 4985 } |
| 4986 | 4986 |
| 4987 | 4987 |
| 4988 } // namespace internal | 4988 } // namespace internal |
| 4989 } // namespace v8 | 4989 } // namespace v8 |
| 4990 | 4990 |
| 4991 #endif // V8_TARGET_ARCH_ARM64 | 4991 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |