Reviewers: danno, rossberg, Paul Lind, kisg, dusmil, palfia,

Description:
MIPS: Make invalid LHSs a parse-time (reference) error

Port r19976 (73bbd7a)

Original commit message:
This is required by the spec. It also prevents crashes resulting from the
attempt to read type feedback for the RHS of an invalid assignment which full
codegen never actually allocated info for.

To do: check properly in preparser already.

BUG=351658
LOG=Y

Please review this at https://codereview.chromium.org/195893031/

SVN Base: https://github.com/v8/v8.git@gbl

Affected files (+5, -19 lines):
  M src/mips/full-codegen-mips.cc


Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index 02a890a3565975cccdf6e4f71a285ceb9d54d593..a696b4957621fe20c6bbc9141bb1c994b9c3c9de 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -1880,13 +1880,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {


 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
+  ASSERT(expr->target()->IsValidLeftHandSide());
+
   Comment cmnt(masm_, "[ Assignment");
-  // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
-  // on the left-hand side.
-  if (!expr->target()->IsValidLeftHandSide()) {
-    VisitForEffect(expr->target());
-    return;
-  }

// Left-hand side can only be a property, a global or a (parameter or local)
   // slot.
@@ -2424,12 +2420,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,


 void FullCodeGenerator::EmitAssignment(Expression* expr) {
-  // Invalid left-hand sides are rewritten by the parser to have a 'throw
-  // ReferenceError' on the left-hand side.
-  if (!expr->IsValidLeftHandSide()) {
-    VisitForEffect(expr);
-    return;
-  }
+  ASSERT(expr->IsValidLeftHandSide());

// Left-hand side can only be a property, a global or a (parameter or local)
   // slot.
@@ -4338,16 +4329,11 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {


 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
+  ASSERT(expr->expression()->IsValidLeftHandSide());
+
   Comment cmnt(masm_, "[ CountOperation");
   SetSourcePosition(expr->position());

-  // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
-  // as the left-hand side.
-  if (!expr->expression()->IsValidLeftHandSide()) {
-    VisitForEffect(expr->expression());
-    return;
-  }
-
   // Expression can only be a property, a global or a (parameter or local)
   // slot.
   enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to