Skip to content
Permalink
Browse files

Add missing early-bailouts in ast traversal visitors

Instructions after an unconditional jump can be omitted.

BUG=chromium:715582
R=bradnelson@chromium.org,verwaest@chromium.org
TBR=bradnelson@chromium.org

Change-Id: Ie4f4041ed836f328955a0ff396e2dfd6adc01513
Reviewed-on: https://chromium-review.googlesource.com/487983
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44923}
  • Loading branch information...
jeisinger authored and Commit Bot committed Apr 27, 2017
1 parent 3a9e4d8 commit 4e78b5a70c6443e3829b0bef10fd731062e27aa3
Showing with 11 additions and 0 deletions.
  1. +1 −0 src/asmjs/asm-wasm-builder.cc
  2. +1 −0 src/ast/ast-numbering.cc
  3. +9 −0 test/mjsunit/regress/regress-715582.js
@@ -225,6 +225,7 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
}
RECURSE(Visit(stmt));
if (typer_failed_) break;
// Not stopping when a jump statement is found.
}
}

@@ -632,6 +632,7 @@ void AstNumberingVisitor::VisitStatements(ZoneList<Statement*>* statements) {
if (statements == NULL) return;
for (int i = 0; i < statements->length(); i++) {
Visit(statements->at(i));
if (statements->at(i)->IsJump()) break;
}
}

@@ -0,0 +1,9 @@
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Should not crash.
//
this.__defineGetter__(
"x", (a = (function f() { return; (function() {}); })()) => { });
x;

0 comments on commit 4e78b5a

Please sign in to comment.
You can’t perform that action at this time.