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/base/platform/elapsed-timer.h" | 5 #include "src/base/platform/elapsed-timer.h" |
6 #include "src/signature.h" | 6 #include "src/signature.h" |
7 | 7 |
8 #include "src/bit-vector.h" | 8 #include "src/bit-vector.h" |
9 #include "src/flags.h" | 9 #include "src/flags.h" |
10 #include "src/handles.h" | 10 #include "src/handles.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return true; | 193 return true; |
194 } | 194 } |
195 error(pc, pc + 1, "invalid break depth"); | 195 error(pc, pc + 1, "invalid break depth"); |
196 return false; | 196 return false; |
197 } | 197 } |
198 | 198 |
199 bool Validate(const byte* pc, BranchTableOperand& operand, | 199 bool Validate(const byte* pc, BranchTableOperand& operand, |
200 size_t block_depth) { | 200 size_t block_depth) { |
201 // Verify table. | 201 // Verify table. |
202 for (uint32_t i = 0; i < operand.table_count + 1; i++) { | 202 for (uint32_t i = 0; i < operand.table_count + 1; i++) { |
203 uint16_t target = operand.read_entry(this, i); | 203 uint32_t target = operand.read_entry(this, i); |
204 if (target >= block_depth) { | 204 if (target >= block_depth) { |
205 error(operand.table + i * 2, "improper branch in br_table"); | 205 error(operand.table + i * 2, "improper branch in br_table"); |
206 return false; | 206 return false; |
207 } | 207 } |
208 } | 208 } |
209 return true; | 209 return true; |
210 } | 210 } |
211 | 211 |
212 int OpcodeArity(const byte* pc) { | 212 int OpcodeArity(const byte* pc) { |
213 #define DECLARE_ARITY(name, ...) \ | 213 #define DECLARE_ARITY(name, ...) \ |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 bool build_switch = operand.table_count > 0; | 1100 bool build_switch = operand.table_count > 0; |
1101 TFNode* sw = nullptr; | 1101 TFNode* sw = nullptr; |
1102 if (build_switch) { | 1102 if (build_switch) { |
1103 sw = BUILD(Switch, operand.table_count + 1, p->last()->node); | 1103 sw = BUILD(Switch, operand.table_count + 1, p->last()->node); |
1104 } | 1104 } |
1105 | 1105 |
1106 // Process the targets of the break table. | 1106 // Process the targets of the break table. |
1107 SsaEnv* prev = ssa_env_; | 1107 SsaEnv* prev = ssa_env_; |
1108 SsaEnv* copy = Steal(prev); | 1108 SsaEnv* copy = Steal(prev); |
1109 for (uint32_t i = 0; i < operand.table_count + 1; i++) { | 1109 for (uint32_t i = 0; i < operand.table_count + 1; i++) { |
1110 uint16_t target = operand.read_entry(this, i); | 1110 uint32_t target = operand.read_entry(this, i); |
1111 SsaEnv* env = copy; | 1111 SsaEnv* env = copy; |
1112 if (build_switch) { | 1112 if (build_switch) { |
1113 ssa_env_ = env = Split(env); | 1113 ssa_env_ = env = Split(env); |
1114 env->control = i == operand.table_count ? BUILD(IfDefault, sw) | 1114 env->control = i == operand.table_count ? BUILD(IfDefault, sw) |
1115 : BUILD(IfValue, i, sw); | 1115 : BUILD(IfValue, i, sw); |
1116 } | 1116 } |
1117 SsaEnv* tenv = blocks_[blocks_.size() - target - 1].ssa_env; | 1117 SsaEnv* tenv = blocks_[blocks_.size() - target - 1].ssa_env; |
1118 Goto(env, tenv); | 1118 Goto(env, tenv); |
1119 } | 1119 } |
1120 ssa_env_ = prev; | 1120 ssa_env_ = prev; |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1709 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
1710 const byte* start, const byte* end) { | 1710 const byte* start, const byte* end) { |
1711 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1711 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
1712 SR_WasmDecoder decoder(zone, nullptr, body); | 1712 SR_WasmDecoder decoder(zone, nullptr, body); |
1713 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1713 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
1714 } | 1714 } |
1715 | 1715 |
1716 } // namespace wasm | 1716 } // namespace wasm |
1717 } // namespace internal | 1717 } // namespace internal |
1718 } // namespace v8 | 1718 } // namespace v8 |
OLD | NEW |