Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1693)

Unified Diff: src/wasm/ast-decoder.cc

Issue 1624323003: [wasm] Put the condition last in kExprSelect. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.cc
diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc
index 93129f6d2f419f5f63294836d366e04c9836a1f4..968a45696471598fe04fd58aefc05302efbf3246 100644
--- a/src/wasm/ast-decoder.cc
+++ b/src/wasm/ast-decoder.cc
@@ -964,26 +964,26 @@ class LR_WasmDecoder : public WasmDecoder {
}
case kExprSelect: {
if (p->index == 1) {
- // Condition done.
- TypeCheckLast(p, kAstI32);
- } else if (p->index == 2) {
// True expression done.
p->tree->type = p->last()->type;
if (p->tree->type == kAstStmt) {
error(p->pc(), p->tree->children[1]->pc,
"select operand should be expression");
}
- } else {
+ } else if (p->index == 2) {
// False expression done.
- DCHECK(p->done());
TypeCheckLast(p, p->tree->type);
+ } else {
+ // Condition done.
+ DCHECK(p->done());
+ TypeCheckLast(p, kAstI32);
if (build()) {
TFNode* controls[2];
- builder_->Branch(p->tree->children[0]->node, &controls[0],
+ builder_->Branch(p->tree->children[2]->node, &controls[0],
&controls[1]);
TFNode* merge = builder_->Merge(2, controls);
- TFNode* vals[2] = {p->tree->children[1]->node,
- p->tree->children[2]->node};
+ TFNode* vals[2] = {p->tree->children[0]->node,
+ p->tree->children[1]->node};
TFNode* phi = builder_->Phi(p->tree->type, 2, vals, merge);
p->tree->node = phi;
ssa_env_->control = merge;
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698