Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index b1b4dfc54cc68190faeeb9415ff9386ce7988e3d..35efe630aab242a6a88060021c55dd40c01df178 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -6753,10 +6753,12 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) { |
DCHECK(!HasStackOverflow()); |
DCHECK(current_block() != NULL); |
DCHECK(current_block()->HasPredecessor()); |
- // We don't optimize functions with invalid left-hand sides in |
- // assignments, count operations, or for-in. Consequently throw can |
- // currently only occur in an effect context. |
- DCHECK(ast_context()->IsEffect()); |
+ if (!ast_context()->IsEffect()) { |
+ // The parser turns invalid left-hand sides in assignments into throw |
+ // statements, which may not be in effect contexts. We might still try |
+ // to optimize such functions; bail out now if we do. |
+ return Bailout(kInvalidLeftHandSideInAssignment); |
+ } |
CHECK_ALIVE(VisitForValue(expr->exception())); |
HValue* value = environment()->Pop(); |