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 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 // result = receiver[f](arg); | 2262 // result = receiver[f](arg); |
2263 __ bind(&l_call); | 2263 __ bind(&l_call); |
2264 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); | 2264 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); |
2265 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); | 2265 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); |
2266 __ mov(LoadDescriptor::SlotRegister(), | 2266 __ mov(LoadDescriptor::SlotRegister(), |
2267 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2267 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2268 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2268 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2269 CallIC(ic, TypeFeedbackId::None()); | 2269 CallIC(ic, TypeFeedbackId::None()); |
2270 __ mov(r1, r0); | 2270 __ mov(r1, r0); |
2271 __ str(r1, MemOperand(sp, 2 * kPointerSize)); | 2271 __ str(r1, MemOperand(sp, 2 * kPointerSize)); |
| 2272 SetCallPosition(expr, 1); |
2272 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2273 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2273 __ CallStub(&stub); | 2274 __ CallStub(&stub); |
2274 | 2275 |
2275 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2276 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2276 __ Drop(1); // The function is still on the stack; drop it. | 2277 __ Drop(1); // The function is still on the stack; drop it. |
2277 | 2278 |
2278 // if (!result.done) goto l_try; | 2279 // if (!result.done) goto l_try; |
2279 __ bind(&l_loop); | 2280 __ bind(&l_loop); |
2280 __ Move(load_receiver, r0); | 2281 __ Move(load_receiver, r0); |
2281 | 2282 |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 | 3097 |
3097 | 3098 |
3098 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 3099 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
3099 // Load the arguments. | 3100 // Load the arguments. |
3100 ZoneList<Expression*>* args = expr->arguments(); | 3101 ZoneList<Expression*>* args = expr->arguments(); |
3101 int arg_count = args->length(); | 3102 int arg_count = args->length(); |
3102 for (int i = 0; i < arg_count; i++) { | 3103 for (int i = 0; i < arg_count; i++) { |
3103 VisitForStackValue(args->at(i)); | 3104 VisitForStackValue(args->at(i)); |
3104 } | 3105 } |
3105 | 3106 |
3106 SetExpressionPosition(expr); | 3107 SetCallPosition(expr, arg_count); |
3107 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 3108 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
3108 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 3109 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
3109 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3110 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3110 // Don't assign a type feedback id to the IC, since type feedback is provided | 3111 // Don't assign a type feedback id to the IC, since type feedback is provided |
3111 // by the vector above. | 3112 // by the vector above. |
3112 CallIC(ic); | 3113 CallIC(ic); |
3113 | 3114 |
3114 RecordJSReturnSite(expr); | 3115 RecordJSReturnSite(expr); |
3115 // Restore context register. | 3116 // Restore context register. |
3116 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3117 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3231 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3232 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3232 __ push(r1); | 3233 __ push(r1); |
3233 EmitResolvePossiblyDirectEval(arg_count); | 3234 EmitResolvePossiblyDirectEval(arg_count); |
3234 | 3235 |
3235 // Touch up the stack with the resolved function. | 3236 // Touch up the stack with the resolved function. |
3236 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3237 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3237 | 3238 |
3238 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 3239 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
3239 | 3240 |
3240 // Record source position for debugger. | 3241 // Record source position for debugger. |
3241 SetExpressionPosition(expr); | 3242 SetCallPosition(expr, arg_count); |
3242 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 3243 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
3243 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3244 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3244 __ CallStub(&stub); | 3245 __ CallStub(&stub); |
3245 RecordJSReturnSite(expr); | 3246 RecordJSReturnSite(expr); |
3246 // Restore context register. | 3247 // Restore context register. |
3247 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3248 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3248 context()->DropAndPlug(1, r0); | 3249 context()->DropAndPlug(1, r0); |
3249 } else if (call_type == Call::GLOBAL_CALL) { | 3250 } else if (call_type == Call::GLOBAL_CALL) { |
3250 EmitCallWithLoadIC(expr); | 3251 EmitCallWithLoadIC(expr); |
3251 | 3252 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3303 | 3304 |
3304 // Push the arguments ("left-to-right") on the stack. | 3305 // Push the arguments ("left-to-right") on the stack. |
3305 ZoneList<Expression*>* args = expr->arguments(); | 3306 ZoneList<Expression*>* args = expr->arguments(); |
3306 int arg_count = args->length(); | 3307 int arg_count = args->length(); |
3307 for (int i = 0; i < arg_count; i++) { | 3308 for (int i = 0; i < arg_count; i++) { |
3308 VisitForStackValue(args->at(i)); | 3309 VisitForStackValue(args->at(i)); |
3309 } | 3310 } |
3310 | 3311 |
3311 // Call the construct call builtin that handles allocation and | 3312 // Call the construct call builtin that handles allocation and |
3312 // constructor invocation. | 3313 // constructor invocation. |
3313 SetExpressionPosition(expr); | 3314 SetConstructCallPosition(expr); |
3314 | 3315 |
3315 // Load function and argument count into r1 and r0. | 3316 // Load function and argument count into r1 and r0. |
3316 __ mov(r0, Operand(arg_count)); | 3317 __ mov(r0, Operand(arg_count)); |
3317 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3318 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
3318 | 3319 |
3319 // Record call targets in unoptimized code. | 3320 // Record call targets in unoptimized code. |
3320 if (FLAG_pretenuring_call_new) { | 3321 if (FLAG_pretenuring_call_new) { |
3321 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3322 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
3322 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3323 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
3323 expr->CallNewFeedbackSlot().ToInt() + 1); | 3324 expr->CallNewFeedbackSlot().ToInt() + 1); |
(...skipping 22 matching lines...) Expand all Loading... |
3346 | 3347 |
3347 // Push the arguments ("left-to-right") on the stack. | 3348 // Push the arguments ("left-to-right") on the stack. |
3348 ZoneList<Expression*>* args = expr->arguments(); | 3349 ZoneList<Expression*>* args = expr->arguments(); |
3349 int arg_count = args->length(); | 3350 int arg_count = args->length(); |
3350 for (int i = 0; i < arg_count; i++) { | 3351 for (int i = 0; i < arg_count; i++) { |
3351 VisitForStackValue(args->at(i)); | 3352 VisitForStackValue(args->at(i)); |
3352 } | 3353 } |
3353 | 3354 |
3354 // Call the construct call builtin that handles allocation and | 3355 // Call the construct call builtin that handles allocation and |
3355 // constructor invocation. | 3356 // constructor invocation. |
3356 SetExpressionPosition(expr); | 3357 SetConstructCallPosition(expr); |
3357 | 3358 |
3358 // Load function and argument count into r1 and r0. | 3359 // Load function and argument count into r1 and r0. |
3359 __ mov(r0, Operand(arg_count)); | 3360 __ mov(r0, Operand(arg_count)); |
3360 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3361 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
3361 | 3362 |
3362 // Record call targets in unoptimized code. | 3363 // Record call targets in unoptimized code. |
3363 if (FLAG_pretenuring_call_new) { | 3364 if (FLAG_pretenuring_call_new) { |
3364 UNREACHABLE(); | 3365 UNREACHABLE(); |
3365 /* TODO(dslomov): support pretenuring. | 3366 /* TODO(dslomov): support pretenuring. |
3366 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3367 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4725 __ mov(LoadDescriptor::SlotRegister(), | 4726 __ mov(LoadDescriptor::SlotRegister(), |
4726 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4727 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4727 CallLoadIC(NOT_CONTEXTUAL); | 4728 CallLoadIC(NOT_CONTEXTUAL); |
4728 } | 4729 } |
4729 | 4730 |
4730 | 4731 |
4731 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4732 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4732 ZoneList<Expression*>* args = expr->arguments(); | 4733 ZoneList<Expression*>* args = expr->arguments(); |
4733 int arg_count = args->length(); | 4734 int arg_count = args->length(); |
4734 | 4735 |
4735 SetExpressionPosition(expr); | 4736 SetCallPosition(expr, arg_count); |
4736 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4737 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4737 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4738 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4738 __ CallStub(&stub); | 4739 __ CallStub(&stub); |
4739 } | 4740 } |
4740 | 4741 |
4741 | 4742 |
4742 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4743 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4743 ZoneList<Expression*>* args = expr->arguments(); | 4744 ZoneList<Expression*>* args = expr->arguments(); |
4744 int arg_count = args->length(); | 4745 int arg_count = args->length(); |
4745 | 4746 |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5591 DCHECK(interrupt_address == | 5592 DCHECK(interrupt_address == |
5592 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5593 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5593 return OSR_AFTER_STACK_CHECK; | 5594 return OSR_AFTER_STACK_CHECK; |
5594 } | 5595 } |
5595 | 5596 |
5596 | 5597 |
5597 } // namespace internal | 5598 } // namespace internal |
5598 } // namespace v8 | 5599 } // namespace v8 |
5599 | 5600 |
5600 #endif // V8_TARGET_ARCH_ARM | 5601 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |