Commit a0394388 authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS: harmony-scoping: make assignment to 'const' a late error.

Port 6ac4de87

Original commit message:
Per TC39 Nov 2014 decision.

This patch also changes behavior for "legacy const": assignments to sloppy const in strict mode is now also a type error. This fixes v8:2243 and also brings us in compliance with other engines re assignment to function names (see updated webkit test), but might have bigger implications.
That change can easily be reverted by changing Variable::IsSignallingAssignmentToConst.

BUG=v8:3713,v8:2243
LOG=N

Review URL: https://codereview.chromium.org/766703002

Cr-Commit-Position: refs/heads/master@{#25541}
parent 217c45b1
......@@ -2642,7 +2642,6 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
// Perform the assignment.
__ bind(&assign);
EmitStoreToStackLocalOrContextSlot(var, location);
} else if (!var->is_const_mode() || op == Token::INIT_CONST) {
if (var->IsLookupSlot()) {
// Assignment to var.
......@@ -2663,8 +2662,9 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
}
EmitStoreToStackLocalOrContextSlot(var, location);
}
} else if (IsSignallingAssignmentToConst(var, op, strict_mode())) {
__ CallRuntime(Runtime::kThrowConstAssignError, 0);
}
// Non-initializing assignments to consts are ignored.
}
......
......@@ -2638,7 +2638,6 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
// Perform the assignment.
__ bind(&assign);
EmitStoreToStackLocalOrContextSlot(var, location);
} else if (!var->is_const_mode() || op == Token::INIT_CONST) {
if (var->IsLookupSlot()) {
// Assignment to var.
......@@ -2663,8 +2662,9 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
}
EmitStoreToStackLocalOrContextSlot(var, location);
}
} else if (IsSignallingAssignmentToConst(var, op, strict_mode())) {
__ CallRuntime(Runtime::kThrowConstAssignError, 0);
}
// Non-initializing assignments to consts are ignored.
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment