Commit 04246dcc authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Clean up SetBlockType

Remove redundant argument, add a DCHECK and explicitly specify the
capture list of the lambdas.

R=ahaas@chromium.org

Bug: v8:7570
Change-Id: I09fc6004ffc5cdc7b4c153748ed95e86ae85aaa2
Reviewed-on: https://chromium-review.googlesource.com/998098Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52430}
parent 378e8846
...@@ -1417,7 +1417,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1417,7 +1417,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
if (!LookupBlockType(&operand)) break; if (!LookupBlockType(&operand)) break;
PopArgs(operand.sig); PopArgs(operand.sig);
auto* block = PushBlock(); auto* block = PushBlock();
SetBlockType(block, operand, args_); SetBlockType(block, operand);
CALL_INTERFACE_IF_REACHABLE(Block, block); CALL_INTERFACE_IF_REACHABLE(Block, block);
PushMergeValues(block, &block->start_merge); PushMergeValues(block, &block->start_merge);
len = 1 + operand.length; len = 1 + operand.length;
...@@ -1446,7 +1446,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1446,7 +1446,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
if (!LookupBlockType(&operand)) break; if (!LookupBlockType(&operand)) break;
PopArgs(operand.sig); PopArgs(operand.sig);
auto* try_block = PushTry(); auto* try_block = PushTry();
SetBlockType(try_block, operand, args_); SetBlockType(try_block, operand);
len = 1 + operand.length; len = 1 + operand.length;
CALL_INTERFACE_IF_REACHABLE(Try, try_block); CALL_INTERFACE_IF_REACHABLE(Try, try_block);
PushMergeValues(try_block, &try_block->start_merge); PushMergeValues(try_block, &try_block->start_merge);
...@@ -1500,7 +1500,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1500,7 +1500,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
if (!LookupBlockType(&operand)) break; if (!LookupBlockType(&operand)) break;
PopArgs(operand.sig); PopArgs(operand.sig);
auto* block = PushLoop(); auto* block = PushLoop();
SetBlockType(&control_.back(), operand, args_); SetBlockType(&control_.back(), operand);
len = 1 + operand.length; len = 1 + operand.length;
CALL_INTERFACE_IF_REACHABLE(Loop, block); CALL_INTERFACE_IF_REACHABLE(Loop, block);
PushMergeValues(block, &block->start_merge); PushMergeValues(block, &block->start_merge);
...@@ -1513,7 +1513,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1513,7 +1513,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
PopArgs(operand.sig); PopArgs(operand.sig);
if (!this->ok()) break; if (!this->ok()) break;
auto* if_block = PushIf(); auto* if_block = PushIf();
SetBlockType(if_block, operand, args_); SetBlockType(if_block, operand);
CALL_INTERFACE_IF_REACHABLE(If, cond, if_block); CALL_INTERFACE_IF_REACHABLE(If, cond, if_block);
len = 1 + operand.length; len = 1 + operand.length;
PushMergeValues(if_block, &if_block->start_merge); PushMergeValues(if_block, &if_block->start_merge);
...@@ -2030,13 +2030,15 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -2030,13 +2030,15 @@ class WasmFullDecoder : public WasmDecoder<validate> {
} }
} }
void SetBlockType(Control* c, BlockTypeOperand<validate>& operand, void SetBlockType(Control* c, BlockTypeOperand<validate>& operand) {
ZoneVector<Value>& params) { DCHECK_EQ(operand.in_arity(), this->args_.size());
InitMerge(&c->end_merge, operand.out_arity(), const byte* pc = this->pc_;
[&] (uint32_t i) { Value* args = this->args_.data();
return Value::New(this->pc_, operand.out_type(i)); }); InitMerge(&c->end_merge, operand.out_arity(), [pc, &operand](uint32_t i) {
return Value::New(pc, operand.out_type(i));
});
InitMerge(&c->start_merge, operand.in_arity(), InitMerge(&c->start_merge, operand.in_arity(),
[&] (uint32_t i) { return params[i]; }); [args](uint32_t i) { return args[i]; });
} }
// Pops arguments as required by signature into {args_}. // Pops arguments as required by signature into {args_}.
......
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