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 #ifndef V8_WASM_DECODER_H_ | 5 #ifndef V8_WASM_DECODER_H_ |
6 #define V8_WASM_DECODER_H_ | 6 #define V8_WASM_DECODER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 void Reset(const byte* start, const byte* end) { | 272 void Reset(const byte* start, const byte* end) { |
273 start_ = start; | 273 start_ = start; |
274 pc_ = start; | 274 pc_ = start; |
275 limit_ = end; | 275 limit_ = end; |
276 end_ = end; | 276 end_ = end; |
277 error_pc_ = nullptr; | 277 error_pc_ = nullptr; |
278 error_pt_ = nullptr; | 278 error_pt_ = nullptr; |
279 error_msg_.reset(); | 279 error_msg_.reset(); |
280 } | 280 } |
281 | 281 |
282 bool ok() const { return error_pc_ == nullptr; } | 282 bool ok() const { return error_msg_ == nullptr; } |
283 bool failed() const { return !!error_msg_; } | 283 bool failed() const { return !ok(); } |
284 bool more() const { return pc_ < limit_; } | 284 bool more() const { return pc_ < limit_; } |
285 | 285 |
286 const byte* start() { return start_; } | 286 const byte* start() { return start_; } |
287 const byte* pc() { return pc_; } | 287 const byte* pc() { return pc_; } |
288 uint32_t pc_offset() { return static_cast<uint32_t>(pc_ - start_); } | 288 uint32_t pc_offset() { return static_cast<uint32_t>(pc_ - start_); } |
289 | 289 |
290 protected: | 290 protected: |
291 const byte* start_; | 291 const byte* start_; |
292 const byte* pc_; | 292 const byte* pc_; |
293 const byte* limit_; | 293 const byte* limit_; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return traceOffEnd<uint32_t>(); | 391 return traceOffEnd<uint32_t>(); |
392 } | 392 } |
393 }; | 393 }; |
394 | 394 |
395 #undef TRACE | 395 #undef TRACE |
396 } // namespace wasm | 396 } // namespace wasm |
397 } // namespace internal | 397 } // namespace internal |
398 } // namespace v8 | 398 } // namespace v8 |
399 | 399 |
400 #endif // V8_WASM_DECODER_H_ | 400 #endif // V8_WASM_DECODER_H_ |
OLD | NEW |