Commit Graph

20 Commits

Author SHA1 Message Date
ritesht
d0b8e7fb54 [wasm] Support undefined indirect table entries, behind a flag.
Add a flag to gate experimental support for dynamic code loading and JITing (at runtime in a wasm module).

Enhancing functionality of the indirect function table to support JITing and dynamic linking by allowing additional space to be filled with an "undefined" function signature.

BUG=v8:5044
LOG=N
TEST=None
R=mtrofin@chromium.org,bradnelson@chromium.org

Review-Url: https://codereview.chromium.org/2049513003
Cr-Commit-Position: refs/heads/master@{#37159}
2016-06-22 00:53:31 +00:00
rossberg
271a7f55cd Refactor module builder
- Use ES6 classes and other goodies.
- Make some names match design/spec.
- Remove obsolete generation of END section.

R=bradnelson@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2081973003
Cr-Commit-Position: refs/heads/master@{#37155}
2016-06-21 19:48:16 +00:00
rossberg
386c747b8a Upgrade Wasm JS API, step 1
Implements:
- WebAssembly object,
- WebAssembly.Module constructor,
- WebAssembly.Instance constructor,
- WebAssembly.compile async method,
- and Module and Instance instance objects.

Also, changes ErrorThrower to support capturing errors in a promise reject.

Since we cannot yet compile without fixing the Wasm memory, and cannot validate a module without compiling, the Module constructor and compile method don't do anything yet but checking that their argument is a suitable BufferSource. Instead of a compiled module, the hidden state of a Module object currently is just that buffer.

BUG=

Review-Url: https://codereview.chromium.org/2084573002
Cr-Commit-Position: refs/heads/master@{#37143}
2016-06-21 12:54:09 +00:00
clemensh
f0523e3046 [wasm] Add UTF-8 validation
Names passed for imports and exports are checked during decoding,
leading to errors if they are no valid UTF-8. Function names are not
checked during decode, but rather lead to undefined being returned at
runtime if they are not UTF-8.

We need to do these checks on the Wasm side, since the factory
methods assume to get valid UTF-8 strings.

R=titzer@chromium.org, yangguo@chromium.org

Review-Url: https://codereview.chromium.org/1967023004
Cr-Commit-Position: refs/heads/master@{#36208}
2016-05-12 13:02:14 +00:00
titzer
ee03b7217b [wasm] Binary 11: Bump module version to 0xB.
[wasm] Binary 11: Swap the order of section name / section length.
[wasm] Binary 11: Shorter section names.
[wasm] Binary 11: Add a prefix for function type declarations.
[wasm] Binary 11: Function types encoded as pcount, p*, rcount, r*
[wasm] Fix numeric names for functions.

R=rossberg@chromium.org,jfb@chromium.org,ahaas@chromium.org
BUG=chromium:575167
LOG=Y

Review-Url: https://codereview.chromium.org/1896863003
Cr-Commit-Position: refs/heads/master@{#35897}
2016-04-29 09:40:24 +00:00
titzer
b3cf031eb8 [wasm] Enforce strict ordering of WASM module sections.
R=jfb@chromium.org,rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1900153002

Cr-Commit-Position: refs/heads/master@{#35698}
2016-04-21 11:20:15 +00:00
jfb
abbdca947f wasm: use strings for section names
This will require an equivalent sexpr-wasm change.

See:
https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#high-level-structure

R=titzer@chromium.org, binji@chronium.org

Review URL: https://codereview.chromium.org/1765843002

Cr-Commit-Position: refs/heads/master@{#34668}
2016-03-10 12:37:19 +00:00
titzer
4cb568ec5f [wasm] Encode function signatures, bodies, and names as separate sections.
R=binji@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1783593002

Cr-Commit-Position: refs/heads/master@{#34641}
2016-03-09 22:51:50 +00:00
binji
29cd25be1d [Wasm] Move data segment data inline to the data segment section
BUG=
R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1776923005

Cr-Commit-Position: refs/heads/master@{#34639}
2016-03-09 19:43:14 +00:00
binji
ca0dbaece0 [wasm] All strings are length-prefixed and inline
R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1781523002

Cr-Commit-Position: refs/heads/master@{#34637}
2016-03-09 18:56:30 +00:00
binji
78f6f838f0 [Wasm] Convert many of the fixed-size values to LEB128.
This CL modifies the following to be LEB128:
* Function table indices
* Import table signature indices
* Export table function indices
* Function signature param count
* br/br_if break depth
* br_table target count
* block/loop expression count

Still to do:
* Import/export names (LEB128 count + inline data)
* Data segments (LEB128 offset + size + inline data)
* Function header stuff (should seperate into function sig and body sections)
* Memory access alignment + offset (still discussing)

BUG=
R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1775873002

Cr-Commit-Position: refs/heads/master@{#34603}
2016-03-08 22:56:18 +00:00
titzer
d61a0c5a4a [wasm] Support a two-level namespace for imports.
R=binji@chromium.org,dschuff@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1780483002

Cr-Commit-Position: refs/heads/master@{#34600}
2016-03-08 19:57:10 +00:00
titzer
5c1c98e829 [wasm] Rename _WASMEXP_ object to Wasm.
R=ahaas@chromium.org,binji@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1770383002

Cr-Commit-Position: refs/heads/master@{#34587}
2016-03-08 14:48:27 +00:00
titzer
835c5e6beb [wasm] Rework encoding of local declarations.
Local declarations were previously encoded as an optional set of
4 uint16 values as part of the function declaration. This CL
implements the current design of moving these declarations to
a list of pairs of (type, count) that is part of the body.

R=bradnelson@chromium.org,binji@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1763433002

Cr-Commit-Position: refs/heads/master@{#34564}
2016-03-07 21:05:15 +00:00
titzer
c38cd1698b [wasm] Use the JavaScript WasmModuleBuilder utility in JS tests.
R=ahaas@chromium.org,binji@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1770913002

Cr-Commit-Position: refs/heads/master@{#34559}
2016-03-07 19:34:29 +00:00
machenbach
701e520b2b Reland of [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript. (patchset #1 id:1 of https://codereview.chromium.org/1768963002/ )
Reason for revert:
Fix landed in head.

Original issue's description:
> Revert of [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript. (patchset #1 id:1 of https://codereview.chromium.org/1774463002/ )
>
> Reason for revert:
> [Sheriff] Problem is not fixed:
> https://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20shared/builds/8799
>
> Original issue's description:
> > [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript.
> >
> > This is a reland of https://codereview.chromium.org/1762203002/
> >
> > R=ahaas@chromium.org,binji@chromium.org,seththompson@chromium.org
> > BUG=
> >
> > Committed: https://crrev.com/aa5770805060a347c6b650634c736ba34ab61728
> > Cr-Commit-Position: refs/heads/master@{#34519}
>
> TBR=ahaas@chromium.org,binji@chromium.org,seththompson@chromium.org,titzer@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=

TBR=ahaas@chromium.org,binji@chromium.org,seththompson@chromium.org,titzer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1769863002

Cr-Commit-Position: refs/heads/master@{#34523}
2016-03-07 10:03:01 +00:00
machenbach
6242b3893d Revert of [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript. (patchset #1 id:1 of https://codereview.chromium.org/1774463002/ )
Reason for revert:
[Sheriff] Problem is not fixed:
https://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20shared/builds/8799

Original issue's description:
> [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript.
>
> This is a reland of https://codereview.chromium.org/1762203002/
>
> R=ahaas@chromium.org,binji@chromium.org,seththompson@chromium.org
> BUG=
>
> Committed: https://crrev.com/aa5770805060a347c6b650634c736ba34ab61728
> Cr-Commit-Position: refs/heads/master@{#34519}

TBR=ahaas@chromium.org,binji@chromium.org,seththompson@chromium.org,titzer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1768963002

Cr-Commit-Position: refs/heads/master@{#34522}
2016-03-07 10:01:23 +00:00
titzer
aa57708050 [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript.
This is a reland of https://codereview.chromium.org/1762203002/

R=ahaas@chromium.org,binji@chromium.org,seththompson@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1774463002

Cr-Commit-Position: refs/heads/master@{#34519}
2016-03-07 09:46:37 +00:00
adamk
6479b01aff Revert of [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript. (patchset #2 id:20001 of https://codereview.chromium.org/1762203002/ )
Reason for revert:
New test test-wasm-module-builder fails on Linux - shared bot:
https://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20shared/builds/8793

Original issue's description:
> [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript.
>
> R=binji@chromium.org,seththompson@chromium.org
> BUG=
>
> Committed: https://crrev.com/d130c6bdc6a424b068614592a0b79a34750af0fc
> Cr-Commit-Position: refs/heads/master@{#34513}

TBR=binji@chromium.org,seththompson@chromium.org,titzer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1771553002

Cr-Commit-Position: refs/heads/master@{#34514}
2016-03-05 02:21:20 +00:00
titzer
d130c6bdc6 [wasm] Add a JavaScript utility to make it easier to build WASM modules from JavaScript.
R=binji@chromium.org,seththompson@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1762203002

Cr-Commit-Position: refs/heads/master@{#34513}
2016-03-05 01:48:12 +00:00