| OLD | NEW |
| 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 Value key = Pop(0, kAstI32); | 858 Value key = Pop(0, kAstI32); |
| 859 if (failed()) break; | 859 if (failed()) break; |
| 860 | 860 |
| 861 SsaEnv* break_env = ssa_env_; | 861 SsaEnv* break_env = ssa_env_; |
| 862 if (operand.table_count > 0) { | 862 if (operand.table_count > 0) { |
| 863 // Build branches to the various blocks based on the table. | 863 // Build branches to the various blocks based on the table. |
| 864 TFNode* sw = BUILD(Switch, operand.table_count + 1, key.node); | 864 TFNode* sw = BUILD(Switch, operand.table_count + 1, key.node); |
| 865 | 865 |
| 866 SsaEnv* copy = Steal(break_env); | 866 SsaEnv* copy = Steal(break_env); |
| 867 ssa_env_ = copy; | 867 ssa_env_ = copy; |
| 868 while (iterator.has_next()) { | 868 while (ok() && iterator.has_next()) { |
| 869 uint32_t i = iterator.cur_index(); | 869 uint32_t i = iterator.cur_index(); |
| 870 const byte* pos = iterator.pc(); | 870 const byte* pos = iterator.pc(); |
| 871 uint32_t target = iterator.next(); | 871 uint32_t target = iterator.next(); |
| 872 if (target >= control_.size()) { | 872 if (target >= control_.size()) { |
| 873 error(pos, "improper branch in br_table"); | 873 error(pos, "improper branch in br_table"); |
| 874 break; | 874 break; |
| 875 } | 875 } |
| 876 ssa_env_ = Split(copy); | 876 ssa_env_ = Split(copy); |
| 877 ssa_env_->control = (i == operand.table_count) | 877 ssa_env_->control = (i == operand.table_count) |
| 878 ? BUILD(IfDefault, sw) | 878 ? BUILD(IfDefault, sw) |
| 879 : BUILD(IfValue, i, sw); | 879 : BUILD(IfValue, i, sw); |
| 880 BreakTo(target); | 880 BreakTo(target); |
| 881 } | 881 } |
| 882 if (failed()) break; |
| 882 } else { | 883 } else { |
| 883 // Only a default target. Do the equivalent of br. | 884 // Only a default target. Do the equivalent of br. |
| 884 const byte* pos = iterator.pc(); | 885 const byte* pos = iterator.pc(); |
| 885 uint32_t target = iterator.next(); | 886 uint32_t target = iterator.next(); |
| 886 if (target >= control_.size()) { | 887 if (target >= control_.size()) { |
| 887 error(pos, "improper branch in br_table"); | 888 error(pos, "improper branch in br_table"); |
| 888 break; | 889 break; |
| 889 } | 890 } |
| 890 BreakTo(target); | 891 BreakTo(target); |
| 891 } | 892 } |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1950 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
| 1950 const byte* start, const byte* end) { | 1951 const byte* start, const byte* end) { |
| 1951 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1952 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
| 1952 WasmFullDecoder decoder(zone, nullptr, body); | 1953 WasmFullDecoder decoder(zone, nullptr, body); |
| 1953 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1954 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
| 1954 } | 1955 } |
| 1955 | 1956 |
| 1956 } // namespace wasm | 1957 } // namespace wasm |
| 1957 } // namespace internal | 1958 } // namespace internal |
| 1958 } // namespace v8 | 1959 } // namespace v8 |
| OLD | NEW |