| 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 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2781 // - target function | 2781 // - target function |
| 2782 // - this (receiver) | 2782 // - this (receiver) |
| 2783 EmitCall(expr, CallICState::METHOD); | 2783 EmitCall(expr, CallICState::METHOD); |
| 2784 } | 2784 } |
| 2785 | 2785 |
| 2786 | 2786 |
| 2787 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2787 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
| 2788 // Load the arguments. | 2788 // Load the arguments. |
| 2789 ZoneList<Expression*>* args = expr->arguments(); | 2789 ZoneList<Expression*>* args = expr->arguments(); |
| 2790 int arg_count = args->length(); | 2790 int arg_count = args->length(); |
| 2791 for (int i = 0; i < arg_count; i++) { | 2791 for (int i = 0; i < arg_count; i++) { |
| 2792 VisitForStackValue(args->at(i)); | 2792 VisitForStackValue(args->at(i)); |
| 2793 } | 2793 } |
| 2794 SetExpressionPosition(expr); | 2794 |
| 2795 SetCallPosition(expr, arg_count); |
| 2795 | 2796 |
| 2796 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2797 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
| 2797 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); | 2798 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); |
| 2798 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2799 __ Peek(x1, (arg_count + 1) * kXRegSize); |
| 2799 // Don't assign a type feedback id to the IC, since type feedback is provided | 2800 // Don't assign a type feedback id to the IC, since type feedback is provided |
| 2800 // by the vector above. | 2801 // by the vector above. |
| 2801 CallIC(ic); | 2802 CallIC(ic); |
| 2802 | 2803 |
| 2803 RecordJSReturnSite(expr); | 2804 RecordJSReturnSite(expr); |
| 2804 // Restore context register. | 2805 // Restore context register. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2900 Expression* callee = expr->expression(); | 2901 Expression* callee = expr->expression(); |
| 2901 Call::CallType call_type = expr->GetCallType(isolate()); | 2902 Call::CallType call_type = expr->GetCallType(isolate()); |
| 2902 | 2903 |
| 2903 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 2904 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
| 2904 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 2905 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
| 2905 // to resolve the function we need to call. Then we call the resolved | 2906 // to resolve the function we need to call. Then we call the resolved |
| 2906 // function using the given arguments. | 2907 // function using the given arguments. |
| 2907 ZoneList<Expression*>* args = expr->arguments(); | 2908 ZoneList<Expression*>* args = expr->arguments(); |
| 2908 int arg_count = args->length(); | 2909 int arg_count = args->length(); |
| 2909 | 2910 |
| 2910 PushCalleeAndWithBaseObject(expr); | 2911 PushCalleeAndWithBaseObject(expr); |
| 2911 | 2912 |
| 2912 // Push the arguments. | 2913 // Push the arguments. |
| 2913 for (int i = 0; i < arg_count; i++) { | 2914 for (int i = 0; i < arg_count; i++) { |
| 2914 VisitForStackValue(args->at(i)); | 2915 VisitForStackValue(args->at(i)); |
| 2915 } | 2916 } |
| 2916 | 2917 |
| 2917 // Push a copy of the function (found below the arguments) and | 2918 // Push a copy of the function (found below the arguments) and |
| 2918 // resolve eval. | 2919 // resolve eval. |
| 2919 __ Peek(x10, (arg_count + 1) * kPointerSize); | 2920 __ Peek(x10, (arg_count + 1) * kPointerSize); |
| 2920 __ Push(x10); | 2921 __ Push(x10); |
| 2921 EmitResolvePossiblyDirectEval(arg_count); | 2922 EmitResolvePossiblyDirectEval(arg_count); |
| 2922 | 2923 |
| 2923 // Touch up the stack with the resolved function. | 2924 // Touch up the stack with the resolved function. |
| 2924 __ Poke(x0, (arg_count + 1) * kPointerSize); | 2925 __ Poke(x0, (arg_count + 1) * kPointerSize); |
| 2925 | 2926 |
| 2926 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2927 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| 2927 | 2928 |
| 2928 // Record source position for debugger. | 2929 // Record source position for debugger. |
| 2929 SetExpressionPosition(expr); | 2930 SetCallPosition(expr, arg_count); |
| 2930 | 2931 |
| 2931 // Call the evaluated function. | 2932 // Call the evaluated function. |
| 2932 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 2933 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| 2933 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2934 __ Peek(x1, (arg_count + 1) * kXRegSize); |
| 2934 __ CallStub(&stub); | 2935 __ CallStub(&stub); |
| 2935 RecordJSReturnSite(expr); | 2936 RecordJSReturnSite(expr); |
| 2936 // Restore context register. | 2937 // Restore context register. |
| 2937 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2938 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2938 context()->DropAndPlug(1, x0); | 2939 context()->DropAndPlug(1, x0); |
| 2939 | 2940 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 | 2995 |
| 2995 // Push the arguments ("left-to-right") on the stack. | 2996 // Push the arguments ("left-to-right") on the stack. |
| 2996 ZoneList<Expression*>* args = expr->arguments(); | 2997 ZoneList<Expression*>* args = expr->arguments(); |
| 2997 int arg_count = args->length(); | 2998 int arg_count = args->length(); |
| 2998 for (int i = 0; i < arg_count; i++) { | 2999 for (int i = 0; i < arg_count; i++) { |
| 2999 VisitForStackValue(args->at(i)); | 3000 VisitForStackValue(args->at(i)); |
| 3000 } | 3001 } |
| 3001 | 3002 |
| 3002 // Call the construct call builtin that handles allocation and | 3003 // Call the construct call builtin that handles allocation and |
| 3003 // constructor invocation. | 3004 // constructor invocation. |
| 3004 SetExpressionPosition(expr); | 3005 SetConstructCallPosition(expr); |
| 3005 | 3006 |
| 3006 // Load function and argument count into x1 and x0. | 3007 // Load function and argument count into x1 and x0. |
| 3007 __ Mov(x0, arg_count); | 3008 __ Mov(x0, arg_count); |
| 3008 __ Peek(x1, arg_count * kXRegSize); | 3009 __ Peek(x1, arg_count * kXRegSize); |
| 3009 | 3010 |
| 3010 // Record call targets in unoptimized code. | 3011 // Record call targets in unoptimized code. |
| 3011 if (FLAG_pretenuring_call_new) { | 3012 if (FLAG_pretenuring_call_new) { |
| 3012 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3013 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| 3013 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3014 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
| 3014 expr->CallNewFeedbackSlot().ToInt() + 1); | 3015 expr->CallNewFeedbackSlot().ToInt() + 1); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3037 | 3038 |
| 3038 // Push the arguments ("left-to-right") on the stack. | 3039 // Push the arguments ("left-to-right") on the stack. |
| 3039 ZoneList<Expression*>* args = expr->arguments(); | 3040 ZoneList<Expression*>* args = expr->arguments(); |
| 3040 int arg_count = args->length(); | 3041 int arg_count = args->length(); |
| 3041 for (int i = 0; i < arg_count; i++) { | 3042 for (int i = 0; i < arg_count; i++) { |
| 3042 VisitForStackValue(args->at(i)); | 3043 VisitForStackValue(args->at(i)); |
| 3043 } | 3044 } |
| 3044 | 3045 |
| 3045 // Call the construct call builtin that handles allocation and | 3046 // Call the construct call builtin that handles allocation and |
| 3046 // constructor invocation. | 3047 // constructor invocation. |
| 3047 SetExpressionPosition(expr); | 3048 SetConstructCallPosition(expr); |
| 3048 | 3049 |
| 3049 // Load function and argument count into x1 and x0. | 3050 // Load function and argument count into x1 and x0. |
| 3050 __ Mov(x0, arg_count); | 3051 __ Mov(x0, arg_count); |
| 3051 __ Peek(x1, arg_count * kXRegSize); | 3052 __ Peek(x1, arg_count * kXRegSize); |
| 3052 | 3053 |
| 3053 // Record call targets in unoptimized code. | 3054 // Record call targets in unoptimized code. |
| 3054 if (FLAG_pretenuring_call_new) { | 3055 if (FLAG_pretenuring_call_new) { |
| 3055 UNREACHABLE(); | 3056 UNREACHABLE(); |
| 3056 /* TODO(dslomov): support pretenuring. | 3057 /* TODO(dslomov): support pretenuring. |
| 3057 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3058 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4417 __ Mov(LoadDescriptor::SlotRegister(), | 4418 __ Mov(LoadDescriptor::SlotRegister(), |
| 4418 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); | 4419 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); |
| 4419 CallLoadIC(NOT_CONTEXTUAL); | 4420 CallLoadIC(NOT_CONTEXTUAL); |
| 4420 } | 4421 } |
| 4421 | 4422 |
| 4422 | 4423 |
| 4423 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4424 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4424 ZoneList<Expression*>* args = expr->arguments(); | 4425 ZoneList<Expression*>* args = expr->arguments(); |
| 4425 int arg_count = args->length(); | 4426 int arg_count = args->length(); |
| 4426 | 4427 |
| 4427 SetExpressionPosition(expr); | 4428 SetCallPosition(expr, arg_count); |
| 4428 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4429 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| 4429 __ Peek(x1, (arg_count + 1) * kPointerSize); | 4430 __ Peek(x1, (arg_count + 1) * kPointerSize); |
| 4430 __ CallStub(&stub); | 4431 __ CallStub(&stub); |
| 4431 } | 4432 } |
| 4432 | 4433 |
| 4433 | 4434 |
| 4434 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4435 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
| 4435 ZoneList<Expression*>* args = expr->arguments(); | 4436 ZoneList<Expression*>* args = expr->arguments(); |
| 4436 int arg_count = args->length(); | 4437 int arg_count = args->length(); |
| 4437 | 4438 |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5179 // result = receiver[f](arg); | 5180 // result = receiver[f](arg); |
| 5180 __ Bind(&l_call); | 5181 __ Bind(&l_call); |
| 5181 __ Peek(load_receiver, 1 * kPointerSize); | 5182 __ Peek(load_receiver, 1 * kPointerSize); |
| 5182 __ Peek(load_name, 2 * kPointerSize); | 5183 __ Peek(load_name, 2 * kPointerSize); |
| 5183 __ Mov(LoadDescriptor::SlotRegister(), | 5184 __ Mov(LoadDescriptor::SlotRegister(), |
| 5184 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 5185 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
| 5185 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 5186 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
| 5186 CallIC(ic, TypeFeedbackId::None()); | 5187 CallIC(ic, TypeFeedbackId::None()); |
| 5187 __ Mov(x1, x0); | 5188 __ Mov(x1, x0); |
| 5188 __ Poke(x1, 2 * kPointerSize); | 5189 __ Poke(x1, 2 * kPointerSize); |
| 5190 SetCallPosition(expr, 1); |
| 5189 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 5191 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
| 5190 __ CallStub(&stub); | 5192 __ CallStub(&stub); |
| 5191 | 5193 |
| 5192 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5194 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 5193 __ Drop(1); // The function is still on the stack; drop it. | 5195 __ Drop(1); // The function is still on the stack; drop it. |
| 5194 | 5196 |
| 5195 // if (!result.done) goto l_try; | 5197 // if (!result.done) goto l_try; |
| 5196 __ Bind(&l_loop); | 5198 __ Bind(&l_loop); |
| 5197 __ Move(load_receiver, x0); | 5199 __ Move(load_receiver, x0); |
| 5198 | 5200 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5569 } | 5571 } |
| 5570 | 5572 |
| 5571 return INTERRUPT; | 5573 return INTERRUPT; |
| 5572 } | 5574 } |
| 5573 | 5575 |
| 5574 | 5576 |
| 5575 } // namespace internal | 5577 } // namespace internal |
| 5576 } // namespace v8 | 5578 } // namespace v8 |
| 5577 | 5579 |
| 5578 #endif // V8_TARGET_ARCH_ARM64 | 5580 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |