| 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" |
| 11 #include "src/wasm/wasm-result.h" | 11 #include "src/wasm/wasm-result.h" |
| 12 #include "src/zone-containers.h" | 12 #include "src/zone-containers.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 namespace wasm { | 16 namespace wasm { |
| 17 | 17 |
| 18 #if DEBUG | |
| 19 #define TRACE(...) \ | 18 #define TRACE(...) \ |
| 20 do { \ | 19 do { \ |
| 21 if (FLAG_trace_wasm_decoder) PrintF(__VA_ARGS__); \ | 20 if (FLAG_trace_wasm_decoder) PrintF(__VA_ARGS__); \ |
| 22 } while (false) | 21 } while (false) |
| 23 #else | |
| 24 #define TRACE(...) | |
| 25 #endif | |
| 26 | 22 |
| 27 #if !(V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_ARM) | 23 #if !(V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_ARM) |
| 28 #define UNALIGNED_ACCESS_OK 1 | 24 #define UNALIGNED_ACCESS_OK 1 |
| 29 #else | 25 #else |
| 30 #define UNALIGNED_ACCESS_OK 0 | 26 #define UNALIGNED_ACCESS_OK 0 |
| 31 #endif | 27 #endif |
| 32 | 28 |
| 33 // A helper utility to decode bytes, integers, fields, varints, etc, from | 29 // A helper utility to decode bytes, integers, fields, varints, etc, from |
| 34 // a buffer of bytes. | 30 // a buffer of bytes. |
| 35 class Decoder { | 31 class Decoder { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 const byte* error_pt_; | 315 const byte* error_pt_; |
| 320 base::SmartArrayPointer<char> error_msg_; | 316 base::SmartArrayPointer<char> error_msg_; |
| 321 }; | 317 }; |
| 322 | 318 |
| 323 #undef TRACE | 319 #undef TRACE |
| 324 } // namespace wasm | 320 } // namespace wasm |
| 325 } // namespace internal | 321 } // namespace internal |
| 326 } // namespace v8 | 322 } // namespace v8 |
| 327 | 323 |
| 328 #endif // V8_WASM_DECODER_H_ | 324 #endif // V8_WASM_DECODER_H_ |
| OLD | NEW |