| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index ce36f9ed07b0beac8bba413711da7b42473d44a1..4a1e1eba8e3266e9a735e541c000654e80f7c9c2 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -2632,25 +2632,6 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
|
| CallStoreIC();
|
|
|
| - } else if (op == Token::INIT_CONST_LEGACY) {
|
| - // Const initializers need a write barrier.
|
| - DCHECK(!var->IsParameter()); // No const parameters.
|
| - if (var->IsLookupSlot()) {
|
| - __ push(eax);
|
| - __ push(esi);
|
| - __ push(Immediate(var->name()));
|
| - __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3);
|
| - } else {
|
| - DCHECK(var->IsStackLocal() || var->IsContextSlot());
|
| - Label skip;
|
| - MemOperand location = VarOperand(var, ecx);
|
| - __ mov(edx, location);
|
| - __ cmp(edx, isolate()->factory()->the_hole_value());
|
| - __ j(not_equal, &skip, Label::kNear);
|
| - EmitStoreToStackLocalOrContextSlot(var, location);
|
| - __ bind(&skip);
|
| - }
|
| -
|
| } else if (var->mode() == LET && op != Token::INIT_LET) {
|
| // Non-initializing assignment to let variable needs a write barrier.
|
| DCHECK(!var->IsLookupSlot());
|
| @@ -2664,6 +2645,21 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| __ CallRuntime(Runtime::kThrowReferenceError, 1);
|
| __ bind(&assign);
|
| EmitStoreToStackLocalOrContextSlot(var, location);
|
| +
|
| + } else if (var->mode() == CONST && op != Token::INIT_CONST) {
|
| + // Assignment to const variable needs a write barrier.
|
| + DCHECK(!var->IsLookupSlot());
|
| + DCHECK(var->IsStackAllocated() || var->IsContextSlot());
|
| + Label const_error;
|
| + MemOperand location = VarOperand(var, ecx);
|
| + __ mov(edx, location);
|
| + __ cmp(edx, isolate()->factory()->the_hole_value());
|
| + __ j(not_equal, &const_error, Label::kNear);
|
| + __ push(Immediate(var->name()));
|
| + __ CallRuntime(Runtime::kThrowReferenceError, 1);
|
| + __ bind(&const_error);
|
| + __ CallRuntime(Runtime::kThrowConstAssignError, 0);
|
| +
|
| } else if (!var->is_const_mode() || op == Token::INIT_CONST) {
|
| if (var->IsLookupSlot()) {
|
| // Assignment to var.
|
| @@ -2685,8 +2681,33 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| }
|
| EmitStoreToStackLocalOrContextSlot(var, location);
|
| }
|
| - } else if (IsSignallingAssignmentToConst(var, op, language_mode())) {
|
| - __ CallRuntime(Runtime::kThrowConstAssignError, 0);
|
| +
|
| + } else if (op == Token::INIT_CONST_LEGACY) {
|
| + // Const initializers need a write barrier.
|
| + DCHECK(var->mode() == CONST_LEGACY);
|
| + DCHECK(!var->IsParameter()); // No const parameters.
|
| + if (var->IsLookupSlot()) {
|
| + __ push(eax);
|
| + __ push(esi);
|
| + __ push(Immediate(var->name()));
|
| + __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3);
|
| + } else {
|
| + DCHECK(var->IsStackLocal() || var->IsContextSlot());
|
| + Label skip;
|
| + MemOperand location = VarOperand(var, ecx);
|
| + __ mov(edx, location);
|
| + __ cmp(edx, isolate()->factory()->the_hole_value());
|
| + __ j(not_equal, &skip, Label::kNear);
|
| + EmitStoreToStackLocalOrContextSlot(var, location);
|
| + __ bind(&skip);
|
| + }
|
| +
|
| + } else {
|
| + DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT_CONST_LEGACY);
|
| + if (is_strict(language_mode())) {
|
| + __ CallRuntime(Runtime::kThrowConstAssignError, 0);
|
| + }
|
| + // Silently ignore store in sloppy mode.
|
| }
|
| }
|
|
|
|
|