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 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 // - target function | 2769 // - target function |
2770 // - this (receiver) | 2770 // - this (receiver) |
2771 EmitCall(expr, CallICState::METHOD); | 2771 EmitCall(expr, CallICState::METHOD); |
2772 } | 2772 } |
2773 | 2773 |
2774 | 2774 |
2775 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2775 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
2776 // Load the arguments. | 2776 // Load the arguments. |
2777 ZoneList<Expression*>* args = expr->arguments(); | 2777 ZoneList<Expression*>* args = expr->arguments(); |
2778 int arg_count = args->length(); | 2778 int arg_count = args->length(); |
2779 for (int i = 0; i < arg_count; i++) { | 2779 for (int i = 0; i < arg_count; i++) { |
2780 VisitForStackValue(args->at(i)); | 2780 VisitForStackValue(args->at(i)); |
2781 } | 2781 } |
2782 SetExpressionPosition(expr); | 2782 |
| 2783 SetCallPosition(expr, arg_count); |
2783 | 2784 |
2784 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2785 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
2785 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); | 2786 __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); |
2786 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2787 __ Peek(x1, (arg_count + 1) * kXRegSize); |
2787 // Don't assign a type feedback id to the IC, since type feedback is provided | 2788 // Don't assign a type feedback id to the IC, since type feedback is provided |
2788 // by the vector above. | 2789 // by the vector above. |
2789 CallIC(ic); | 2790 CallIC(ic); |
2790 | 2791 |
2791 RecordJSReturnSite(expr); | 2792 RecordJSReturnSite(expr); |
2792 // Restore context register. | 2793 // Restore context register. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2888 Expression* callee = expr->expression(); | 2889 Expression* callee = expr->expression(); |
2889 Call::CallType call_type = expr->GetCallType(isolate()); | 2890 Call::CallType call_type = expr->GetCallType(isolate()); |
2890 | 2891 |
2891 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 2892 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
2892 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval | 2893 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
2893 // to resolve the function we need to call. Then we call the resolved | 2894 // to resolve the function we need to call. Then we call the resolved |
2894 // function using the given arguments. | 2895 // function using the given arguments. |
2895 ZoneList<Expression*>* args = expr->arguments(); | 2896 ZoneList<Expression*>* args = expr->arguments(); |
2896 int arg_count = args->length(); | 2897 int arg_count = args->length(); |
2897 | 2898 |
2898 PushCalleeAndWithBaseObject(expr); | 2899 PushCalleeAndWithBaseObject(expr); |
2899 | 2900 |
2900 // Push the arguments. | 2901 // Push the arguments. |
2901 for (int i = 0; i < arg_count; i++) { | 2902 for (int i = 0; i < arg_count; i++) { |
2902 VisitForStackValue(args->at(i)); | 2903 VisitForStackValue(args->at(i)); |
2903 } | 2904 } |
2904 | 2905 |
2905 // Push a copy of the function (found below the arguments) and | 2906 // Push a copy of the function (found below the arguments) and |
2906 // resolve eval. | 2907 // resolve eval. |
2907 __ Peek(x10, (arg_count + 1) * kPointerSize); | 2908 __ Peek(x10, (arg_count + 1) * kPointerSize); |
2908 __ Push(x10); | 2909 __ Push(x10); |
2909 EmitResolvePossiblyDirectEval(arg_count); | 2910 EmitResolvePossiblyDirectEval(arg_count); |
2910 | 2911 |
2911 // Touch up the stack with the resolved function. | 2912 // Touch up the stack with the resolved function. |
2912 __ Poke(x0, (arg_count + 1) * kPointerSize); | 2913 __ Poke(x0, (arg_count + 1) * kPointerSize); |
2913 | 2914 |
2914 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2915 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2915 | 2916 |
2916 // Record source position for debugger. | 2917 // Record source position for debugger. |
2917 SetExpressionPosition(expr); | 2918 SetCallPosition(expr, arg_count); |
2918 | 2919 |
2919 // Call the evaluated function. | 2920 // Call the evaluated function. |
2920 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 2921 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
2921 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2922 __ Peek(x1, (arg_count + 1) * kXRegSize); |
2922 __ CallStub(&stub); | 2923 __ CallStub(&stub); |
2923 RecordJSReturnSite(expr); | 2924 RecordJSReturnSite(expr); |
2924 // Restore context register. | 2925 // Restore context register. |
2925 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2926 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2926 context()->DropAndPlug(1, x0); | 2927 context()->DropAndPlug(1, x0); |
2927 | 2928 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2982 | 2983 |
2983 // Push the arguments ("left-to-right") on the stack. | 2984 // Push the arguments ("left-to-right") on the stack. |
2984 ZoneList<Expression*>* args = expr->arguments(); | 2985 ZoneList<Expression*>* args = expr->arguments(); |
2985 int arg_count = args->length(); | 2986 int arg_count = args->length(); |
2986 for (int i = 0; i < arg_count; i++) { | 2987 for (int i = 0; i < arg_count; i++) { |
2987 VisitForStackValue(args->at(i)); | 2988 VisitForStackValue(args->at(i)); |
2988 } | 2989 } |
2989 | 2990 |
2990 // Call the construct call builtin that handles allocation and | 2991 // Call the construct call builtin that handles allocation and |
2991 // constructor invocation. | 2992 // constructor invocation. |
2992 SetExpressionPosition(expr); | 2993 SetConstructCallPosition(expr); |
2993 | 2994 |
2994 // Load function and argument count into x1 and x0. | 2995 // Load function and argument count into x1 and x0. |
2995 __ Mov(x0, arg_count); | 2996 __ Mov(x0, arg_count); |
2996 __ Peek(x1, arg_count * kXRegSize); | 2997 __ Peek(x1, arg_count * kXRegSize); |
2997 | 2998 |
2998 // Record call targets in unoptimized code. | 2999 // Record call targets in unoptimized code. |
2999 if (FLAG_pretenuring_call_new) { | 3000 if (FLAG_pretenuring_call_new) { |
3000 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3001 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
3001 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3002 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
3002 expr->CallNewFeedbackSlot().ToInt() + 1); | 3003 expr->CallNewFeedbackSlot().ToInt() + 1); |
(...skipping 22 matching lines...) Expand all Loading... |
3025 | 3026 |
3026 // Push the arguments ("left-to-right") on the stack. | 3027 // Push the arguments ("left-to-right") on the stack. |
3027 ZoneList<Expression*>* args = expr->arguments(); | 3028 ZoneList<Expression*>* args = expr->arguments(); |
3028 int arg_count = args->length(); | 3029 int arg_count = args->length(); |
3029 for (int i = 0; i < arg_count; i++) { | 3030 for (int i = 0; i < arg_count; i++) { |
3030 VisitForStackValue(args->at(i)); | 3031 VisitForStackValue(args->at(i)); |
3031 } | 3032 } |
3032 | 3033 |
3033 // Call the construct call builtin that handles allocation and | 3034 // Call the construct call builtin that handles allocation and |
3034 // constructor invocation. | 3035 // constructor invocation. |
3035 SetExpressionPosition(expr); | 3036 SetConstructCallPosition(expr); |
3036 | 3037 |
3037 // Load function and argument count into x1 and x0. | 3038 // Load function and argument count into x1 and x0. |
3038 __ Mov(x0, arg_count); | 3039 __ Mov(x0, arg_count); |
3039 __ Peek(x1, arg_count * kXRegSize); | 3040 __ Peek(x1, arg_count * kXRegSize); |
3040 | 3041 |
3041 // Record call targets in unoptimized code. | 3042 // Record call targets in unoptimized code. |
3042 if (FLAG_pretenuring_call_new) { | 3043 if (FLAG_pretenuring_call_new) { |
3043 UNREACHABLE(); | 3044 UNREACHABLE(); |
3044 /* TODO(dslomov): support pretenuring. | 3045 /* TODO(dslomov): support pretenuring. |
3045 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3046 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4405 __ Mov(LoadDescriptor::SlotRegister(), | 4406 __ Mov(LoadDescriptor::SlotRegister(), |
4406 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); | 4407 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); |
4407 CallLoadIC(NOT_CONTEXTUAL); | 4408 CallLoadIC(NOT_CONTEXTUAL); |
4408 } | 4409 } |
4409 | 4410 |
4410 | 4411 |
4411 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4412 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4412 ZoneList<Expression*>* args = expr->arguments(); | 4413 ZoneList<Expression*>* args = expr->arguments(); |
4413 int arg_count = args->length(); | 4414 int arg_count = args->length(); |
4414 | 4415 |
4415 SetExpressionPosition(expr); | 4416 SetCallPosition(expr, arg_count); |
4416 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4417 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4417 __ Peek(x1, (arg_count + 1) * kPointerSize); | 4418 __ Peek(x1, (arg_count + 1) * kPointerSize); |
4418 __ CallStub(&stub); | 4419 __ CallStub(&stub); |
4419 } | 4420 } |
4420 | 4421 |
4421 | 4422 |
4422 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4423 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4423 ZoneList<Expression*>* args = expr->arguments(); | 4424 ZoneList<Expression*>* args = expr->arguments(); |
4424 int arg_count = args->length(); | 4425 int arg_count = args->length(); |
4425 | 4426 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5204 // result = receiver[f](arg); | 5205 // result = receiver[f](arg); |
5205 __ Bind(&l_call); | 5206 __ Bind(&l_call); |
5206 __ Peek(load_receiver, 1 * kPointerSize); | 5207 __ Peek(load_receiver, 1 * kPointerSize); |
5207 __ Peek(load_name, 2 * kPointerSize); | 5208 __ Peek(load_name, 2 * kPointerSize); |
5208 __ Mov(LoadDescriptor::SlotRegister(), | 5209 __ Mov(LoadDescriptor::SlotRegister(), |
5209 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 5210 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
5210 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 5211 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
5211 CallIC(ic, TypeFeedbackId::None()); | 5212 CallIC(ic, TypeFeedbackId::None()); |
5212 __ Mov(x1, x0); | 5213 __ Mov(x1, x0); |
5213 __ Poke(x1, 2 * kPointerSize); | 5214 __ Poke(x1, 2 * kPointerSize); |
| 5215 SetCallPosition(expr, 1); |
5214 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 5216 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
5215 __ CallStub(&stub); | 5217 __ CallStub(&stub); |
5216 | 5218 |
5217 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5219 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5218 __ Drop(1); // The function is still on the stack; drop it. | 5220 __ Drop(1); // The function is still on the stack; drop it. |
5219 | 5221 |
5220 // if (!result.done) goto l_try; | 5222 // if (!result.done) goto l_try; |
5221 __ Bind(&l_loop); | 5223 __ Bind(&l_loop); |
5222 __ Move(load_receiver, x0); | 5224 __ Move(load_receiver, x0); |
5223 | 5225 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5594 } | 5596 } |
5595 | 5597 |
5596 return INTERRUPT; | 5598 return INTERRUPT; |
5597 } | 5599 } |
5598 | 5600 |
5599 | 5601 |
5600 } // namespace internal | 5602 } // namespace internal |
5601 } // namespace v8 | 5603 } // namespace v8 |
5602 | 5604 |
5603 #endif // V8_TARGET_ARCH_ARM64 | 5605 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |