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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2555 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2556 Label assign; | 2556 Label assign; |
2557 MemOperand location = VarOperand(var, ecx); | 2557 MemOperand location = VarOperand(var, ecx); |
2558 __ mov(edx, location); | 2558 __ mov(edx, location); |
2559 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2559 __ cmp(edx, isolate()->factory()->the_hole_value()); |
2560 __ j(not_equal, &assign, Label::kNear); | 2560 __ j(not_equal, &assign, Label::kNear); |
2561 __ push(Immediate(var->name())); | 2561 __ push(Immediate(var->name())); |
2562 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2562 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
2563 __ bind(&assign); | 2563 __ bind(&assign); |
2564 EmitStoreToStackLocalOrContextSlot(var, location); | 2564 EmitStoreToStackLocalOrContextSlot(var, location); |
2565 | |
2566 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { | 2565 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { |
2567 if (var->IsLookupSlot()) { | 2566 if (var->IsLookupSlot()) { |
2568 // Assignment to var. | 2567 // Assignment to var. |
2569 __ push(eax); // Value. | 2568 __ push(eax); // Value. |
2570 __ push(esi); // Context. | 2569 __ push(esi); // Context. |
2571 __ push(Immediate(var->name())); | 2570 __ push(Immediate(var->name())); |
2572 __ push(Immediate(Smi::FromInt(strict_mode()))); | 2571 __ push(Immediate(Smi::FromInt(strict_mode()))); |
2573 __ CallRuntime(Runtime::kStoreLookupSlot, 4); | 2572 __ CallRuntime(Runtime::kStoreLookupSlot, 4); |
2574 } else { | 2573 } else { |
2575 // Assignment to var or initializing assignment to let/const in harmony | 2574 // Assignment to var or initializing assignment to let/const in harmony |
2576 // mode. | 2575 // mode. |
2577 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2576 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2578 MemOperand location = VarOperand(var, ecx); | 2577 MemOperand location = VarOperand(var, ecx); |
2579 if (generate_debug_code_ && op == Token::INIT_LET) { | 2578 if (generate_debug_code_ && op == Token::INIT_LET) { |
2580 // Check for an uninitialized let binding. | 2579 // Check for an uninitialized let binding. |
2581 __ mov(edx, location); | 2580 __ mov(edx, location); |
2582 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2581 __ cmp(edx, isolate()->factory()->the_hole_value()); |
2583 __ Check(equal, kLetBindingReInitialization); | 2582 __ Check(equal, kLetBindingReInitialization); |
2584 } | 2583 } |
2585 EmitStoreToStackLocalOrContextSlot(var, location); | 2584 EmitStoreToStackLocalOrContextSlot(var, location); |
2586 } | 2585 } |
| 2586 } else if (IsSignallingAssignmentToConst(var, op, strict_mode())) { |
| 2587 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
2587 } | 2588 } |
2588 // Non-initializing assignments to consts are ignored. | |
2589 } | 2589 } |
2590 | 2590 |
2591 | 2591 |
2592 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2592 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2593 // Assignment to a property, using a named store IC. | 2593 // Assignment to a property, using a named store IC. |
2594 // eax : value | 2594 // eax : value |
2595 // esp[0] : receiver | 2595 // esp[0] : receiver |
2596 | 2596 |
2597 Property* prop = expr->target()->AsProperty(); | 2597 Property* prop = expr->target()->AsProperty(); |
2598 DCHECK(prop != NULL); | 2598 DCHECK(prop != NULL); |
(...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5162 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5162 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5163 Assembler::target_address_at(call_target_address, | 5163 Assembler::target_address_at(call_target_address, |
5164 unoptimized_code)); | 5164 unoptimized_code)); |
5165 return OSR_AFTER_STACK_CHECK; | 5165 return OSR_AFTER_STACK_CHECK; |
5166 } | 5166 } |
5167 | 5167 |
5168 | 5168 |
5169 } } // namespace v8::internal | 5169 } } // namespace v8::internal |
5170 | 5170 |
5171 #endif // V8_TARGET_ARCH_X87 | 5171 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |