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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2568 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2568 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2569 Label assign; | 2569 Label assign; |
2570 MemOperand location = VarOperand(var, ecx); | 2570 MemOperand location = VarOperand(var, ecx); |
2571 __ mov(edx, location); | 2571 __ mov(edx, location); |
2572 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2572 __ cmp(edx, isolate()->factory()->the_hole_value()); |
2573 __ j(not_equal, &assign, Label::kNear); | 2573 __ j(not_equal, &assign, Label::kNear); |
2574 __ push(Immediate(var->name())); | 2574 __ push(Immediate(var->name())); |
2575 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2575 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
2576 __ bind(&assign); | 2576 __ bind(&assign); |
2577 EmitStoreToStackLocalOrContextSlot(var, location); | 2577 EmitStoreToStackLocalOrContextSlot(var, location); |
2578 | |
2579 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { | 2578 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { |
2580 if (var->IsLookupSlot()) { | 2579 if (var->IsLookupSlot()) { |
2581 // Assignment to var. | 2580 // Assignment to var. |
2582 __ push(eax); // Value. | 2581 __ push(eax); // Value. |
2583 __ push(esi); // Context. | 2582 __ push(esi); // Context. |
2584 __ push(Immediate(var->name())); | 2583 __ push(Immediate(var->name())); |
2585 __ push(Immediate(Smi::FromInt(strict_mode()))); | 2584 __ push(Immediate(Smi::FromInt(strict_mode()))); |
2586 __ CallRuntime(Runtime::kStoreLookupSlot, 4); | 2585 __ CallRuntime(Runtime::kStoreLookupSlot, 4); |
2587 } else { | 2586 } else { |
2588 // Assignment to var or initializing assignment to let/const in harmony | 2587 // Assignment to var or initializing assignment to let/const in harmony |
2589 // mode. | 2588 // mode. |
2590 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2589 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2591 MemOperand location = VarOperand(var, ecx); | 2590 MemOperand location = VarOperand(var, ecx); |
2592 if (generate_debug_code_ && op == Token::INIT_LET) { | 2591 if (generate_debug_code_ && op == Token::INIT_LET) { |
2593 // Check for an uninitialized let binding. | 2592 // Check for an uninitialized let binding. |
2594 __ mov(edx, location); | 2593 __ mov(edx, location); |
2595 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2594 __ cmp(edx, isolate()->factory()->the_hole_value()); |
2596 __ Check(equal, kLetBindingReInitialization); | 2595 __ Check(equal, kLetBindingReInitialization); |
2597 } | 2596 } |
2598 EmitStoreToStackLocalOrContextSlot(var, location); | 2597 EmitStoreToStackLocalOrContextSlot(var, location); |
2599 } | 2598 } |
| 2599 } else if (var->IsSignallingAssignmentToConst(op, strict_mode())) { |
| 2600 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
2600 } | 2601 } |
2601 // Non-initializing assignments to consts are ignored. | |
2602 } | 2602 } |
2603 | 2603 |
2604 | 2604 |
2605 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2605 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2606 // Assignment to a property, using a named store IC. | 2606 // Assignment to a property, using a named store IC. |
2607 // eax : value | 2607 // eax : value |
2608 // esp[0] : receiver | 2608 // esp[0] : receiver |
2609 | 2609 |
2610 Property* prop = expr->target()->AsProperty(); | 2610 Property* prop = expr->target()->AsProperty(); |
2611 DCHECK(prop != NULL); | 2611 DCHECK(prop != NULL); |
(...skipping 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5176 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5176 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5177 Assembler::target_address_at(call_target_address, | 5177 Assembler::target_address_at(call_target_address, |
5178 unoptimized_code)); | 5178 unoptimized_code)); |
5179 return OSR_AFTER_STACK_CHECK; | 5179 return OSR_AFTER_STACK_CHECK; |
5180 } | 5180 } |
5181 | 5181 |
5182 | 5182 |
5183 } } // namespace v8::internal | 5183 } } // namespace v8::internal |
5184 | 5184 |
5185 #endif // V8_TARGET_ARCH_IA32 | 5185 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |