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

Side by Side Diff: src/wasm/ast-decoder.cc

Issue 2403013002: [wasm] Do not create TF nodes during verification (Closed)
Patch Set: Only guard CreateOrMergeIntoPhi. Created 4 years, 2 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/mjsunit/regress/wasm/regression-654377.js » ('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/signature.h" 5 #include "src/signature.h"
6 6
7 #include "src/bit-vector.h" 7 #include "src/bit-vector.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/zone/zone-containers.h" 10 #include "src/zone/zone-containers.h"
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 1433
1434 for (unsigned i = 0; i < c->merge.arity; i++) { 1434 for (unsigned i = 0; i < c->merge.arity; i++) {
1435 Value& val = GetMergeValueFromStack(c, i); 1435 Value& val = GetMergeValueFromStack(c, i);
1436 Value& old = 1436 Value& old =
1437 c->merge.arity == 1 ? c->merge.vals.first : c->merge.vals.array[i]; 1437 c->merge.arity == 1 ? c->merge.vals.first : c->merge.vals.array[i];
1438 if (val.type != old.type) { 1438 if (val.type != old.type) {
1439 error(pc_, pc_, "type error in merge[%d] (expected %s, got %s)", i, 1439 error(pc_, pc_, "type error in merge[%d] (expected %s, got %s)", i,
1440 WasmOpcodes::TypeName(old.type), WasmOpcodes::TypeName(val.type)); 1440 WasmOpcodes::TypeName(old.type), WasmOpcodes::TypeName(val.type));
1441 return; 1441 return;
1442 } 1442 }
1443 old.node = 1443 if (builder_) {
1444 first ? val.node : CreateOrMergeIntoPhi(old.type, target->control, 1444 old.node =
1445 old.node, val.node); 1445 first ? val.node : CreateOrMergeIntoPhi(old.type, target->control,
1446 old.node, val.node);
1447 } else {
1448 old.node = nullptr;
1449 }
1446 } 1450 }
1447 } 1451 }
1448 1452
1449 void SetEnv(const char* reason, SsaEnv* env) { 1453 void SetEnv(const char* reason, SsaEnv* env) {
1450 #if DEBUG 1454 #if DEBUG
1451 if (FLAG_trace_wasm_decoder) { 1455 if (FLAG_trace_wasm_decoder) {
1452 char state = 'X'; 1456 char state = 'X';
1453 if (env) { 1457 if (env) {
1454 switch (env->state) { 1458 switch (env->state) {
1455 case SsaEnv::kReached: 1459 case SsaEnv::kReached:
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 break; 1596 break;
1593 } 1597 }
1594 default: 1598 default:
1595 UNREACHABLE(); 1599 UNREACHABLE();
1596 } 1600 }
1597 return from->Kill(); 1601 return from->Kill();
1598 } 1602 }
1599 1603
1600 TFNode* CreateOrMergeIntoPhi(LocalType type, TFNode* merge, TFNode* tnode, 1604 TFNode* CreateOrMergeIntoPhi(LocalType type, TFNode* merge, TFNode* tnode,
1601 TFNode* fnode) { 1605 TFNode* fnode) {
1606 DCHECK_NOT_NULL(builder_);
1602 if (builder_->IsPhiWithMerge(tnode, merge)) { 1607 if (builder_->IsPhiWithMerge(tnode, merge)) {
1603 builder_->AppendToPhi(tnode, fnode); 1608 builder_->AppendToPhi(tnode, fnode);
1604 } else if (tnode != fnode) { 1609 } else if (tnode != fnode) {
1605 uint32_t count = builder_->InputCount(merge); 1610 uint32_t count = builder_->InputCount(merge);
1606 TFNode** vals = builder_->Buffer(count); 1611 TFNode** vals = builder_->Buffer(count);
1607 for (uint32_t j = 0; j < count - 1; j++) vals[j] = tnode; 1612 for (uint32_t j = 0; j < count - 1; j++) vals[j] = tnode;
1608 vals[count - 1] = fnode; 1613 vals[count - 1] = fnode;
1609 return builder_->Phi(type, count, vals, merge); 1614 return builder_->Phi(type, count, vals, merge);
1610 } 1615 }
1611 return tnode; 1616 return tnode;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1941 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1937 const byte* start, const byte* end) { 1942 const byte* start, const byte* end) {
1938 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1943 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1939 WasmFullDecoder decoder(zone, nullptr, body); 1944 WasmFullDecoder decoder(zone, nullptr, body);
1940 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1945 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1941 } 1946 }
1942 1947
1943 } // namespace wasm 1948 } // namespace wasm
1944 } // namespace internal 1949 } // namespace internal
1945 } // namespace v8 1950 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/wasm/regression-654377.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698