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

Side by Side Diff: src/wasm/function-body-decoder.cc

Issue 2646093003: [wasm] Unreachability fix for br_table. (Closed)
Patch Set: Created 3 years, 11 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/unittests/wasm/function-body-decoder-unittest.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/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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 case kExprBlock: { 673 case kExprBlock: {
674 // The break environment is the outer environment. 674 // The break environment is the outer environment.
675 BlockTypeOperand operand(this, pc_); 675 BlockTypeOperand operand(this, pc_);
676 SsaEnv* break_env = ssa_env_; 676 SsaEnv* break_env = ssa_env_;
677 PushBlock(break_env); 677 PushBlock(break_env);
678 SetEnv("block:start", Steal(break_env)); 678 SetEnv("block:start", Steal(break_env));
679 SetBlockType(&control_.back(), operand); 679 SetBlockType(&control_.back(), operand);
680 len = 1 + operand.length; 680 len = 1 + operand.length;
681 break; 681 break;
682 } 682 }
683 case kExprThrow: { 683 case kExprThrow: {
rossberg 2017/01/20 13:14:29 Does this need an EndControl, too?
684 CHECK_PROTOTYPE_OPCODE(wasm_eh_prototype); 684 CHECK_PROTOTYPE_OPCODE(wasm_eh_prototype);
685 Value value = Pop(0, kWasmI32); 685 Value value = Pop(0, kWasmI32);
686 BUILD(Throw, value.node); 686 BUILD(Throw, value.node);
687 break; 687 break;
688 } 688 }
689 case kExprTry: { 689 case kExprTry: {
690 CHECK_PROTOTYPE_OPCODE(wasm_eh_prototype); 690 CHECK_PROTOTYPE_OPCODE(wasm_eh_prototype);
691 BlockTypeOperand operand(this, pc_); 691 BlockTypeOperand operand(this, pc_);
692 SsaEnv* outer_env = ssa_env_; 692 SsaEnv* outer_env = ssa_env_;
693 SsaEnv* try_env = Steal(outer_env); 693 SsaEnv* try_env = Steal(outer_env);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 if (target >= control_.size()) { 946 if (target >= control_.size()) {
947 error(pos, "improper branch in br_table"); 947 error(pos, "improper branch in br_table");
948 break; 948 break;
949 } 949 }
950 BreakTo(target); 950 BreakTo(target);
951 } 951 }
952 // br_table ends the control flow like br. 952 // br_table ends the control flow like br.
953 ssa_env_ = break_env; 953 ssa_env_ = break_env;
954 } 954 }
955 len = 1 + iterator.length(); 955 len = 1 + iterator.length();
956 EndControl();
956 break; 957 break;
957 } 958 }
958 case kExprReturn: { 959 case kExprReturn: {
959 DoReturn(); 960 DoReturn();
960 break; 961 break;
961 } 962 }
962 case kExprUnreachable: { 963 case kExprUnreachable: {
963 BUILD(Unreachable, position()); 964 BUILD(Unreachable, position());
964 EndControl(); 965 EndControl();
965 break; 966 break;
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2013 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2013 const byte* start, const byte* end) { 2014 const byte* start, const byte* end) {
2014 Decoder decoder(start, end); 2015 Decoder decoder(start, end);
2015 return WasmDecoder::AnalyzeLoopAssignment(&decoder, start, 2016 return WasmDecoder::AnalyzeLoopAssignment(&decoder, start,
2016 static_cast<int>(num_locals), zone); 2017 static_cast<int>(num_locals), zone);
2017 } 2018 }
2018 2019
2019 } // namespace wasm 2020 } // namespace wasm
2020 } // namespace internal 2021 } // namespace internal
2021 } // namespace v8 2022 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/wasm/function-body-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698