Revision: 20004
Author:   [email protected]
Date:     Mon Mar 17 15:11:04 2014 UTC
Log:      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
[email protected]

Review URL: https://codereview.chromium.org/195893031

Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=20004

Modified:
 /branches/bleeding_edge/src/mips/full-codegen-mips.cc

=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon Mar 17 08:31:21 2014 UTC +++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon Mar 17 15:11:04 2014 UTC
@@ -1880,13 +1880,9 @@


 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::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,15 +4329,10 @@


 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.

--
--
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