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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/platform/elapsed-timer.h" 5 #include "src/base/platform/elapsed-timer.h"
6 #include "src/signature.h" 6 #include "src/signature.h"
7 7
8 #include "src/bit-vector.h" 8 #include "src/bit-vector.h"
9 #include "src/flags.h" 9 #include "src/flags.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 // False expr done. 957 // False expr done.
958 IfEnv* env = &ifs_.back(); 958 IfEnv* env = &ifs_.back();
959 MergeIntoProduction(p, env->merge_env, p->last()); 959 MergeIntoProduction(p, env->merge_env, p->last());
960 SetEnv("if_else:merge", env->merge_env); 960 SetEnv("if_else:merge", env->merge_env);
961 ifs_.pop_back(); 961 ifs_.pop_back();
962 } 962 }
963 break; 963 break;
964 } 964 }
965 case kExprSelect: { 965 case kExprSelect: {
966 if (p->index == 1) { 966 if (p->index == 1) {
967 // Condition done.
968 TypeCheckLast(p, kAstI32);
969 } else if (p->index == 2) {
970 // True expression done. 967 // True expression done.
971 p->tree->type = p->last()->type; 968 p->tree->type = p->last()->type;
972 if (p->tree->type == kAstStmt) { 969 if (p->tree->type == kAstStmt) {
973 error(p->pc(), p->tree->children[1]->pc, 970 error(p->pc(), p->tree->children[1]->pc,
974 "select operand should be expression"); 971 "select operand should be expression");
975 } 972 }
973 } else if (p->index == 2) {
974 // False expression done.
975 TypeCheckLast(p, p->tree->type);
976 } else { 976 } else {
977 // False expression done. 977 // Condition done.
978 DCHECK(p->done()); 978 DCHECK(p->done());
979 TypeCheckLast(p, p->tree->type); 979 TypeCheckLast(p, kAstI32);
980 if (build()) { 980 if (build()) {
981 TFNode* controls[2]; 981 TFNode* controls[2];
982 builder_->Branch(p->tree->children[0]->node, &controls[0], 982 builder_->Branch(p->tree->children[2]->node, &controls[0],
983 &controls[1]); 983 &controls[1]);
984 TFNode* merge = builder_->Merge(2, controls); 984 TFNode* merge = builder_->Merge(2, controls);
985 TFNode* vals[2] = {p->tree->children[1]->node, 985 TFNode* vals[2] = {p->tree->children[0]->node,
986 p->tree->children[2]->node}; 986 p->tree->children[1]->node};
987 TFNode* phi = builder_->Phi(p->tree->type, 2, vals, merge); 987 TFNode* phi = builder_->Phi(p->tree->type, 2, vals, merge);
988 p->tree->node = phi; 988 p->tree->node = phi;
989 ssa_env_->control = merge; 989 ssa_env_->control = merge;
990 } 990 }
991 } 991 }
992 break; 992 break;
993 } 993 }
994 case kExprBr: { 994 case kExprBr: {
995 BreakDepthOperand operand(this, p->pc()); 995 BreakDepthOperand operand(this, p->pc());
996 CHECK(Validate(p->pc(), operand, blocks_)); 996 CHECK(Validate(p->pc(), operand, blocks_));
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 1654
1655 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, FunctionEnv* env, 1655 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, FunctionEnv* env,
1656 const byte* start, const byte* end) { 1656 const byte* start, const byte* end) {
1657 LoopAssignmentAnalyzer analyzer(zone, env); 1657 LoopAssignmentAnalyzer analyzer(zone, env);
1658 return analyzer.Analyze(start, end); 1658 return analyzer.Analyze(start, end);
1659 } 1659 }
1660 1660
1661 } // namespace wasm 1661 } // namespace wasm
1662 } // namespace internal 1662 } // namespace internal
1663 } // namespace v8 1663 } // namespace v8
OLDNEW
« 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