Commit fa7d1f8f authored by titzer's avatar titzer Committed by Commit bot

[wasm] Accept version 0x1 binaries.

R=rossberg@chromium.org,bradnelson@chromium.org
BUG=chromium:575167, chromium:690281

Review-Url: https://codereview.chromium.org/2681993003
Cr-Commit-Position: refs/heads/master@{#43048}
parent 01882d7f
......@@ -238,7 +238,8 @@ class ModuleDecoder : public Decoder {
pos = pc_;
{
uint32_t magic_version = consume_u32("wasm version");
if (magic_version != kWasmVersion) {
if (magic_version != kWasmVersion &&
magic_version != kWasmLegacyVersion) {
error(pos, pos,
"expected version %02x %02x %02x %02x, "
"found %02x %02x %02x %02x",
......
......@@ -35,7 +35,9 @@ namespace wasm {
class ErrorThrower;
const uint32_t kWasmMagic = 0x6d736100;
const uint32_t kWasmVersion = 0x0d;
const uint32_t kWasmVersion = 0x01;
// Legacy version supported for short transitionary period.
const uint32_t kWasmLegacyVersion = 0x0d;
const uint8_t kWasmFunctionTypeForm = 0x60;
const uint8_t kWasmAnyFunctionTypeForm = 0x70;
......
Running testFunction...
Script nr 0 parsed. URL: v8://test/setup
Script nr 1 parsed. URL: v8://test/runTestFunction
Script nr 2 parsed. URL: wasm://wasm/wasm-824d794e/wasm-824d794e-0
Script nr 2 parsed. URL: wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0
This is a wasm script (nr 0).
Script nr 3 parsed. URL: wasm://wasm/wasm-824d794e/wasm-824d794e-1
Script nr 3 parsed. URL: wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1
This is a wasm script (nr 1).
Querying breakable locations for all wasm scripts now...
Requesting all breakable locations in wasm script 0
......@@ -37,51 +37,51 @@ Requesting breakable locations in lines [4,6)
[0] 4:6 || >call 0
[1] 5:4 || >end
Setting a breakpoint on each breakable location...
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-0:2:2
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:2:2
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-0:3:2
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:3:2
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-0:4:2
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:4:2
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-0:5:0
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:5:0
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-1:1:2
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:1:2
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-1:2:2
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:2:2
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-1:3:4
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:3:4
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-1:4:6
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:4:6
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-1:5:4
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:5:4
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-1:6:2
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:6:2
Success!
Setting at wasm://wasm/wasm-824d794e/wasm-824d794e-1:7:0
Setting at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:7:0
Success!
Running wasm code...
Missing breakpoints: 11
Script nr 4 parsed. URL: v8://test/runWasm
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-1:1:2
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:1:2
Missing breakpoints: 10
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-1:2:2
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:2:2
Missing breakpoints: 9
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-1:3:4
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:3:4
Missing breakpoints: 8
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-1:4:6
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:4:6
Missing breakpoints: 7
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-0:2:2
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:2:2
Missing breakpoints: 6
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-0:3:2
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:3:2
Missing breakpoints: 5
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-0:4:2
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:4:2
Missing breakpoints: 4
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-0:5:0
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-0:5:0
Missing breakpoints: 3
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-1:5:4
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:5:4
Missing breakpoints: 2
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-1:6:2
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:6:2
Missing breakpoints: 1
Stopped at wasm://wasm/wasm-824d794e/wasm-824d794e-1:7:0
Stopped at wasm://wasm/wasm-eb3c2032/wasm-eb3c2032-1:7:0
Missing breakpoints: 0
Finished!
Check that inspector gets two wasm scripts at module creation time.
Script #0 parsed. URL: v8://test/testFunction
Script #1 parsed. URL: v8://test/runTestRunction
Script #2 parsed. URL: wasm://wasm/wasm-e783515e/wasm-e783515e-0
Script #3 parsed. URL: wasm://wasm/wasm-e783515e/wasm-e783515e-1
Source for wasm://wasm/wasm-e783515e/wasm-e783515e-0:
Script #2 parsed. URL: wasm://wasm/wasm-4205e2ce/wasm-4205e2ce-0
Script #3 parsed. URL: wasm://wasm/wasm-4205e2ce/wasm-4205e2ce-1
Source for wasm://wasm/wasm-4205e2ce/wasm-4205e2ce-0:
func $nopFunction
nop
end
Source for wasm://wasm/wasm-e783515e/wasm-e783515e-1:
Source for wasm://wasm/wasm-4205e2ce/wasm-4205e2ce-1:
func $main
block
i32.const 2
......
......@@ -2,10 +2,10 @@ Installing code an global variable.
Calling instantiate function.
Waiting for two wasm scripts to be parsed.
Ignoring script with url v8://test/callInstantiate
Got wasm script: wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0
Requesting source for wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0...
Got wasm script: wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1
Requesting source for wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1...
Got wasm script: wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0
Requesting source for wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0...
Got wasm script: wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1
Requesting source for wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1...
func $wasm_A
nop
nop
......@@ -25,59 +25,59 @@ func $wasm_B (param i32)
end
end
Setting breakpoint on line 7 (on the setlocal before the call), url wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1
Setting breakpoint on line 7 (on the setlocal before the call), url wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1
{
columnNumber : 6
lineNumber : 7
scriptId : <scriptId>
}
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:7:6: >set_local 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:7:6: >set_local 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:8:6: >call 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:8:6: >call 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0:1:2: >nop
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0:1:2: >nop
Step action: stepOver
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0:2:2: >nop
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0:2:2: >nop
Step action: stepOut
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:9:6: >br 1
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:9:6: >br 1
Step action: stepOut
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:7:6: >set_local 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:7:6: >set_local 0
Step action: stepOver
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:8:6: >call 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:8:6: >call 0
Step action: stepOver
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:9:6: >br 1
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:9:6: >br 1
Step action: resume
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:7:6: >set_local 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:7:6: >set_local 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:8:6: >call 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:8:6: >call 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0:1:2: >nop
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0:1:2: >nop
Step action: stepOut
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:9:6: >br 1
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:9:6: >br 1
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:1:2: >loop
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:1:2: >loop
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:2:4: >get_local 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:2:4: >get_local 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:3:4: >if
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:3:4: >if
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:4:6: >get_local 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:4:6: >get_local 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:5:6: >i32.const 1
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:5:6: >i32.const 1
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:6:6: >i32.sub
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:6:6: >i32.sub
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:7:6: >set_local 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:7:6: >set_local 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:8:6: >call 0
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:8:6: >call 0
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0:1:2: >nop
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0:1:2: >nop
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0:2:2: >nop
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0:2:2: >nop
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-0:3:0: >end
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-0:3:0: >end
Step action: stepInto
Paused at wasm://wasm/wasm-ccfaf3fa/wasm-ccfaf3fa-1:9:6: >br 1
Paused at wasm://wasm/wasm-0e9ccf72/wasm-0e9ccf72-1:9:6: >br 1
Step action: resume
exports.main returned!
Finished!
......@@ -21,7 +21,7 @@ var kWasmH1 = 0x61;
var kWasmH2 = 0x73;
var kWasmH3 = 0x6d;
var kWasmV0 = 0xD;
var kWasmV0 = 0x1;
var kWasmV1 = 0;
var kWasmV2 = 0;
var kWasmV3 = 0;
......
......@@ -2556,9 +2556,9 @@ bool ValueSerializerTestWithWasm::g_saved_flag = false;
// A simple module which exports an "increment" function.
// Copied from test/mjsunit/wasm/incrementer.wasm.
const unsigned char kIncrementerWasm[] = {
0, 97, 115, 109, 13, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127,
3, 2, 1, 0, 7, 13, 1, 9, 105, 110, 99, 114, 101, 109, 101, 110,
116, 0, 0, 10, 9, 1, 7, 0, 32, 0, 65, 1, 106, 11,
0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127,
3, 2, 1, 0, 7, 13, 1, 9, 105, 110, 99, 114, 101, 109, 101, 110,
116, 0, 0, 10, 9, 1, 7, 0, 32, 0, 65, 1, 106, 11,
};
TEST_F(ValueSerializerTestWithWasm, RoundTripWasmModule) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment