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_RESULT_H_ | 5 #ifndef V8_WASM_RESULT_H_ |
6 #define V8_WASM_RESULT_H_ | 6 #define V8_WASM_RESULT_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" |
11 | 11 |
12 #include "src/handles.h" | 12 #include "src/handles.h" |
13 #include "src/globals.h" | 13 #include "src/globals.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 class Isolate; | 18 class Isolate; |
19 | 19 |
20 namespace wasm { | 20 namespace wasm { |
21 | 21 |
22 // Error codes for programmatic checking of the decoder's verification. | 22 // Error codes for programmatic checking of the decoder's verification. |
23 enum ErrorCode { | 23 enum ErrorCode { |
24 kSuccess, | 24 kSuccess, |
25 kError, // TODO(titzer): introduce real error codes | 25 kError, // TODO(titzer): remove me |
| 26 kOutOfMemory, // decoder ran out of memory |
| 27 kEndOfCode, // end of code reached prematurely |
| 28 kInvalidOpcode, // found invalid opcode |
| 29 kUnreachableCode, // found unreachable code |
| 30 kImproperContinue, // improperly nested continue |
| 31 kImproperBreak, // improperly nested break |
| 32 kReturnCount, // return count mismatch |
| 33 kTypeError, // type mismatch |
| 34 kInvalidLocalIndex, // invalid local |
| 35 kInvalidGlobalIndex, // invalid global |
| 36 kInvalidFunctionIndex, // invalid function |
| 37 kInvalidMemType // invalid memory type |
26 }; | 38 }; |
27 | 39 |
28 // The overall result of decoding a function or a module. | 40 // The overall result of decoding a function or a module. |
29 template <typename T> | 41 template <typename T> |
30 struct Result { | 42 struct Result { |
31 Result() : val(), error_code(kSuccess), start(nullptr), error_pc(nullptr) {} | 43 Result() : val(), error_code(kSuccess), start(nullptr), error_pc(nullptr) {} |
32 Result(Result&& other) { *this = std::move(other); } | 44 Result(Result&& other) { *this = std::move(other); } |
33 Result& operator=(Result&& other) { | 45 Result& operator=(Result&& other) { |
34 MoveFrom(other); | 46 MoveFrom(other); |
35 val = other.val; | 47 val = other.val; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 127 |
116 i::Isolate* isolate_; | 128 i::Isolate* isolate_; |
117 const char* context_; | 129 const char* context_; |
118 i::Handle<i::Object> exception_; | 130 i::Handle<i::Object> exception_; |
119 }; | 131 }; |
120 } // namespace wasm | 132 } // namespace wasm |
121 } // namespace internal | 133 } // namespace internal |
122 } // namespace v8 | 134 } // namespace v8 |
123 | 135 |
124 #endif | 136 #endif |
OLD | NEW |