v8/test/mjsunit/asm/regress-913822.js
Michael Starzinger 5f8cd45bd8 [asm.js] Fix semicolon insertion in presence of comments.
This makes sure we properly recognize a newline character as part of
semicolon insertion, even if the newline appears after a CPP-style
single line comment. The same applies for newlines within C-style multi
line comments.

R=clemensh@chromium.org
TEST=mjsunit/asm/regress-913822
BUG=chromium:913822

Change-Id: I64f098d7e386dea7b7fb6c233c1625425e36bde0
Reviewed-on: https://chromium-review.googlesource.com/c/1373551
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58189}
2018-12-12 14:43:05 +00:00

26 lines
580 B
JavaScript

// Copyright 2018 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.
// Flags: --allow-natives-syntax
(function TestNewlineInCPPComment() {
function Module() {
"use asm" // Crash by comment!
function f() {}
return f
}
Module();
assertTrue(%IsAsmWasmCode(Module));
})();
(function TestNewlineInCComment() {
function Module() {
"use asm" /* Crash by
comment! */ function f() {}
return f
}
Module();
assertTrue(%IsAsmWasmCode(Module));
})();