-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: V8: backport 49712d8a from upstream
Original commit message: [wasm] Call AsyncInstantiate directly when instantiating a module object WebAssembly.instantiate is polymorphic, it can either take a module object as parameter, or a buffer source which should be compiled first. To share code between the two implementations, the module object was first passed to a promise (i.e. which is the result of compilation). However, passing the module object to a promise has a side effect if the module object has a then function. To avoid this side effect I remove this code sharing and call AsyncInstantiate directly in case the parameter is a module object. R=mstarzinger@chromium.org Bug: chromium:836141 Change-Id: I67b76d0d7761c5aeb2cf1deda45b6842e494eed4 Reviewed-on: https://chromium-review.googlesource.com/1025774 Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Commit-Queue: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#52755} PR-URL: #21334 Reviewed-By: Michaël Zasso <targos@protonmail.com>
- Loading branch information
1 parent
4be5252
commit 2afc05e
Showing
3 changed files
with
54 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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'); | ||
|
||
const builder = new WasmModuleBuilder(); | ||
builder.addMemory(16, 32); | ||
builder.addFunction("test", kSig_i_v).addBody([ | ||
kExprI32Const, 12, // i32.const 0 | ||
]); | ||
|
||
let bla = 0; | ||
let module = new WebAssembly.Module(builder.toBuffer()); | ||
module.then = () => { | ||
// Use setTimeout to get out of the promise chain. | ||
setTimeout(assertUnreachable); | ||
}; | ||
|
||
WebAssembly.instantiate(module); |