Index: src/full-codegen/arm64/full-codegen-arm64.cc |
diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc |
index ff187e962789efd42bb17480b13273730ce83298..a74ae779c49bc651ceaedbed25301ece270b71e8 100644 |
--- a/src/full-codegen/arm64/full-codegen-arm64.cc |
+++ b/src/full-codegen/arm64/full-codegen-arm64.cc |
@@ -750,9 +750,9 @@ void FullCodeGenerator::VisitVariableDeclaration( |
VariableDeclaration* declaration) { |
VariableProxy* proxy = declaration->proxy(); |
Variable* variable = proxy->var(); |
+ DCHECK(!variable->binding_needs_init()); |
switch (variable->location()) { |
case VariableLocation::UNALLOCATED: { |
- DCHECK(!variable->binding_needs_init()); |
globals_->Add(variable->name(), zone()); |
FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
DCHECK(!slot.IsInvalid()); |
@@ -762,22 +762,7 @@ void FullCodeGenerator::VisitVariableDeclaration( |
} |
case VariableLocation::PARAMETER: |
case VariableLocation::LOCAL: |
- if (variable->binding_needs_init()) { |
- Comment cmnt(masm_, "[ VariableDeclaration"); |
- __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); |
- __ Str(x10, StackOperand(variable)); |
- } |
- break; |
- |
case VariableLocation::CONTEXT: |
- if (variable->binding_needs_init()) { |
- Comment cmnt(masm_, "[ VariableDeclaration"); |
- EmitDebugCheckDeclarationContext(variable); |
- __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); |
- __ Str(x10, ContextMemOperand(cp, variable->index())); |
- // No write barrier since the_hole_value is in old space. |
- PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
- } |
break; |
case VariableLocation::LOOKUP: |
@@ -1134,6 +1119,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
SetExpressionPosition(proxy); |
PrepareForBailoutForId(proxy->BeforeId(), BailoutState::NO_REGISTERS); |
Variable* var = proxy->var(); |
+ DCHECK(!var->binding_needs_init()); |
// Two cases: global variables and all other types of variables. |
switch (var->location()) { |
@@ -1151,19 +1137,6 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
Comment cmnt(masm_, var->IsContextSlot() |
? "Context variable" |
: "Stack variable"); |
- if (proxy->hole_check_mode() == HoleCheckMode::kRequired) { |
- // Throw a reference error when using an uninitialized let/const |
- // binding in harmony mode. |
- Label done; |
- GetVar(x0, var); |
- __ JumpIfNotRoot(x0, Heap::kTheHoleValueRootIndex, &done); |
- __ Mov(x0, Operand(var->name())); |
- __ Push(x0); |
- __ CallRuntime(Runtime::kThrowReferenceError); |
- __ Bind(&done); |
- context()->Plug(x0); |
- break; |
- } |
context()->Plug(var); |
break; |
} |
@@ -1476,8 +1449,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
switch (assign_type) { |
case VARIABLE: { |
VariableProxy* proxy = expr->target()->AsVariableProxy(); |
- EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(), |
- proxy->hole_check_mode()); |
+ EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot()); |
PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
context()->Plug(x0); |
break; |
@@ -1618,8 +1590,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, |
case VARIABLE: { |
VariableProxy* proxy = expr->AsVariableProxy(); |
EffectContext context(this); |
- EmitVariableAssignment(proxy->var(), Token::ASSIGN, slot, |
- proxy->hole_check_mode()); |
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, slot); |
break; |
} |
case NAMED_PROPERTY: { |
@@ -1664,58 +1635,23 @@ void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
} |
void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
- FeedbackVectorSlot slot, |
- HoleCheckMode hole_check_mode) { |
+ FeedbackVectorSlot slot) { |
ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment"); |
+ DCHECK(!var->binding_needs_init()); |
if (var->IsUnallocated()) { |
// Global var, const, or let. |
__ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); |
CallStoreIC(slot, var->name()); |
- } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { |
- DCHECK(!var->IsLookupSlot()); |
- DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
- MemOperand location = VarOperand(var, x1); |
- // Perform an initialization check for lexically declared variables. |
- if (var->binding_needs_init()) { |
- Label assign; |
- __ Ldr(x10, location); |
- __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); |
- __ Mov(x10, Operand(var->name())); |
- __ Push(x10); |
- __ CallRuntime(Runtime::kThrowReferenceError); |
- __ Bind(&assign); |
- } |
- if (var->mode() != CONST) { |
- EmitStoreToStackLocalOrContextSlot(var, location); |
- } else if (var->throw_on_const_assignment(language_mode())) { |
+ } else if (var->mode() == CONST && op != Token::INIT) { |
+ if (var->throw_on_const_assignment(language_mode())) { |
__ CallRuntime(Runtime::kThrowConstAssignError); |
} |
- } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { |
- // Initializing assignment to const {this} needs a write barrier. |
- DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
- Label uninitialized_this; |
- MemOperand location = VarOperand(var, x1); |
- __ Ldr(x10, location); |
- __ JumpIfRoot(x10, Heap::kTheHoleValueRootIndex, &uninitialized_this); |
- __ Mov(x0, Operand(var->name())); |
- __ Push(x0); |
- __ CallRuntime(Runtime::kThrowReferenceError); |
- __ bind(&uninitialized_this); |
- EmitStoreToStackLocalOrContextSlot(var, location); |
- |
} else { |
- DCHECK(var->mode() != CONST || op == Token::INIT); |
+ DCHECK(!var->is_this()); |
DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
DCHECK(!var->IsLookupSlot()); |
- // Assignment to var or initializing assignment to let/const in harmony |
- // mode. |
MemOperand location = VarOperand(var, x1); |
- if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { |
- __ Ldr(x10, location); |
- __ CompareRoot(x10, Heap::kTheHoleValueRootIndex); |
- __ Check(eq, kLetBindingReInitialization); |
- } |
EmitStoreToStackLocalOrContextSlot(var, location); |
} |
} |
@@ -2470,8 +2406,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
if (expr->is_postfix()) { |
{ EffectContext context(this); |
- EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(), |
- proxy->hole_check_mode()); |
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, |
+ expr->CountSlot()); |
PrepareForBailoutForId(expr->AssignmentId(), |
BailoutState::TOS_REGISTER); |
context.Plug(x0); |
@@ -2482,8 +2418,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
context()->PlugTOS(); |
} |
} else { |
- EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(), |
- proxy->hole_check_mode()); |
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot()); |
PrepareForBailoutForId(expr->AssignmentId(), |
BailoutState::TOS_REGISTER); |
context()->Plug(x0); |