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): remove me | 25 kError, // TODO(titzer): introduce real error codes |
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 | |
38 }; | 26 }; |
39 | 27 |
40 // The overall result of decoding a function or a module. | 28 // The overall result of decoding a function or a module. |
41 template <typename T> | 29 template <typename T> |
42 struct Result { | 30 struct Result { |
43 Result() : val(), error_code(kSuccess), start(nullptr), error_pc(nullptr) {} | 31 Result() : val(), error_code(kSuccess), start(nullptr), error_pc(nullptr) {} |
44 Result(Result&& other) { *this = std::move(other); } | 32 Result(Result&& other) { *this = std::move(other); } |
45 Result& operator=(Result&& other) { | 33 Result& operator=(Result&& other) { |
46 MoveFrom(other); | 34 MoveFrom(other); |
47 val = other.val; | 35 val = other.val; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 115 |
128 i::Isolate* isolate_; | 116 i::Isolate* isolate_; |
129 const char* context_; | 117 const char* context_; |
130 i::Handle<i::Object> exception_; | 118 i::Handle<i::Object> exception_; |
131 }; | 119 }; |
132 } // namespace wasm | 120 } // namespace wasm |
133 } // namespace internal | 121 } // namespace internal |
134 } // namespace v8 | 122 } // namespace v8 |
135 | 123 |
136 #endif | 124 #endif |
OLD | NEW |