v8/test/mjsunit/code-comments.js
Clemens Hammacher 199533558e Fix undefined behaviour on CommentOperator
The {CommentOperator}, used for implementing the --code-comments flag,
is not UBSan-safe. This CL fixes this and adds a test which uses code
comments.

R=bmeurer@chromium.org

Bug: v8:7744
Change-Id: Ia6ec509e77d998df085ac7377cb24854354e3aa2
Reviewed-on: https://chromium-review.googlesource.com/1051235
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53100}
2018-05-09 13:31:21 +00:00

27 lines
536 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: --code-comments --print-code
(function simple_test() {
function fib(n) {
return n < 2 ? n : fib(n - 1) + fib(n - 2);
}
// Call a number of times to trigger optimization.
for (let i = 0; i < 100; ++i) {
fib(8);
}
})();
(function test_asm() {
function asm() {
'use asm';
function f() {}
return f;
}
var m = asm();
})();