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

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

Issue 2014533003: [wasm] Refactor encoder.h to use a proper buffer and remove OldFunctions section. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
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 #include "src/wasm/wasm-result.h" 5 #include "src/wasm/wasm-result.h"
6 6
7 #include "src/factory.h" 7 #include "src/factory.h"
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker! 10 #include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker!
(...skipping 11 matching lines...) Expand all
22 os << "Success"; 22 os << "Success";
23 break; 23 break;
24 default: // TODO(titzer): render error codes 24 default: // TODO(titzer): render error codes
25 os << "Error"; 25 os << "Error";
26 break; 26 break;
27 } 27 }
28 return os; 28 return os;
29 } 29 }
30 30
31 void ErrorThrower::Error(const char* format, ...) { 31 void ErrorThrower::Error(const char* format, ...) {
32 if (error_) return; // only report the first error. 32 // only report the first error.
33 if (error_ || isolate_->has_pending_exception()) return;
33 error_ = true; 34 error_ = true;
34 char buffer[256]; 35 char buffer[256];
35 36
36 va_list arguments; 37 va_list arguments;
37 va_start(arguments, format); 38 va_start(arguments, format);
38 base::OS::VSNPrintF(buffer, 255, format, arguments); 39 base::OS::VSNPrintF(buffer, 255, format, arguments);
39 va_end(arguments); 40 va_end(arguments);
40 41
41 std::ostringstream str; 42 std::ostringstream str;
42 if (context_ != nullptr) { 43 if (context_ != nullptr) {
43 str << context_ << ": "; 44 str << context_ << ": ";
44 } 45 }
45 str << buffer; 46 str << buffer;
46 47
47 isolate_->ScheduleThrow( 48 isolate_->ScheduleThrow(
48 *isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str())); 49 *isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str()));
49 } 50 }
50 } // namespace wasm 51 } // namespace wasm
51 } // namespace internal 52 } // namespace internal
52 } // namespace v8 53 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698