OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 // result = receiver[f](arg); | 2039 // result = receiver[f](arg); |
2040 __ bind(&l_call); | 2040 __ bind(&l_call); |
2041 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); | 2041 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); |
2042 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); | 2042 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); |
2043 __ mov(LoadDescriptor::SlotRegister(), | 2043 __ mov(LoadDescriptor::SlotRegister(), |
2044 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2044 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2045 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2045 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2046 CallIC(ic, TypeFeedbackId::None()); | 2046 CallIC(ic, TypeFeedbackId::None()); |
2047 __ mov(r1, r0); | 2047 __ mov(r1, r0); |
2048 __ str(r1, MemOperand(sp, 2 * kPointerSize)); | 2048 __ str(r1, MemOperand(sp, 2 * kPointerSize)); |
2049 SetCallPosition(expr, 1); | 2049 SetCallPosition(expr); |
2050 __ mov(r0, Operand(1)); | 2050 __ mov(r0, Operand(1)); |
2051 __ Call( | 2051 __ Call( |
2052 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), | 2052 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), |
2053 RelocInfo::CODE_TARGET); | 2053 RelocInfo::CODE_TARGET); |
2054 | 2054 |
2055 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2055 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2056 __ Drop(1); // The function is still on the stack; drop it. | 2056 __ Drop(1); // The function is still on the stack; drop it. |
2057 | 2057 |
2058 // if (!result.done) goto l_try; | 2058 // if (!result.done) goto l_try; |
2059 __ bind(&l_loop); | 2059 __ bind(&l_loop); |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 | 2866 |
2867 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { | 2867 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
2868 // Load the arguments. | 2868 // Load the arguments. |
2869 ZoneList<Expression*>* args = expr->arguments(); | 2869 ZoneList<Expression*>* args = expr->arguments(); |
2870 int arg_count = args->length(); | 2870 int arg_count = args->length(); |
2871 for (int i = 0; i < arg_count; i++) { | 2871 for (int i = 0; i < arg_count; i++) { |
2872 VisitForStackValue(args->at(i)); | 2872 VisitForStackValue(args->at(i)); |
2873 } | 2873 } |
2874 | 2874 |
2875 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 2875 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
2876 SetCallPosition(expr, arg_count); | 2876 SetCallPosition(expr); |
2877 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); | 2877 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); |
2878 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2878 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
2879 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2879 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2880 // Don't assign a type feedback id to the IC, since type feedback is provided | 2880 // Don't assign a type feedback id to the IC, since type feedback is provided |
2881 // by the vector above. | 2881 // by the vector above. |
2882 CallIC(ic); | 2882 CallIC(ic); |
2883 | 2883 |
2884 RecordJSReturnSite(expr); | 2884 RecordJSReturnSite(expr); |
2885 // Restore context register. | 2885 // Restore context register. |
2886 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2886 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2974 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2974 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2975 __ push(r1); | 2975 __ push(r1); |
2976 EmitResolvePossiblyDirectEval(arg_count); | 2976 EmitResolvePossiblyDirectEval(arg_count); |
2977 | 2977 |
2978 // Touch up the stack with the resolved function. | 2978 // Touch up the stack with the resolved function. |
2979 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2979 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2980 | 2980 |
2981 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2981 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2982 | 2982 |
2983 // Record source position for debugger. | 2983 // Record source position for debugger. |
2984 SetCallPosition(expr, arg_count); | 2984 SetCallPosition(expr); |
2985 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2985 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2986 __ mov(r0, Operand(arg_count)); | 2986 __ mov(r0, Operand(arg_count)); |
2987 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2987 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2988 RecordJSReturnSite(expr); | 2988 RecordJSReturnSite(expr); |
2989 // Restore context register. | 2989 // Restore context register. |
2990 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2990 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2991 context()->DropAndPlug(1, r0); | 2991 context()->DropAndPlug(1, r0); |
2992 } | 2992 } |
2993 | 2993 |
2994 | 2994 |
(...skipping 11 matching lines...) Expand all Loading... |
3006 | 3006 |
3007 // Push the arguments ("left-to-right") on the stack. | 3007 // Push the arguments ("left-to-right") on the stack. |
3008 ZoneList<Expression*>* args = expr->arguments(); | 3008 ZoneList<Expression*>* args = expr->arguments(); |
3009 int arg_count = args->length(); | 3009 int arg_count = args->length(); |
3010 for (int i = 0; i < arg_count; i++) { | 3010 for (int i = 0; i < arg_count; i++) { |
3011 VisitForStackValue(args->at(i)); | 3011 VisitForStackValue(args->at(i)); |
3012 } | 3012 } |
3013 | 3013 |
3014 // Call the construct call builtin that handles allocation and | 3014 // Call the construct call builtin that handles allocation and |
3015 // constructor invocation. | 3015 // constructor invocation. |
3016 SetConstructCallPosition(expr, arg_count); | 3016 SetConstructCallPosition(expr); |
3017 | 3017 |
3018 // Load function and argument count into r1 and r0. | 3018 // Load function and argument count into r1 and r0. |
3019 __ mov(r0, Operand(arg_count)); | 3019 __ mov(r0, Operand(arg_count)); |
3020 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3020 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
3021 | 3021 |
3022 // Record call targets in unoptimized code. | 3022 // Record call targets in unoptimized code. |
3023 __ EmitLoadTypeFeedbackVector(r2); | 3023 __ EmitLoadTypeFeedbackVector(r2); |
3024 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 3024 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
3025 | 3025 |
3026 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); | 3026 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); |
(...skipping 15 matching lines...) Expand all Loading... |
3042 | 3042 |
3043 // Push the arguments ("left-to-right") on the stack. | 3043 // Push the arguments ("left-to-right") on the stack. |
3044 ZoneList<Expression*>* args = expr->arguments(); | 3044 ZoneList<Expression*>* args = expr->arguments(); |
3045 int arg_count = args->length(); | 3045 int arg_count = args->length(); |
3046 for (int i = 0; i < arg_count; i++) { | 3046 for (int i = 0; i < arg_count; i++) { |
3047 VisitForStackValue(args->at(i)); | 3047 VisitForStackValue(args->at(i)); |
3048 } | 3048 } |
3049 | 3049 |
3050 // Call the construct call builtin that handles allocation and | 3050 // Call the construct call builtin that handles allocation and |
3051 // constructor invocation. | 3051 // constructor invocation. |
3052 SetConstructCallPosition(expr, arg_count); | 3052 SetConstructCallPosition(expr); |
3053 | 3053 |
3054 // Load new target into r3. | 3054 // Load new target into r3. |
3055 VisitForAccumulatorValue(super_call_ref->new_target_var()); | 3055 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
3056 __ mov(r3, result_register()); | 3056 __ mov(r3, result_register()); |
3057 | 3057 |
3058 // Load function and argument count into r1 and r0. | 3058 // Load function and argument count into r1 and r0. |
3059 __ mov(r0, Operand(arg_count)); | 3059 __ mov(r0, Operand(arg_count)); |
3060 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3060 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
3061 | 3061 |
3062 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 3062 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3767 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3768 ZoneList<Expression*>* args = expr->arguments(); | 3768 ZoneList<Expression*>* args = expr->arguments(); |
3769 DCHECK(args->length() == 2); | 3769 DCHECK(args->length() == 2); |
3770 | 3770 |
3771 // Evaluate new.target and super constructor. | 3771 // Evaluate new.target and super constructor. |
3772 VisitForStackValue(args->at(0)); | 3772 VisitForStackValue(args->at(0)); |
3773 VisitForStackValue(args->at(1)); | 3773 VisitForStackValue(args->at(1)); |
3774 | 3774 |
3775 // Call the construct call builtin that handles allocation and | 3775 // Call the construct call builtin that handles allocation and |
3776 // constructor invocation. | 3776 // constructor invocation. |
3777 SetConstructCallPosition(expr, 0); | 3777 SetConstructCallPosition(expr); |
3778 | 3778 |
3779 // Load new target into r3. | 3779 // Load new target into r3. |
3780 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); | 3780 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); |
3781 | 3781 |
3782 // Check if the calling frame is an arguments adaptor frame. | 3782 // Check if the calling frame is an arguments adaptor frame. |
3783 Label adaptor_frame, args_set_up, runtime; | 3783 Label adaptor_frame, args_set_up, runtime; |
3784 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3784 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
3785 __ ldr(r4, MemOperand(r2, StandardFrameConstants::kContextOffset)); | 3785 __ ldr(r4, MemOperand(r2, StandardFrameConstants::kContextOffset)); |
3786 __ cmp(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 3786 __ cmp(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
3787 __ b(eq, &adaptor_frame); | 3787 __ b(eq, &adaptor_frame); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4138 __ push(r0); | 4138 __ push(r0); |
4139 | 4139 |
4140 __ LoadNativeContextSlot(expr->context_index(), r0); | 4140 __ LoadNativeContextSlot(expr->context_index(), r0); |
4141 } | 4141 } |
4142 | 4142 |
4143 | 4143 |
4144 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4144 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4145 ZoneList<Expression*>* args = expr->arguments(); | 4145 ZoneList<Expression*>* args = expr->arguments(); |
4146 int arg_count = args->length(); | 4146 int arg_count = args->length(); |
4147 | 4147 |
4148 SetCallPosition(expr, arg_count); | 4148 SetCallPosition(expr); |
4149 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4149 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4150 __ mov(r0, Operand(arg_count)); | 4150 __ mov(r0, Operand(arg_count)); |
4151 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 4151 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
4152 RelocInfo::CODE_TARGET); | 4152 RelocInfo::CODE_TARGET); |
4153 } | 4153 } |
4154 | 4154 |
4155 | 4155 |
4156 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4156 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4157 ZoneList<Expression*>* args = expr->arguments(); | 4157 ZoneList<Expression*>* args = expr->arguments(); |
4158 int arg_count = args->length(); | 4158 int arg_count = args->length(); |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5001 DCHECK(interrupt_address == | 5001 DCHECK(interrupt_address == |
5002 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5002 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5003 return OSR_AFTER_STACK_CHECK; | 5003 return OSR_AFTER_STACK_CHECK; |
5004 } | 5004 } |
5005 | 5005 |
5006 | 5006 |
5007 } // namespace internal | 5007 } // namespace internal |
5008 } // namespace v8 | 5008 } // namespace v8 |
5009 | 5009 |
5010 #endif // V8_TARGET_ARCH_ARM | 5010 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |