Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Side by Side Diff: src/wasm/wasm-result.h

Issue 2421453002: [wasm] Implement {Compile,Runtime}Error; fix traps from start function (Closed)
Patch Set: Fix merge artefact Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | src/wasm/wasm-result.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code); 85 std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code);
86 86
87 // A helper for generating error messages that bubble up to JS exceptions. 87 // A helper for generating error messages that bubble up to JS exceptions.
88 class V8_EXPORT_PRIVATE ErrorThrower { 88 class V8_EXPORT_PRIVATE ErrorThrower {
89 public: 89 public:
90 ErrorThrower(i::Isolate* isolate, const char* context) 90 ErrorThrower(i::Isolate* isolate, const char* context)
91 : isolate_(isolate), context_(context) {} 91 : isolate_(isolate), context_(context) {}
92 ~ErrorThrower(); 92 ~ErrorThrower();
93 93
94 PRINTF_FORMAT(2, 3) void Error(const char* fmt, ...);
95 PRINTF_FORMAT(2, 3) void TypeError(const char* fmt, ...); 94 PRINTF_FORMAT(2, 3) void TypeError(const char* fmt, ...);
96 PRINTF_FORMAT(2, 3) void RangeError(const char* fmt, ...); 95 PRINTF_FORMAT(2, 3) void RangeError(const char* fmt, ...);
96 PRINTF_FORMAT(2, 3) void CompileError(const char* fmt, ...);
97 PRINTF_FORMAT(2, 3) void RuntimeError(const char* fmt, ...);
97 98
98 template <typename T> 99 template <typename T>
99 void Failed(const char* error, Result<T>& result) { 100 void CompileFailed(const char* error, Result<T>& result) {
100 std::ostringstream str; 101 std::ostringstream str;
101 str << error << result; 102 str << error << result;
102 Error("%s", str.str().c_str()); 103 CompileError("%s", str.str().c_str());
103 } 104 }
104 105
105 i::Handle<i::Object> Reify() { 106 i::Handle<i::Object> Reify() {
106 i::Handle<i::Object> result = exception_; 107 i::Handle<i::Object> result = exception_;
107 exception_ = i::Handle<i::Object>::null(); 108 exception_ = i::Handle<i::Object>::null();
108 return result; 109 return result;
109 } 110 }
110 111
111 bool error() const { return !exception_.is_null(); } 112 bool error() const { return !exception_.is_null(); }
112 113
113 private: 114 private:
114 void Format(i::Handle<i::JSFunction> constructor, const char* fmt, va_list); 115 void Format(i::Handle<i::JSFunction> constructor, const char* fmt, va_list);
115 116
116 i::Isolate* isolate_; 117 i::Isolate* isolate_;
117 const char* context_; 118 const char* context_;
118 i::Handle<i::Object> exception_; 119 i::Handle<i::Object> exception_;
119 }; 120 };
120 } // namespace wasm 121 } // namespace wasm
121 } // namespace internal 122 } // namespace internal
122 } // namespace v8 123 } // namespace v8
123 124
124 #endif 125 #endif
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | src/wasm/wasm-result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698