v8/test/mjsunit/regress/wasm/regress-840757.js
Clemens Hammacher aae0732c72 Reland "Fix SourcePositionInfo for wasm"
This is a reland of e084eea628.
Undefined behavious was fixed in https://crrev.com/c/1051235.

Original change's description:
> Fix SourcePositionInfo for wasm
>
> In wasm we often don't have a SharedFunctionInfo associated with a
> compilation job, so we can't get a Script. Just print "unknown" in
> these cases (instead of crashing).
>
> R=titzer@chromium.org
> CC=​herhut@chromium.org
>
> Bug: chromium:840757, v8:7738
> Change-Id: I850c6adfd9e07c9a0f6dd018f1a9314feb89d887
> Reviewed-on: https://chromium-review.googlesource.com/1049632
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Reviewed-by: Ben Titzer <titzer@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53080}

TBR=titzer@chromium.org

Bug: chromium:840757, v8:7738
Change-Id: If04040a33766955cfed78e7c27226dd04c3f9b9f
Reviewed-on: https://chromium-review.googlesource.com/1051266
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53111}
2018-05-09 16:39:55 +00:00

22 lines
914 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.
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Also enable predictable mode. Otherwise, concurrent recompilation will be
// enabled, and the code generator will not try to print the InliningStack
// (see CodeGenerator::AssembleSourcePosition).
// These preconditions make this test quite fragile, but it's the only way
// currently to reproduce the crash.
// Flags: --code-comments --predictable --print-wasm-code
const builder = new WasmModuleBuilder();
// Add a call instruction, because the segfault happens when processing source
// positions.
builder.addFunction('foo', kSig_v_v).addBody([]);
builder.addFunction('test', kSig_v_v).addBody([kExprCallFunction, 0]);
builder.instantiate();