Commit 54040fff authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Reland "[wasm] Refactor function body decoder"

This is a reland of 6b4dc039
Original change's description:
> [wasm] Refactor function body decoder
> 
> This refactoring separates graph building from wasm decoding. The
> WasmGraphBuilder is just a consumer of the decoded information.
> Decoding without any consumer (i.e. just validation) gets 16% faster by
> this refactoring, because no TFNode* have to be stored in the value
> stack, and all dynamic tests to determine whether the graph should be
> build are gone (measured on AngryBots; before: 110.2 +- 3.3ms, after:
> 92.2 +- 3.1 ms).
> 
> This new design will allow us to also attach other consumers, e.g. a
> new baseline compiler.
> 
> R=titzer@chromium.org
> 
> Bug: v8:6600
> Change-Id: I4b60f2409d871a16c3c52a37e515bcfb9dbb8f54
> Reviewed-on: https://chromium-review.googlesource.com/571010
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Reviewed-by: Ben Titzer <titzer@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#47671}

TBR=titzer@chromium.org

Bug: v8:6600
Change-Id: Idd867c5a1917437de5b6e3de5917cc1c9f194489
Reviewed-on: https://chromium-review.googlesource.com/640591Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47678}
parent 5c9f0831
...@@ -3777,8 +3777,7 @@ Node* WasmGraphBuilder::Simd8x16ShuffleOp(const uint8_t shuffle[16], ...@@ -3777,8 +3777,7 @@ Node* WasmGraphBuilder::Simd8x16ShuffleOp(const uint8_t shuffle[16],
V(I32AtomicCompareExchange8U, CompareExchange, Uint8) \ V(I32AtomicCompareExchange8U, CompareExchange, Uint8) \
V(I32AtomicCompareExchange16U, CompareExchange, Uint16) V(I32AtomicCompareExchange16U, CompareExchange, Uint16)
Node* WasmGraphBuilder::AtomicOp(wasm::WasmOpcode opcode, Node* WasmGraphBuilder::AtomicOp(wasm::WasmOpcode opcode, Node* const* inputs,
const NodeVector& inputs,
wasm::WasmCodePosition position) { wasm::WasmCodePosition position) {
Node* node; Node* node;
switch (opcode) { switch (opcode) {
......
...@@ -315,7 +315,7 @@ class WasmGraphBuilder { ...@@ -315,7 +315,7 @@ class WasmGraphBuilder {
Node* Simd8x16ShuffleOp(const uint8_t shuffle[16], Node* const* inputs); Node* Simd8x16ShuffleOp(const uint8_t shuffle[16], Node* const* inputs);
Node* AtomicOp(wasm::WasmOpcode opcode, const NodeVector& inputs, Node* AtomicOp(wasm::WasmOpcode opcode, Node* const* inputs,
wasm::WasmCodePosition position); wasm::WasmCodePosition position);
bool has_simd() const { return has_simd_; } bool has_simd() const { return has_simd_; }
......
This diff is collapsed.
This diff is collapsed.
...@@ -34,6 +34,8 @@ assertFalse(test_throw === 0); ...@@ -34,6 +34,8 @@ assertFalse(test_throw === 0);
assertEquals("object", typeof test_throw.exports); assertEquals("object", typeof test_throw.exports);
assertEquals("function", typeof test_throw.exports.throw_if_param_not_zero); assertEquals("function", typeof test_throw.exports.throw_if_param_not_zero);
/* TODO(kschimpf) Convert these tests to work for the proposed exceptions.
// Test expected behavior of throws // Test expected behavior of throws
assertEquals(1, test_throw.exports.throw_if_param_not_zero(0)); assertEquals(1, test_throw.exports.throw_if_param_not_zero(0));
assertWasmThrows([], function() { test_throw.exports.throw_if_param_not_zero(10) }); assertWasmThrows([], function() { test_throw.exports.throw_if_param_not_zero(10) });
...@@ -72,8 +74,6 @@ assertEquals("function", typeof test_catch.exports.simple_throw_catch_to_0_1); ...@@ -72,8 +74,6 @@ assertEquals("function", typeof test_catch.exports.simple_throw_catch_to_0_1);
assertEquals(0, test_catch.exports.simple_throw_catch_to_0_1(0)); assertEquals(0, test_catch.exports.simple_throw_catch_to_0_1(0));
assertEquals(1, test_catch.exports.simple_throw_catch_to_0_1(1)); assertEquals(1, test_catch.exports.simple_throw_catch_to_0_1(1));
/* TODO(kschimpf) Convert these tests to work for the proposed exceptions.
// The following methods do not attempt to catch the exception they raise. // The following methods do not attempt to catch the exception they raise.
var test_throw = (function () { var test_throw = (function () {
var builder = new WasmModuleBuilder(); var builder = new WasmModuleBuilder();
......
...@@ -2442,17 +2442,17 @@ class WasmOpcodeLengthTest : public TestWithZone { ...@@ -2442,17 +2442,17 @@ class WasmOpcodeLengthTest : public TestWithZone {
TEST_F(WasmOpcodeLengthTest, Statements) { TEST_F(WasmOpcodeLengthTest, Statements) {
EXPECT_LENGTH(1, kExprNop); EXPECT_LENGTH(1, kExprNop);
EXPECT_LENGTH(2, kExprBlock);
EXPECT_LENGTH(2, kExprLoop);
EXPECT_LENGTH(2, kExprIf);
EXPECT_LENGTH(1, kExprElse); EXPECT_LENGTH(1, kExprElse);
EXPECT_LENGTH(1, kExprEnd); EXPECT_LENGTH(1, kExprEnd);
EXPECT_LENGTH(1, kExprSelect); EXPECT_LENGTH(1, kExprSelect);
EXPECT_LENGTH(2, kExprBr); EXPECT_LENGTH(2, kExprBr);
EXPECT_LENGTH(2, kExprBrIf); EXPECT_LENGTH(2, kExprBrIf);
EXPECT_LENGTH(2, kExprThrow); EXPECT_LENGTH(2, kExprThrow);
EXPECT_LENGTH(2, kExprTry);
EXPECT_LENGTH(2, kExprCatch); EXPECT_LENGTH(2, kExprCatch);
EXPECT_LENGTH_N(2, kExprBlock, kLocalI32);
EXPECT_LENGTH_N(2, kExprLoop, kLocalI32);
EXPECT_LENGTH_N(2, kExprIf, kLocalI32);
EXPECT_LENGTH_N(2, kExprTry, kLocalI32);
} }
TEST_F(WasmOpcodeLengthTest, MiscExpressions) { TEST_F(WasmOpcodeLengthTest, MiscExpressions) {
......
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