Commit Graph

26 Commits

Author SHA1 Message Date
Andreas Haas
6b650574fc [wasm] Allow multi-table initialization in the wasm-module-builder
This CL just adds a parameter to addElementSegment and adjusts all
existing tests.

Note that addElementSegment contains some convenience code to construct
one initial table if it does not exist yet. I did not extend that code
to multiple tables. If you want to use multiple tables, you have to
create them first before calling addElementSegment.

R=clemensh@chromium.org

Bug: v8:7581
Change-Id: Ie131fd5dc19856703ab5cfb2fa8f7d576f70a18b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1520709
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60211}
2019-03-13 10:39:41 +00:00
Sven Sauleau
5bdb13297f [wasm] merge js constants file in module-builder
We noticed that almost every call site were loading both files,
the split isn't necessary anymore.

In some message tests, removed the absolute line number to allow future
changes.

Bug: v8:8726
Change-Id: I8527f0a1ecfa685aa01a5e2f5f47ddf1cb13a545
Reviewed-on: https://chromium-review.googlesource.com/c/1446452
Commit-Queue: Sven Sauleau <ssauleau@igalia.com>
Reviewed-by: Ben Titzer <titzer@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59220}
2019-01-30 22:10:34 +00:00
Ben Smith
bf3c8b8ff3 [wasm] Cleanup wasm-module-builder.js
Use naming similar to the spec: "table" instead of "function table",
"element segment" instead of "function table init".

Change-Id: Ib1b6cdfa566f8bd00017ccedf9440084204f10ff
Reviewed-on: https://chromium-review.googlesource.com/c/1273612
Commit-Queue: Ben Smith <binji@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56545}
2018-10-10 22:50:57 +00:00
Ben L. Titzer
903d87312e [wasm] Fix target instance for indirect calls to imports
In the case of an indirect call to an imported function, the target
instance stored in the IFT was actually wrong.

Bug: chromium:834619
Change-Id: Id2ac4158335ecf2b58e1983ce37df852a9ebd1b2
Reviewed-on: https://chromium-review.googlesource.com/1030174
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52831}
2018-04-27 08:27:56 +00:00
Ben L. Titzer
c536ea2dba [wasm] Remove temporary table immutability workaround
Now that tables and stack frames properly root instances, there is no
longer any need to disallow mutations that could unroot instances
while their code is on the stack.

Bug: v8:7232
Change-Id: I907b9522ac12ad7a67fb4124774713b6b3b40bb7
Reviewed-on: https://chromium-review.googlesource.com/1007004
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52629}
2018-04-16 18:39:33 +00:00
Ben L. Titzer
0c1b4c257b [wasm] Move indirect function tables into the WasmContext
This CL changes the WASM implementation to access indirect function
tables through the WasmContext, whereas previously indirect function
tables and their sizes were constants that were inlined into compiled
into code, requiring code patching. This is a necessary step for sharing
code between instances and eventually, isolates.

R=clemensh@chromium.org,mstarzinger@chromium.org

Bug: v8:7424
Change-Id: Ida4138ed92729730dfbc0a81a84d8484b233d808
Reviewed-on: https://chromium-review.googlesource.com/895683
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51427}
2018-02-21 12:29:21 +00:00
Mircea Trofin
c8fe2635ea [wasm] Freeze mutability of tables
Bug: v8:7232
Change-Id: I1eed337749686ec749b970b4af56413c5614b980
Reviewed-on: https://chromium-review.googlesource.com/837646
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50253}
2017-12-21 00:37:01 +00:00
Mircea Trofin
f9c9616e62 [wasm] Ensure free-standing tables are rooted.
Bug: chromium:796584
Change-Id: Ib6a62d616d36344f35cad0b0a177f8f07c7fd2ac
Reviewed-on: https://chromium-review.googlesource.com/836849
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50244}
2017-12-20 19:17:12 +00:00
Mircea Trofin
958b78a795 [wasm] Ensure indirect calls happen in the context of the owning instance
Bug: chromium:793714
Change-Id: I8c1ea8a2e27b5a7fe9cd1f8260873057a3bf9fd9
Reviewed-on: https://chromium-review.googlesource.com/826030
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50136}
2017-12-15 17:00:16 +00:00
Deepti Gandluri
a636fcc9d2 [wasm] Fix tables bounds check, add Table.Grow tests
BUG=v8:6749

R=titzer@chromium.org

Change-Id: I4ac2ac8d8ca98d71dbc5a86c3cca268cd836997c
Reviewed-on: https://chromium-review.googlesource.com/645146
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47837}
2017-09-05 18:24:39 +00:00
Deepti Gandluri
f0e07e4ba8 [wasm] Remove redundant table size relocation
BUG=chromium:752423

Change-Id: Ifea2fba7e002cb88dd6e53170fe98d3fd4af686a
Reviewed-on: https://chromium-review.googlesource.com/609445
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47527}
2017-08-22 22:28:47 +00:00
Clemens Hammacher
883db26e6f [wasm] Update signature map on indirect calls
The code was already there, but there was a bug in it: Because of the
missing reference, we were only updating a *copy* of the signature map,
hence the update had no effect.
This intentially is a minimal CL, in order to allow for easy
backmerging.
More mitigations and tests are coming in a separate CL.

R=titzer@chromium.org

Change-Id: Ifb462093f4b8f4d5380b6774636537c67c2b676c
Reviewed-on: https://chromium-review.googlesource.com/570278
Reviewed-by: Ben Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46664}
2017-07-14 08:42:40 +00:00
Clemens Hammacher
f29cae45ce [wasm] Fix emitting element section in wasm-module-builder.js
We were emitting the table index once in the element section instead of
once per element segment. This did not cause failures because we never
had more than one element segment.
This CL fixes this, and adds a test for more than one segment.

R=rossberg@chromium.org

Change-Id: I13923baf3dae383c72760286e24242d0ad55c4db
Reviewed-on: https://chromium-review.googlesource.com/527155
Reviewed-by: Andreas Rossberg <rossberg@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45857}
2017-06-12 12:45:36 +00:00
gdeepti
930142e877 [wasm] Update table bounds when module is instantiated with a table import
When WebAssembly.Table initial size is greater than the declared initial size, table size references should be updated on instantiate for functions to be called at indices greater than the declared initial size.

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

Review-Url: https://codereview.chromium.org/2661773002
Cr-Commit-Position: refs/heads/master@{#42781}
2017-01-30 18:10:32 +00:00
rossberg
d62914f6e9 [wasm] check that there is at most 1 table
R=titzer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2643783002
Cr-Commit-Position: refs/heads/master@{#42465}
2017-01-18 15:36:22 +00:00
titzer
8d76f0e346 [wasm] Enforce memory and table limits during instantiation.
R=rossberg@chromium.org
BUG=chromium:575167

Review-Url: https://codereview.chromium.org/2636173002
Cr-Commit-Position: refs/heads/master@{#42426}
2017-01-17 19:15:59 +00:00
titzer
7d42244a7e [wasm] Enforce that function bodies end with the \"end\" opcode.
R=rossberg@chromium.org
BUG=chromium:575167

Review-Url: https://codereview.chromium.org/2630553002
Cr-Original-Original-Commit-Position: refs/heads/master@{#42286}
Committed: fcc6e85ec6
Review-Url: https://codereview.chromium.org/2630553002
Cr-Original-Commit-Position: refs/heads/master@{#42315}
Committed: 74a2f9b7d3
Review-Url: https://codereview.chromium.org/2630553002
Cr-Commit-Position: refs/heads/master@{#42350}
2017-01-15 21:18:53 +00:00
gdeepti
ccf0998d63 [wasm] Table.Grow should grow dispatch tables
- Table.Grow updates function, signature table sizes
 - Updates generated code with new base addresses for function, signature tables
 - Relocates size references for correct bounds check

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

Review-Url: https://codereview.chromium.org/2637643002
Cr-Commit-Position: refs/heads/master@{#42349}
2017-01-15 07:46:08 +00:00
titzer
55fc5c0c32 [wasm] Rename wasm::LocalType to wasm::ValueType and kAst* to kWasm*
This is more renaming work to comply with the naming in the public
design repository. E.g. types are called "value types" and we no longer
refer to ASTs.

R=clemensh@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2594993002
Cr-Commit-Position: refs/heads/master@{#41891}
2016-12-21 13:43:00 +00:00
titzer
6e8338865a [wasm] Implement correct 2-level namespace for imports.
R=clemensh@chromium.org
CC=rossberg@chromium.org
BUG=chromium:575167

Review-Url: https://codereview.chromium.org/2591753002
Cr-Commit-Position: refs/heads/master@{#41866}
2016-12-20 15:32:56 +00:00
titzer
f897e36c8c [wasm] Names of exported functions should be the stringified function index.
R=bradnelson@chromium.org,rossberg@chromium.org
BUG=v8:5705

Review-Url: https://codereview.chromium.org/2551323003
Cr-Commit-Position: refs/heads/master@{#41530}
2016-12-06 15:33:42 +00:00
titzer
b7aff1ff64 [wasm] Support for restricted table imports.
This CL implements basic table import functionality.

Missing: growing of tables (WebAssembly.Grow) doesn't change dispatch tables
Missing: allowing larger table imports than minimum size

R=rossberg@chromium.org,bradnelson@chromium.org
BUG=v8:5507

Review-Url: https://codereview.chromium.org/2454503005
Cr-Commit-Position: refs/heads/master@{#40661}
2016-10-29 21:07:38 +00:00
machenbach
bc0ee727df Revert of [wasm] Support for restricted table imports. (patchset #7 id:120001 of https://codereview.chromium.org/2454503005/ )
Reason for revert:
GC stress failures:
https://build.chromium.org/p/client.v8/builders/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/builds/8857

Original issue's description:
> [wasm] Support for restricted table imports.
>
> This CL implements basic table import functionality.
>
> Missing: growing of tables (WebAssembly.Grow) doesn't change dispatch tables
> Missing: allowing larger table imports than minimum size
>
> R=rossberg@chromium.org,bradnelson@chromium.org
> BUG=v8:5507

TBR=bradnelson@chromium.org,rossberg@chromium.org,titzer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:5507

Review-Url: https://codereview.chromium.org/2456193006
Cr-Commit-Position: refs/heads/master@{#40656}
2016-10-28 18:58:54 +00:00
titzer
404e215458 [wasm] Support for restricted table imports.
This CL implements basic table import functionality.

Missing: growing of tables (WebAssembly.Grow) doesn't change dispatch tables
Missing: allowing larger table imports than minimum size

R=rossberg@chromium.org,bradnelson@chromium.org
BUG=v8:5507

Review-Url: https://codereview.chromium.org/2454503005
Cr-Commit-Position: refs/heads/master@{#40652}
2016-10-28 18:03:50 +00:00
titzer
3f207617d7 [wasm] Binary 0xD: update encoding of opcodes, types, and add immediates.
R=ahaas@chromium.org,rossberg@chromium.org,binji@chromium.org,bradnelson@chromium.org
BUG=chromium:575167, chromium:659591

Review-Url: https://codereview.chromium.org/2440953002
Cr-Commit-Position: refs/heads/master@{#40600}
2016-10-26 16:56:49 +00:00
titzer
ad9cf53473 [wasm] Add support for exporting WebAssembly.Table instances.
R=bradnelson@chromium.org, rossberg@chromium.org
BUG=v8:5507

Review-Url: https://codereview.chromium.org/2443353002
Cr-Commit-Position: refs/heads/master@{#40554}
2016-10-25 09:44:51 +00:00