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

Unified Diff: src/wasm/wasm-result.cc

Issue 1504713014: Initial import of v8-native WASM. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-result.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-result.cc
diff --git a/src/wasm/wasm-result.cc b/src/wasm/wasm-result.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4fd17ee364f7b885bb53668279dba92838a38d77
--- /dev/null
+++ b/src/wasm/wasm-result.cc
@@ -0,0 +1,53 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/wasm/wasm-result.h"
+
+#include "src/factory.h"
+#include "src/heap/heap.h"
+#include "src/isolate.h"
+#include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker!
+#include "src/objects.h"
+
+#include "src/base/platform/platform.h"
+
+namespace v8 {
+namespace internal {
+namespace wasm {
+
+std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code) {
+ switch (error_code) {
+ case kSuccess:
+ os << "Success";
+ break;
+ default: // TODO(titzer): render error codes
+ os << "Error";
+ break;
+ }
+ return os;
+}
+
+
+void ErrorThrower::Error(const char* format, ...) {
+ if (error_) return; // only report the first error.
+ error_ = true;
+ char buffer[256];
+
+ va_list arguments;
+ va_start(arguments, format);
+ base::OS::VSNPrintF(buffer, 255, format, arguments);
+ va_end(arguments);
+
+ std::ostringstream str;
+ if (context_ != nullptr) {
+ str << context_ << ": ";
+ }
+ str << buffer;
+
+ isolate_->ScheduleThrow(
+ *isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str()));
+}
+} // namespace wasm
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/wasm/wasm-result.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698