v8/test/mjsunit/tools/compiler-trace-flags.js
Pierre Langlois 7927d6468e [turbofan][wasm] Fix --trace-turbo with compiling a WASM function.
The --trace-turbo flag would cause a crash when compiling a WASM_FUNCTION. It
was caused by assuming the OptimizedCompilationInfo had a SharedFunctionInfo
attached if the code isn't a stub and wasm functions are not considered as such.

In order to test this, we've added a new flag to specify were to dump JSON
files: --trace-turbo-path. This is used to make sure we do not leave lots of
files behind in the top-level directory. It should be useful as standalone
feature too.


Change-Id: Ia9442638d28100bea45a8683fb233803cc5393f2
Reviewed-on: https://chromium-review.googlesource.com/1030555
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53153}
2018-05-14 13:37:13 +00:00

37 lines
1.0 KiB
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 --trace-turbo --trace-turbo-graph
// Flags: --trace-turbo-cfg-file=test/mjsunit/tools/turbo.cfg
// Flags: --trace-turbo-path=test/mjsunit/tools
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// The idea behind this test is to make sure we do not crash when using the
// --trace-turbo flag given different sort of inputs, JS or WASM.
(function testOptimizedJS() {
function add(a, b) {
return a + b;
}
add(21, 21);
%OptimizeFunctionOnNextCall(add);
add(20, 22);
})();
(function testWASM() {
let builder = new WasmModuleBuilder();
builder.addFunction("add", kSig_i_ii)
.addBody([kExprGetLocal, 0,
kExprGetLocal, 1,
kExprI32Add])
.exportFunc();
let instance = builder.instantiate();
instance.exports.add(21, 21);
})();