Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index 9b31556c7783a407a9ece35f20038768c3b5266a..7e6043e1e8fc4170da0a7eda8b520b928054e20f 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -1977,7 +1977,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
- DCHECK(expr->target()->IsValidReferenceExpression()); |
+ DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); |
Comment cmnt(masm_, "[ Assignment"); |
SetExpressionPosition(expr, INSERT_BREAK); |
@@ -2359,7 +2359,7 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit, |
void FullCodeGenerator::EmitAssignment(Expression* expr, |
FeedbackVectorICSlot slot) { |
- DCHECK(expr->IsValidReferenceExpression()); |
+ DCHECK(expr->IsValidReferenceExpressionOrThis()); |
Property* prop = expr->AsProperty(); |
LhsKind assign_type = Property::GetAssignType(prop); |
@@ -2508,6 +2508,19 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
__ Bind(&const_error); |
__ CallRuntime(Runtime::kThrowConstAssignError, 0); |
+ } else if (var->is_this() && op == Token::INIT_CONST) { |
+ // 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, 1); |
+ __ bind(&uninitialized_this); |
+ EmitStoreToStackLocalOrContextSlot(var, location); |
+ |
} else if (!var->is_const_mode() || op == Token::INIT_CONST) { |
if (var->IsLookupSlot()) { |
// Assignment to var. |
@@ -2866,21 +2879,6 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
} |
-void FullCodeGenerator::EmitInitializeThisAfterSuper( |
- SuperCallReference* super_ref, FeedbackVectorICSlot slot) { |
- Variable* this_var = super_ref->this_var()->var(); |
- GetVar(x1, this_var); |
- Label uninitialized_this; |
- __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this); |
- __ Mov(x0, Operand(this_var->name())); |
- __ Push(x0); |
- __ CallRuntime(Runtime::kThrowReferenceError, 1); |
- __ bind(&uninitialized_this); |
- |
- EmitVariableAssignment(this_var, Token::INIT_CONST, slot); |
-} |
- |
- |
// See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
VariableProxy* callee = expr->expression()->AsVariableProxy(); |
@@ -3103,7 +3101,6 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
RecordJSReturnSite(expr); |
- EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |
context()->Plug(x0); |
} |
@@ -4434,9 +4431,6 @@ void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { |
// Restore context register. |
__ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
context()->DropAndPlug(1, x0); |
- |
- // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. |
- EmitInitializeThisAfterSuper(super_call_ref); |
} |
@@ -4632,7 +4626,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
- DCHECK(expr->expression()->IsValidReferenceExpression()); |
+ DCHECK(expr->expression()->IsValidReferenceExpressionOrThis()); |
Comment cmnt(masm_, "[ CountOperation"); |