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

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

Issue 2416873002: [wasm] Do not generate a loop stack check upon a decoder error. (Closed)
Patch Set: comments addressed 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/loop-stack-check.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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 SsaEnv* PrepareForLoop(const byte* pc, SsaEnv* env) { 1620 SsaEnv* PrepareForLoop(const byte* pc, SsaEnv* env) {
1621 if (!builder_) return Split(env); 1621 if (!builder_) return Split(env);
1622 if (!env->go()) return Split(env); 1622 if (!env->go()) return Split(env);
1623 env->state = SsaEnv::kMerged; 1623 env->state = SsaEnv::kMerged;
1624 1624
1625 env->control = builder_->Loop(env->control); 1625 env->control = builder_->Loop(env->control);
1626 env->effect = builder_->EffectPhi(1, &env->effect, env->control); 1626 env->effect = builder_->EffectPhi(1, &env->effect, env->control);
1627 builder_->Terminate(env->effect, env->control); 1627 builder_->Terminate(env->effect, env->control);
1628 if (FLAG_wasm_loop_assignment_analysis) { 1628 if (FLAG_wasm_loop_assignment_analysis) {
1629 BitVector* assigned = AnalyzeLoopAssignment(pc); 1629 BitVector* assigned = AnalyzeLoopAssignment(pc);
1630 if (failed()) return env;
1630 if (assigned != nullptr) { 1631 if (assigned != nullptr) {
1631 // Only introduce phis for variables assigned in this loop. 1632 // Only introduce phis for variables assigned in this loop.
1632 for (int i = EnvironmentCount() - 1; i >= 0; i--) { 1633 for (int i = EnvironmentCount() - 1; i >= 0; i--) {
1633 if (!assigned->Contains(i)) continue; 1634 if (!assigned->Contains(i)) continue;
1634 env->locals[i] = builder_->Phi(local_type_vec_[i], 1, &env->locals[i], 1635 env->locals[i] = builder_->Phi(local_type_vec_[i], 1, &env->locals[i],
1635 env->control); 1636 env->control);
1636 } 1637 }
1637 SsaEnv* loop_body_env = Split(env); 1638 SsaEnv* loop_body_env = Split(env);
1638 builder_->StackCheck(position(), &(loop_body_env->effect), 1639 builder_->StackCheck(position(), &(loop_body_env->effect),
1639 &(loop_body_env->control)); 1640 &(loop_body_env->control));
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1951 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1951 const byte* start, const byte* end) { 1952 const byte* start, const byte* end) {
1952 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1953 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1953 WasmFullDecoder decoder(zone, nullptr, body); 1954 WasmFullDecoder decoder(zone, nullptr, body);
1954 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1955 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1955 } 1956 }
1956 1957
1957 } // namespace wasm 1958 } // namespace wasm
1958 } // namespace internal 1959 } // namespace internal
1959 } // namespace v8 1960 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/wasm/loop-stack-check.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698