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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2950 | 2950 |
2951 | 2951 |
2952 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2952 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
2953 // Load the arguments. | 2953 // Load the arguments. |
2954 ZoneList<Expression*>* args = expr->arguments(); | 2954 ZoneList<Expression*>* args = expr->arguments(); |
2955 int arg_count = args->length(); | 2955 int arg_count = args->length(); |
2956 for (int i = 0; i < arg_count; i++) { | 2956 for (int i = 0; i < arg_count; i++) { |
2957 VisitForStackValue(args->at(i)); | 2957 VisitForStackValue(args->at(i)); |
2958 } | 2958 } |
2959 | 2959 |
| 2960 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
2960 SetCallPosition(expr, arg_count); | 2961 SetCallPosition(expr, arg_count); |
2961 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2962 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
2962 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2963 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
2963 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2964 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2964 // Don't assign a type feedback id to the IC, since type feedback is provided | 2965 // Don't assign a type feedback id to the IC, since type feedback is provided |
2965 // by the vector above. | 2966 // by the vector above. |
2966 CallIC(ic); | 2967 CallIC(ic); |
2967 | 2968 |
2968 RecordJSReturnSite(expr); | 2969 RecordJSReturnSite(expr); |
2969 // Restore context register. | 2970 // Restore context register. |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3891 } | 3892 } |
3892 | 3893 |
3893 | 3894 |
3894 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3895 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
3895 ZoneList<Expression*>* args = expr->arguments(); | 3896 ZoneList<Expression*>* args = expr->arguments(); |
3896 DCHECK_LE(2, args->length()); | 3897 DCHECK_LE(2, args->length()); |
3897 // Push target, receiver and arguments onto the stack. | 3898 // Push target, receiver and arguments onto the stack. |
3898 for (Expression* const arg : *args) { | 3899 for (Expression* const arg : *args) { |
3899 VisitForStackValue(arg); | 3900 VisitForStackValue(arg); |
3900 } | 3901 } |
| 3902 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
3901 // Move target to r1. | 3903 // Move target to r1. |
3902 int const argc = args->length() - 2; | 3904 int const argc = args->length() - 2; |
3903 __ ldr(r1, MemOperand(sp, (argc + 1) * kPointerSize)); | 3905 __ ldr(r1, MemOperand(sp, (argc + 1) * kPointerSize)); |
3904 // Call the target. | 3906 // Call the target. |
3905 __ mov(r0, Operand(argc)); | 3907 __ mov(r0, Operand(argc)); |
3906 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3908 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3907 // Restore context register. | 3909 // Restore context register. |
3908 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3910 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3909 // Discard the function left on TOS. | 3911 // Discard the function left on TOS. |
3910 context()->DropAndPlug(1, r0); | 3912 context()->DropAndPlug(1, r0); |
3911 } | 3913 } |
3912 | 3914 |
3913 | 3915 |
3914 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3916 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3915 ZoneList<Expression*>* args = expr->arguments(); | 3917 ZoneList<Expression*>* args = expr->arguments(); |
3916 DCHECK(args->length() >= 2); | 3918 DCHECK(args->length() >= 2); |
3917 | 3919 |
3918 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3920 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3919 for (int i = 0; i < arg_count + 1; i++) { | 3921 for (int i = 0; i < arg_count + 1; i++) { |
3920 VisitForStackValue(args->at(i)); | 3922 VisitForStackValue(args->at(i)); |
3921 } | 3923 } |
3922 VisitForAccumulatorValue(args->last()); // Function. | 3924 VisitForAccumulatorValue(args->last()); // Function. |
3923 | 3925 |
| 3926 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
3924 Label runtime, done; | 3927 Label runtime, done; |
3925 // Check for non-function argument (including proxy). | 3928 // Check for non-function argument (including proxy). |
3926 __ JumpIfSmi(r0, &runtime); | 3929 __ JumpIfSmi(r0, &runtime); |
3927 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | 3930 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); |
3928 __ b(ne, &runtime); | 3931 __ b(ne, &runtime); |
3929 | 3932 |
3930 // InvokeFunction requires the function in r1. Move it in there. | 3933 // InvokeFunction requires the function in r1. Move it in there. |
3931 __ mov(r1, result_register()); | 3934 __ mov(r1, result_register()); |
3932 ParameterCount count(arg_count); | 3935 ParameterCount count(arg_count); |
3933 __ InvokeFunction(r1, count, CALL_FUNCTION, NullCallWrapper()); | 3936 __ InvokeFunction(r1, count, CALL_FUNCTION, NullCallWrapper()); |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5187 DCHECK(interrupt_address == | 5190 DCHECK(interrupt_address == |
5188 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5191 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5189 return OSR_AFTER_STACK_CHECK; | 5192 return OSR_AFTER_STACK_CHECK; |
5190 } | 5193 } |
5191 | 5194 |
5192 | 5195 |
5193 } // namespace internal | 5196 } // namespace internal |
5194 } // namespace v8 | 5197 } // namespace v8 |
5195 | 5198 |
5196 #endif // V8_TARGET_ARCH_ARM | 5199 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |