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

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

Issue 2646093003: [wasm] Unreachability fix for br_table. (Closed)
Patch Set: [wasm] Unreachability fix for br_table. 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
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: {
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 // TODO(titzer): Throw should end control, but currently we build a
688 // (reachable) runtime call instead of connecting it directly to
689 // end.
690 // EndControl();
687 break; 691 break;
688 } 692 }
689 case kExprTry: { 693 case kExprTry: {
690 CHECK_PROTOTYPE_OPCODE(wasm_eh_prototype); 694 CHECK_PROTOTYPE_OPCODE(wasm_eh_prototype);
691 BlockTypeOperand operand(this, pc_); 695 BlockTypeOperand operand(this, pc_);
692 SsaEnv* outer_env = ssa_env_; 696 SsaEnv* outer_env = ssa_env_;
693 SsaEnv* try_env = Steal(outer_env); 697 SsaEnv* try_env = Steal(outer_env);
694 SsaEnv* catch_env = UnreachableEnv(); 698 SsaEnv* catch_env = UnreachableEnv();
695 PushTry(outer_env, catch_env); 699 PushTry(outer_env, catch_env);
696 SetEnv("try_catch:start", try_env); 700 SetEnv("try_catch:start", try_env);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 if (target >= control_.size()) { 950 if (target >= control_.size()) {
947 error(pos, "improper branch in br_table"); 951 error(pos, "improper branch in br_table");
948 break; 952 break;
949 } 953 }
950 BreakTo(target); 954 BreakTo(target);
951 } 955 }
952 // br_table ends the control flow like br. 956 // br_table ends the control flow like br.
953 ssa_env_ = break_env; 957 ssa_env_ = break_env;
954 } 958 }
955 len = 1 + iterator.length(); 959 len = 1 + iterator.length();
960 EndControl();
956 break; 961 break;
957 } 962 }
958 case kExprReturn: { 963 case kExprReturn: {
959 DoReturn(); 964 DoReturn();
960 break; 965 break;
961 } 966 }
962 case kExprUnreachable: { 967 case kExprUnreachable: {
963 BUILD(Unreachable, position()); 968 BUILD(Unreachable, position());
964 EndControl(); 969 EndControl();
965 break; 970 break;
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2017 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2013 const byte* start, const byte* end) { 2018 const byte* start, const byte* end) {
2014 Decoder decoder(start, end); 2019 Decoder decoder(start, end);
2015 return WasmDecoder::AnalyzeLoopAssignment(&decoder, start, 2020 return WasmDecoder::AnalyzeLoopAssignment(&decoder, start,
2016 static_cast<int>(num_locals), zone); 2021 static_cast<int>(num_locals), zone);
2017 } 2022 }
2018 2023
2019 } // namespace wasm 2024 } // namespace wasm
2020 } // namespace internal 2025 } // namespace internal
2021 } // namespace v8 2026 } // 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