Index: src/full-codegen/x64/full-codegen-x64.cc |
diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
index 7b0a3aefe235e558721857b224a6c566213d2e31..05daaac458d4c37de185e1d8e1040b2cd880ea1c 100644 |
--- a/src/full-codegen/x64/full-codegen-x64.cc |
+++ b/src/full-codegen/x64/full-codegen-x64.cc |
@@ -1239,7 +1239,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode); |
Comment cmnt(masm_, var->IsContextSlot() ? "[ Context slot" |
: "[ Stack slot"); |
- if (proxy->needs_hole_check()) { |
+ if (proxy->hole_check_mode() == HoleCheckMode::kRequired) { |
// Throw a reference error when using an uninitialized let/const |
// binding in harmony mode. |
DCHECK(IsLexicalVariableMode(var->mode())); |
@@ -1670,12 +1670,14 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
// Store the value. |
switch (assign_type) { |
- case VARIABLE: |
- EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), |
- expr->op(), expr->AssignmentSlot()); |
+ case VARIABLE: { |
+ VariableProxy* proxy = expr->target()->AsVariableProxy(); |
+ EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(), |
+ proxy->hole_check_mode()); |
PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
context()->Plug(rax); |
break; |
+ } |
case NAMED_PROPERTY: |
EmitNamedPropertyAssignment(expr); |
break; |
@@ -1919,9 +1921,10 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, |
switch (assign_type) { |
case VARIABLE: { |
- Variable* var = expr->AsVariableProxy()->var(); |
+ VariableProxy* proxy = expr->AsVariableProxy(); |
EffectContext context(this); |
- EmitVariableAssignment(var, Token::ASSIGN, slot); |
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, slot, |
+ proxy->hole_check_mode()); |
break; |
} |
case NAMED_PROPERTY: { |
@@ -1994,9 +1997,9 @@ void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
} |
} |
- |
void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
- FeedbackVectorSlot slot) { |
+ FeedbackVectorSlot slot, |
+ HoleCheckMode hole_check_mode) { |
if (var->IsUnallocated()) { |
// Global var, const, or let. |
__ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); |
@@ -2007,7 +2010,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
MemOperand location = VarOperand(var, rcx); |
// Perform an initialization check for lexically declared variables. |
- if (var->binding_needs_init()) { |
+ if (hole_check_mode == HoleCheckMode::kRequired) { |
Label assign; |
__ movp(rdx, location); |
__ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); |
@@ -3073,12 +3076,13 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
// Store the value returned in rax. |
switch (assign_type) { |
- case VARIABLE: |
+ case VARIABLE: { |
+ VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
if (expr->is_postfix()) { |
// Perform the assignment as if via '='. |
{ EffectContext context(this); |
- EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
- Token::ASSIGN, expr->CountSlot()); |
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(), |
+ proxy->hole_check_mode()); |
PrepareForBailoutForId(expr->AssignmentId(), |
BailoutState::TOS_REGISTER); |
context.Plug(rax); |
@@ -3090,13 +3094,14 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
} |
} else { |
// Perform the assignment as if via '='. |
- EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
- Token::ASSIGN, expr->CountSlot()); |
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(), |
+ proxy->hole_check_mode()); |
PrepareForBailoutForId(expr->AssignmentId(), |
BailoutState::TOS_REGISTER); |
context()->Plug(rax); |
} |
break; |
+ } |
case NAMED_PROPERTY: { |
PopOperand(StoreDescriptor::ReceiverRegister()); |
CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value()); |