| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 } | 2282 } |
| 2283 __ mov(r2, Operand(name)); | 2283 __ mov(r2, Operand(name)); |
| 2284 } | 2284 } |
| 2285 // Record source position for debugger. | 2285 // Record source position for debugger. |
| 2286 SetSourcePosition(expr->position()); | 2286 SetSourcePosition(expr->position()); |
| 2287 // Call the IC initialization code. | 2287 // Call the IC initialization code. |
| 2288 Handle<Code> ic = | 2288 Handle<Code> ic = |
| 2289 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); | 2289 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); |
| 2290 CallIC(ic, mode, expr->CallFeedbackId()); | 2290 CallIC(ic, mode, expr->CallFeedbackId()); |
| 2291 RecordJSReturnSite(expr); | 2291 RecordJSReturnSite(expr); |
| 2292 // Restore context register. | 2292 __ ReloadContextFromFrame(); |
| 2293 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
| 2294 context()->Plug(r0); | 2293 context()->Plug(r0); |
| 2295 } | 2294 } |
| 2296 | 2295 |
| 2297 | 2296 |
| 2298 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, | 2297 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
| 2299 Expression* key) { | 2298 Expression* key) { |
| 2300 // Load the key. | 2299 // Load the key. |
| 2301 VisitForAccumulatorValue(key); | 2300 VisitForAccumulatorValue(key); |
| 2302 | 2301 |
| 2303 // Swap the name of the function and the receiver on the stack to follow | 2302 // Swap the name of the function and the receiver on the stack to follow |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2315 } | 2314 } |
| 2316 } | 2315 } |
| 2317 // Record source position for debugger. | 2316 // Record source position for debugger. |
| 2318 SetSourcePosition(expr->position()); | 2317 SetSourcePosition(expr->position()); |
| 2319 // Call the IC initialization code. | 2318 // Call the IC initialization code. |
| 2320 Handle<Code> ic = | 2319 Handle<Code> ic = |
| 2321 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); | 2320 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
| 2322 __ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. | 2321 __ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. |
| 2323 CallIC(ic, RelocInfo::CODE_TARGET, expr->CallFeedbackId()); | 2322 CallIC(ic, RelocInfo::CODE_TARGET, expr->CallFeedbackId()); |
| 2324 RecordJSReturnSite(expr); | 2323 RecordJSReturnSite(expr); |
| 2325 // Restore context register. | 2324 __ ReloadContextFromFrame(); |
| 2326 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
| 2327 context()->DropAndPlug(1, r0); // Drop the key still on the stack. | 2325 context()->DropAndPlug(1, r0); // Drop the key still on the stack. |
| 2328 } | 2326 } |
| 2329 | 2327 |
| 2330 | 2328 |
| 2331 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { | 2329 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
| 2332 // Code common for calls using the call stub. | 2330 // Code common for calls using the call stub. |
| 2333 ZoneList<Expression*>* args = expr->arguments(); | 2331 ZoneList<Expression*>* args = expr->arguments(); |
| 2334 int arg_count = args->length(); | 2332 int arg_count = args->length(); |
| 2335 { PreservePositionScope scope(masm()->positions_recorder()); | 2333 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2336 for (int i = 0; i < arg_count; i++) { | 2334 for (int i = 0; i < arg_count; i++) { |
| 2337 VisitForStackValue(args->at(i)); | 2335 VisitForStackValue(args->at(i)); |
| 2338 } | 2336 } |
| 2339 } | 2337 } |
| 2340 // Record source position for debugger. | 2338 // Record source position for debugger. |
| 2341 SetSourcePosition(expr->position()); | 2339 SetSourcePosition(expr->position()); |
| 2342 | 2340 |
| 2343 // Record call targets in unoptimized code. | 2341 // Record call targets in unoptimized code. |
| 2344 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); | 2342 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
| 2345 Handle<Object> uninitialized = | 2343 Handle<Object> uninitialized = |
| 2346 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2344 TypeFeedbackCells::UninitializedSentinel(isolate()); |
| 2347 Handle<JSGlobalPropertyCell> cell = | 2345 Handle<JSGlobalPropertyCell> cell = |
| 2348 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | 2346 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
| 2349 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2347 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
| 2350 __ mov(r2, Operand(cell)); | 2348 __ mov(r2, Operand(cell)); |
| 2351 | 2349 |
| 2352 CallFunctionStub stub(arg_count, flags); | 2350 CallFunctionStub stub(arg_count, flags); |
| 2353 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2351 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2354 __ CallStub(&stub, expr->CallFeedbackId()); | 2352 __ CallStub(&stub, expr->CallFeedbackId()); |
| 2355 RecordJSReturnSite(expr); | 2353 RecordJSReturnSite(expr); |
| 2356 // Restore context register. | 2354 __ ReloadContextFromFrame(); |
| 2357 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
| 2358 context()->DropAndPlug(1, r0); | 2355 context()->DropAndPlug(1, r0); |
| 2359 } | 2356 } |
| 2360 | 2357 |
| 2361 | 2358 |
| 2362 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2359 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
| 2363 // Push copy of the first argument or undefined if it doesn't exist. | 2360 // Push copy of the first argument or undefined if it doesn't exist. |
| 2364 if (arg_count > 0) { | 2361 if (arg_count > 0) { |
| 2365 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 2362 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 2366 } else { | 2363 } else { |
| 2367 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 2364 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2423 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2427 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); | 2424 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 2428 } | 2425 } |
| 2429 | 2426 |
| 2430 // Record source position for debugger. | 2427 // Record source position for debugger. |
| 2431 SetSourcePosition(expr->position()); | 2428 SetSourcePosition(expr->position()); |
| 2432 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); | 2429 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); |
| 2433 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2430 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2434 __ CallStub(&stub); | 2431 __ CallStub(&stub); |
| 2435 RecordJSReturnSite(expr); | 2432 RecordJSReturnSite(expr); |
| 2436 // Restore context register. | 2433 __ ReloadContextFromFrame(); |
| 2437 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
| 2438 context()->DropAndPlug(1, r0); | 2434 context()->DropAndPlug(1, r0); |
| 2439 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { | 2435 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 2440 // Push global object as receiver for the call IC. | 2436 // Push global object as receiver for the call IC. |
| 2441 __ ldr(r0, GlobalObjectOperand()); | 2437 __ ldr(r0, GlobalObjectOperand()); |
| 2442 __ push(r0); | 2438 __ push(r0); |
| 2443 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); | 2439 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); |
| 2444 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 2440 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 2445 // Call to a lookup slot (dynamically introduced variable). | 2441 // Call to a lookup slot (dynamically introduced variable). |
| 2446 Label slow, done; | 2442 Label slow, done; |
| 2447 | 2443 |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3447 // Check for non-function argument (including proxy). | 3443 // Check for non-function argument (including proxy). |
| 3448 __ JumpIfSmi(r0, &runtime); | 3444 __ JumpIfSmi(r0, &runtime); |
| 3449 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | 3445 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); |
| 3450 __ b(ne, &runtime); | 3446 __ b(ne, &runtime); |
| 3451 | 3447 |
| 3452 // InvokeFunction requires the function in r1. Move it in there. | 3448 // InvokeFunction requires the function in r1. Move it in there. |
| 3453 __ mov(r1, result_register()); | 3449 __ mov(r1, result_register()); |
| 3454 ParameterCount count(arg_count); | 3450 ParameterCount count(arg_count); |
| 3455 __ InvokeFunction(r1, count, CALL_FUNCTION, | 3451 __ InvokeFunction(r1, count, CALL_FUNCTION, |
| 3456 NullCallWrapper(), CALL_AS_METHOD); | 3452 NullCallWrapper(), CALL_AS_METHOD); |
| 3457 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3453 __ ReloadContextFromFrame(); |
| 3458 __ jmp(&done); | 3454 __ jmp(&done); |
| 3459 | 3455 |
| 3460 __ bind(&runtime); | 3456 __ bind(&runtime); |
| 3461 __ push(r0); | 3457 __ push(r0); |
| 3462 __ CallRuntime(Runtime::kCall, args->length()); | 3458 __ CallRuntime(Runtime::kCall, args->length()); |
| 3463 __ bind(&done); | 3459 __ bind(&done); |
| 3464 | 3460 |
| 3465 context()->Plug(r0); | 3461 context()->Plug(r0); |
| 3466 } | 3462 } |
| 3467 | 3463 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3865 VisitForStackValue(args->at(i)); | 3861 VisitForStackValue(args->at(i)); |
| 3866 } | 3862 } |
| 3867 | 3863 |
| 3868 if (expr->is_jsruntime()) { | 3864 if (expr->is_jsruntime()) { |
| 3869 // Call the JS runtime function. | 3865 // Call the JS runtime function. |
| 3870 __ mov(r2, Operand(expr->name())); | 3866 __ mov(r2, Operand(expr->name())); |
| 3871 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | 3867 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; |
| 3872 Handle<Code> ic = | 3868 Handle<Code> ic = |
| 3873 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); | 3869 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); |
| 3874 CallIC(ic, mode, expr->CallRuntimeFeedbackId()); | 3870 CallIC(ic, mode, expr->CallRuntimeFeedbackId()); |
| 3875 // Restore context register. | 3871 __ ReloadContextFromFrame(); |
| 3876 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
| 3877 } else { | 3872 } else { |
| 3878 // Call the C runtime function. | 3873 // Call the C runtime function. |
| 3879 __ CallRuntime(expr->function(), arg_count); | 3874 __ CallRuntime(expr->function(), arg_count); |
| 3880 } | 3875 } |
| 3881 context()->Plug(r0); | 3876 context()->Plug(r0); |
| 3882 } | 3877 } |
| 3883 | 3878 |
| 3884 | 3879 |
| 3885 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3880 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 3886 switch (expr->op()) { | 3881 switch (expr->op()) { |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4580 *context_length = 0; | 4575 *context_length = 0; |
| 4581 return previous_; | 4576 return previous_; |
| 4582 } | 4577 } |
| 4583 | 4578 |
| 4584 | 4579 |
| 4585 #undef __ | 4580 #undef __ |
| 4586 | 4581 |
| 4587 } } // namespace v8::internal | 4582 } } // namespace v8::internal |
| 4588 | 4583 |
| 4589 #endif // V8_TARGET_ARCH_ARM | 4584 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |