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 "src/base/smart-pointers.h" | 8 #include "src/base/smart-pointers.h" |
9 #include "src/flags.h" | 9 #include "src/flags.h" |
10 #include "src/signature.h" | 10 #include "src/signature.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 start_ = start; | 322 start_ = start; |
323 pc_ = start; | 323 pc_ = start; |
324 limit_ = end; | 324 limit_ = end; |
325 end_ = end; | 325 end_ = end; |
326 error_pc_ = nullptr; | 326 error_pc_ = nullptr; |
327 error_pt_ = nullptr; | 327 error_pt_ = nullptr; |
328 error_msg_.Reset(nullptr); | 328 error_msg_.Reset(nullptr); |
329 } | 329 } |
330 | 330 |
331 bool ok() const { return error_pc_ == nullptr; } | 331 bool ok() const { return error_pc_ == nullptr; } |
332 bool failed() const { return error_pc_ != nullptr; } | 332 bool failed() const { return !error_msg_.is_empty(); } |
333 bool more() const { return pc_ < limit_; } | 333 bool more() const { return pc_ < limit_; } |
334 | 334 |
335 const byte* start() { return start_; } | 335 const byte* start() { return start_; } |
336 const byte* pc() { return pc_; } | 336 const byte* pc() { return pc_; } |
337 uint32_t pc_offset() { return static_cast<uint32_t>(pc_ - start_); } | 337 uint32_t pc_offset() { return static_cast<uint32_t>(pc_ - start_); } |
338 | 338 |
339 protected: | 339 protected: |
340 const byte* start_; | 340 const byte* start_; |
341 const byte* pc_; | 341 const byte* pc_; |
342 const byte* limit_; | 342 const byte* limit_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 return result; | 399 return result; |
400 } | 400 } |
401 }; | 401 }; |
402 | 402 |
403 #undef TRACE | 403 #undef TRACE |
404 } // namespace wasm | 404 } // namespace wasm |
405 } // namespace internal | 405 } // namespace internal |
406 } // namespace v8 | 406 } // namespace v8 |
407 | 407 |
408 #endif // V8_WASM_DECODER_H_ | 408 #endif // V8_WASM_DECODER_H_ |
OLD | NEW |