| Index: src/x64/full-codegen-x64.cc
|
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
|
| index 6805b54b907076d849991d3c5af85023e426abd4..c17ed4ec3f60981f7b806c09025306218950ffb8 100644
|
| --- a/src/x64/full-codegen-x64.cc
|
| +++ b/src/x64/full-codegen-x64.cc
|
| @@ -2668,6 +2668,20 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| __ 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, rcx);
|
| + __ movp(rdx, location);
|
| + __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
|
| + __ j(not_equal, &const_error, Label::kNear);
|
| + __ Push(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.
|
|
|