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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-result.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/wasm/wasm-result.h"
6
7 #include "src/factory.h"
8 #include "src/heap/heap.h"
9 #include "src/isolate.h"
10 #include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker!
11 #include "src/objects.h"
12
13 #include "src/base/platform/platform.h"
14
15 namespace v8 {
16 namespace internal {
17 namespace wasm {
18
19 std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code) {
20 switch (error_code) {
21 case kSuccess:
22 os << "Success";
23 break;
24 default: // TODO(titzer): render error codes
25 os << "Error";
26 break;
27 }
28 return os;
29 }
30
31
32 void ErrorThrower::Error(const char* format, ...) {
33 if (error_) return; // only report the first error.
34 error_ = true;
35 char buffer[256];
36
37 va_list arguments;
38 va_start(arguments, format);
39 base::OS::VSNPrintF(buffer, 255, format, arguments);
40 va_end(arguments);
41
42 std::ostringstream str;
43 if (context_ != nullptr) {
44 str << context_ << ": ";
45 }
46 str << buffer;
47
48 isolate_->ScheduleThrow(
49 *isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str()));
50 }
51 } // namespace wasm
52 } // namespace internal
53 } // namespace v8
OLDNEW
« 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