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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 | 2957 |
2958 // r1: the start position of the scope the calls resides in. | 2958 // r1: the start position of the scope the calls resides in. |
2959 __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); | 2959 __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); |
2960 | 2960 |
2961 // Do the runtime call. | 2961 // Do the runtime call. |
2962 __ Push(r4, r3, r2, r1); | 2962 __ Push(r4, r3, r2, r1); |
2963 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2963 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
2964 } | 2964 } |
2965 | 2965 |
2966 | 2966 |
2967 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* expr) { | |
2968 DCHECK(super_ref != NULL); | |
2969 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
2970 __ Push(r0); | |
2971 __ CallRuntime(Runtime::kGetPrototype, 1); | |
2972 } | |
2973 | |
2974 | |
2975 void FullCodeGenerator::VisitCall(Call* expr) { | 2967 void FullCodeGenerator::VisitCall(Call* expr) { |
2976 #ifdef DEBUG | 2968 #ifdef DEBUG |
2977 // We want to verify that RecordJSReturnSite gets called on all paths | 2969 // We want to verify that RecordJSReturnSite gets called on all paths |
2978 // through this function. Avoid early returns. | 2970 // through this function. Avoid early returns. |
2979 expr->return_is_recorded_ = false; | 2971 expr->return_is_recorded_ = false; |
2980 #endif | 2972 #endif |
2981 | 2973 |
2982 Comment cmnt(masm_, "[ Call"); | 2974 Comment cmnt(masm_, "[ Call"); |
2983 Expression* callee = expr->expression(); | 2975 Expression* callee = expr->expression(); |
2984 Call::CallType call_type = expr->GetCallType(isolate()); | 2976 Call::CallType call_type = expr->GetCallType(isolate()); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3082 VisitForStackValue(property->obj()); | 3074 VisitForStackValue(property->obj()); |
3083 } | 3075 } |
3084 if (is_named_call) { | 3076 if (is_named_call) { |
3085 EmitCallWithLoadIC(expr); | 3077 EmitCallWithLoadIC(expr); |
3086 } else { | 3078 } else { |
3087 EmitKeyedCallWithLoadIC(expr, property->key()); | 3079 EmitKeyedCallWithLoadIC(expr, property->key()); |
3088 } | 3080 } |
3089 } | 3081 } |
3090 } else if (call_type == Call::SUPER_CALL) { | 3082 } else if (call_type == Call::SUPER_CALL) { |
3091 SuperReference* super_ref = callee->AsSuperReference(); | 3083 SuperReference* super_ref = callee->AsSuperReference(); |
3092 EmitLoadSuperConstructor(super_ref); | 3084 DCHECK(super_ref != NULL); |
| 3085 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3086 __ Push(r0); |
| 3087 __ CallRuntime(Runtime::kGetPrototype, 1); |
3093 __ Push(result_register()); | 3088 __ Push(result_register()); |
3094 VisitForStackValue(super_ref->this_var()); | 3089 VisitForStackValue(super_ref->this_var()); |
3095 EmitCall(expr, CallICState::METHOD); | 3090 EmitCall(expr, CallICState::METHOD); |
3096 } else { | 3091 } else { |
3097 DCHECK(call_type == Call::OTHER_CALL); | 3092 DCHECK(call_type == Call::OTHER_CALL); |
3098 // Call to an arbitrary expression not handled specially above. | 3093 // Call to an arbitrary expression not handled specially above. |
3099 { PreservePositionScope scope(masm()->positions_recorder()); | 3094 { PreservePositionScope scope(masm()->positions_recorder()); |
3100 VisitForStackValue(callee); | 3095 VisitForStackValue(callee); |
3101 } | 3096 } |
3102 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 3097 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
(...skipping 11 matching lines...) Expand all Loading... |
3114 | 3109 |
3115 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 3110 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
3116 Comment cmnt(masm_, "[ CallNew"); | 3111 Comment cmnt(masm_, "[ CallNew"); |
3117 // According to ECMA-262, section 11.2.2, page 44, the function | 3112 // According to ECMA-262, section 11.2.2, page 44, the function |
3118 // expression in new calls must be evaluated before the | 3113 // expression in new calls must be evaluated before the |
3119 // arguments. | 3114 // arguments. |
3120 | 3115 |
3121 // Push constructor on the stack. If it's not a function it's used as | 3116 // Push constructor on the stack. If it's not a function it's used as |
3122 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is | 3117 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
3123 // ignored. | 3118 // ignored. |
3124 if (expr->expression()->IsSuperReference()) { | 3119 VisitForStackValue(expr->expression()); |
3125 EmitLoadSuperConstructor(expr->expression()->AsSuperReference()); | |
3126 __ Push(result_register()); | |
3127 } else { | |
3128 VisitForStackValue(expr->expression()); | |
3129 } | |
3130 | 3120 |
3131 // Push the arguments ("left-to-right") on the stack. | 3121 // Push the arguments ("left-to-right") on the stack. |
3132 ZoneList<Expression*>* args = expr->arguments(); | 3122 ZoneList<Expression*>* args = expr->arguments(); |
3133 int arg_count = args->length(); | 3123 int arg_count = args->length(); |
3134 for (int i = 0; i < arg_count; i++) { | 3124 for (int i = 0; i < arg_count; i++) { |
3135 VisitForStackValue(args->at(i)); | 3125 VisitForStackValue(args->at(i)); |
3136 } | 3126 } |
3137 | 3127 |
3138 // Call the construct call builtin that handles allocation and | 3128 // Call the construct call builtin that handles allocation and |
3139 // constructor invocation. | 3129 // constructor invocation. |
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5275 | 5265 |
5276 DCHECK(interrupt_address == | 5266 DCHECK(interrupt_address == |
5277 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5267 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5278 return OSR_AFTER_STACK_CHECK; | 5268 return OSR_AFTER_STACK_CHECK; |
5279 } | 5269 } |
5280 | 5270 |
5281 | 5271 |
5282 } } // namespace v8::internal | 5272 } } // namespace v8::internal |
5283 | 5273 |
5284 #endif // V8_TARGET_ARCH_ARM | 5274 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |