Index: src/mips/full-codegen-mips.cc |
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc |
index b9c801e6e7edc44d7400bd7bf9696e862c6314fc..6033acd3c04bb71dc3c85028d70aff77ffb01ab1 100644 |
--- a/src/mips/full-codegen-mips.cc |
+++ b/src/mips/full-codegen-mips.cc |
@@ -1993,7 +1993,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); |
@@ -2662,7 +2662,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
void FullCodeGenerator::EmitAssignment(Expression* expr, |
FeedbackVectorICSlot slot) { |
- DCHECK(expr->IsValidReferenceExpression()); |
+ DCHECK(expr->IsValidReferenceExpressionOrThis()); |
Property* prop = expr->AsProperty(); |
LhsKind assign_type = Property::GetAssignType(prop); |
@@ -2811,6 +2811,20 @@ 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, a1); |
+ __ lw(a3, location); |
+ __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
+ __ Branch(&uninitialized_this, eq, a3, Operand(at)); |
+ __ li(a0, Operand(var->name())); |
+ __ Push(a0); |
+ __ 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. |
@@ -3160,22 +3174,6 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
} |
-void FullCodeGenerator::EmitInitializeThisAfterSuper( |
- SuperCallReference* super_ref, FeedbackVectorICSlot slot) { |
- Variable* this_var = super_ref->this_var()->var(); |
- GetVar(a1, this_var); |
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
- Label uninitialized_this; |
- __ Branch(&uninitialized_this, eq, a1, Operand(at)); |
- __ li(a0, Operand(this_var->name())); |
- __ Push(a0); |
- __ 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(); |
@@ -3395,7 +3393,6 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
RecordJSReturnSite(expr); |
- EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |
context()->Plug(v0); |
} |
@@ -4761,9 +4758,6 @@ void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { |
// Restore context register. |
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
context()->DropAndPlug(1, v0); |
- |
- // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. |
- EmitInitializeThisAfterSuper(super_call_ref); |
} |
@@ -4961,7 +4955,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
- DCHECK(expr->expression()->IsValidReferenceExpression()); |
+ DCHECK(expr->expression()->IsValidReferenceExpressionOrThis()); |
Comment cmnt(masm_, "[ CountOperation"); |