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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 break; | 1348 break; |
1349 } | 1349 } |
1350 | 1350 |
1351 case VariableLocation::LOOKUP: { | 1351 case VariableLocation::LOOKUP: { |
1352 Comment cmnt(masm_, "[ Lookup variable"); | 1352 Comment cmnt(masm_, "[ Lookup variable"); |
1353 Label done, slow; | 1353 Label done, slow; |
1354 // Generate code for loading from variables potentially shadowed | 1354 // Generate code for loading from variables potentially shadowed |
1355 // by eval-introduced variables. | 1355 // by eval-introduced variables. |
1356 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done); | 1356 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done); |
1357 __ bind(&slow); | 1357 __ bind(&slow); |
1358 __ push(esi); // Context. | |
1359 __ push(Immediate(var->name())); | 1358 __ push(Immediate(var->name())); |
1360 Runtime::FunctionId function_id = | 1359 Runtime::FunctionId function_id = |
1361 typeof_mode == NOT_INSIDE_TYPEOF | 1360 typeof_mode == NOT_INSIDE_TYPEOF |
1362 ? Runtime::kLoadLookupSlot | 1361 ? Runtime::kLoadLookupSlot |
1363 : Runtime::kLoadLookupSlotNoReferenceError; | 1362 : Runtime::kLoadLookupSlotInsideTypeof; |
1364 __ CallRuntime(function_id); | 1363 __ CallRuntime(function_id); |
1365 __ bind(&done); | 1364 __ bind(&done); |
1366 context()->Plug(eax); | 1365 context()->Plug(eax); |
1367 break; | 1366 break; |
1368 } | 1367 } |
1369 } | 1368 } |
1370 } | 1369 } |
1371 | 1370 |
1372 | 1371 |
1373 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1372 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 __ j(equal, &uninitialized_this); | 2341 __ j(equal, &uninitialized_this); |
2343 __ push(Immediate(var->name())); | 2342 __ push(Immediate(var->name())); |
2344 __ CallRuntime(Runtime::kThrowReferenceError); | 2343 __ CallRuntime(Runtime::kThrowReferenceError); |
2345 __ bind(&uninitialized_this); | 2344 __ bind(&uninitialized_this); |
2346 EmitStoreToStackLocalOrContextSlot(var, location); | 2345 EmitStoreToStackLocalOrContextSlot(var, location); |
2347 | 2346 |
2348 } else if (!var->is_const_mode() || | 2347 } else if (!var->is_const_mode() || |
2349 (var->mode() == CONST && op == Token::INIT)) { | 2348 (var->mode() == CONST && op == Token::INIT)) { |
2350 if (var->IsLookupSlot()) { | 2349 if (var->IsLookupSlot()) { |
2351 // Assignment to var. | 2350 // Assignment to var. |
2352 __ push(eax); // Value. | 2351 __ Push(Immediate(var->name())); |
2353 __ push(esi); // Context. | 2352 __ Push(eax); |
2354 __ push(Immediate(var->name())); | 2353 __ CallRuntime(is_strict(language_mode()) |
2355 __ push(Immediate(Smi::FromInt(language_mode()))); | 2354 ? Runtime::kStoreLookupSlot_Strict |
2356 __ CallRuntime(Runtime::kStoreLookupSlot); | 2355 : Runtime::kStoreLookupSlot_Sloppy); |
2357 } else { | 2356 } else { |
2358 // Assignment to var or initializing assignment to let/const in harmony | 2357 // Assignment to var or initializing assignment to let/const in harmony |
2359 // mode. | 2358 // mode. |
2360 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2359 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2361 MemOperand location = VarOperand(var, ecx); | 2360 MemOperand location = VarOperand(var, ecx); |
2362 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { | 2361 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { |
2363 // Check for an uninitialized let binding. | 2362 // Check for an uninitialized let binding. |
2364 __ mov(edx, location); | 2363 __ mov(edx, location); |
2365 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2364 __ cmp(edx, isolate()->factory()->the_hole_value()); |
2366 __ Check(equal, kLetBindingReInitialization); | 2365 __ Check(equal, kLetBindingReInitialization); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 if (callee->var()->IsLookupSlot()) { | 2685 if (callee->var()->IsLookupSlot()) { |
2687 Label slow, done; | 2686 Label slow, done; |
2688 SetExpressionPosition(callee); | 2687 SetExpressionPosition(callee); |
2689 // Generate code for loading from variables potentially shadowed by | 2688 // Generate code for loading from variables potentially shadowed by |
2690 // eval-introduced variables. | 2689 // eval-introduced variables. |
2691 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); | 2690 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); |
2692 | 2691 |
2693 __ bind(&slow); | 2692 __ bind(&slow); |
2694 // Call the runtime to find the function to call (returned in eax) and | 2693 // Call the runtime to find the function to call (returned in eax) and |
2695 // the object holding it (returned in edx). | 2694 // the object holding it (returned in edx). |
2696 __ push(context_register()); | 2695 __ Push(callee->name()); |
2697 __ push(Immediate(callee->name())); | 2696 __ CallRuntime(Runtime::kLoadLookupSlotForCall); |
2698 __ CallRuntime(Runtime::kLoadLookupSlot); | 2697 __ Push(eax); // Function. |
2699 __ push(eax); // Function. | 2698 __ Push(edx); // Receiver. |
2700 __ push(edx); // Receiver. | |
2701 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); | 2699 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); |
2702 | 2700 |
2703 // If fast case code has been generated, emit code to push the function | 2701 // If fast case code has been generated, emit code to push the function |
2704 // and receiver and have the slow path jump around this code. | 2702 // and receiver and have the slow path jump around this code. |
2705 if (done.is_linked()) { | 2703 if (done.is_linked()) { |
2706 Label call; | 2704 Label call; |
2707 __ jmp(&call, Label::kNear); | 2705 __ jmp(&call, Label::kNear); |
2708 __ bind(&done); | 2706 __ bind(&done); |
2709 // Push function. | 2707 // Push function. |
2710 __ push(eax); | 2708 __ push(eax); |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3847 __ CallRuntime(Runtime::kDeleteProperty_Sloppy); | 3845 __ CallRuntime(Runtime::kDeleteProperty_Sloppy); |
3848 context()->Plug(eax); | 3846 context()->Plug(eax); |
3849 } else if (var->IsStackAllocated() || var->IsContextSlot()) { | 3847 } else if (var->IsStackAllocated() || var->IsContextSlot()) { |
3850 // Result of deleting non-global variables is false. 'this' is | 3848 // Result of deleting non-global variables is false. 'this' is |
3851 // not really a variable, though we implement it as one. The | 3849 // not really a variable, though we implement it as one. The |
3852 // subexpression does not have side effects. | 3850 // subexpression does not have side effects. |
3853 context()->Plug(is_this); | 3851 context()->Plug(is_this); |
3854 } else { | 3852 } else { |
3855 // Non-global variable. Call the runtime to try to delete from the | 3853 // Non-global variable. Call the runtime to try to delete from the |
3856 // context where the variable was introduced. | 3854 // context where the variable was introduced. |
3857 __ push(context_register()); | 3855 __ Push(var->name()); |
3858 __ push(Immediate(var->name())); | |
3859 __ CallRuntime(Runtime::kDeleteLookupSlot); | 3856 __ CallRuntime(Runtime::kDeleteLookupSlot); |
3860 context()->Plug(eax); | 3857 context()->Plug(eax); |
3861 } | 3858 } |
3862 } else { | 3859 } else { |
3863 // Result of deleting non-property, non-variable reference is true. | 3860 // Result of deleting non-property, non-variable reference is true. |
3864 // The subexpression may have side effects. | 3861 // The subexpression may have side effects. |
3865 VisitForEffect(expr->expression()); | 3862 VisitForEffect(expr->expression()); |
3866 context()->Plug(true); | 3863 context()->Plug(true); |
3867 } | 3864 } |
3868 break; | 3865 break; |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4564 Assembler::target_address_at(call_target_address, | 4561 Assembler::target_address_at(call_target_address, |
4565 unoptimized_code)); | 4562 unoptimized_code)); |
4566 return OSR_AFTER_STACK_CHECK; | 4563 return OSR_AFTER_STACK_CHECK; |
4567 } | 4564 } |
4568 | 4565 |
4569 | 4566 |
4570 } // namespace internal | 4567 } // namespace internal |
4571 } // namespace v8 | 4568 } // namespace v8 |
4572 | 4569 |
4573 #endif // V8_TARGET_ARCH_IA32 | 4570 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |