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

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

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-result.h ('k') | test/common/wasm/wasm-module-runner.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 #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-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 28 matching lines...) Expand all
39 if (context_ != nullptr) { 39 if (context_ != nullptr) {
40 str << context_ << ": "; 40 str << context_ << ": ";
41 } 41 }
42 str << buffer; 42 str << buffer;
43 43
44 i::Handle<i::String> message = 44 i::Handle<i::String> message =
45 isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str()); 45 isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str());
46 exception_ = isolate_->factory()->NewError(constructor, message); 46 exception_ = isolate_->factory()->NewError(constructor, message);
47 } 47 }
48 48
49 void ErrorThrower::Error(const char* format, ...) {
50 if (error()) return;
51 va_list arguments;
52 va_start(arguments, format);
53 Format(isolate_->error_function(), format, arguments);
54 va_end(arguments);
55 }
56
57 void ErrorThrower::TypeError(const char* format, ...) { 49 void ErrorThrower::TypeError(const char* format, ...) {
58 if (error()) return; 50 if (error()) return;
59 va_list arguments; 51 va_list arguments;
60 va_start(arguments, format); 52 va_start(arguments, format);
61 Format(isolate_->type_error_function(), format, arguments); 53 Format(isolate_->type_error_function(), format, arguments);
62 va_end(arguments); 54 va_end(arguments);
63 } 55 }
64 56
65 void ErrorThrower::RangeError(const char* format, ...) { 57 void ErrorThrower::RangeError(const char* format, ...) {
66 if (error()) return; 58 if (error()) return;
67 va_list arguments; 59 va_list arguments;
68 va_start(arguments, format); 60 va_start(arguments, format);
69 CHECK(*isolate_->range_error_function() != *isolate_->type_error_function());
70 Format(isolate_->range_error_function(), format, arguments); 61 Format(isolate_->range_error_function(), format, arguments);
71 va_end(arguments); 62 va_end(arguments);
72 } 63 }
73 64
65 void ErrorThrower::CompileError(const char* format, ...) {
66 if (error()) return;
67 va_list arguments;
68 va_start(arguments, format);
69 Format(isolate_->wasm_compile_error_function(), format, arguments);
70 va_end(arguments);
71 }
72
73 void ErrorThrower::RuntimeError(const char* format, ...) {
74 if (error()) return;
75 va_list arguments;
76 va_start(arguments, format);
77 Format(isolate_->wasm_runtime_error_function(), format, arguments);
78 va_end(arguments);
79 }
80
74 ErrorThrower::~ErrorThrower() { 81 ErrorThrower::~ErrorThrower() {
75 if (error() && !isolate_->has_pending_exception()) { 82 if (error() && !isolate_->has_pending_exception()) {
76 isolate_->ScheduleThrow(*exception_); 83 isolate_->ScheduleThrow(*exception_);
77 } 84 }
78 } 85 }
79 } // namespace wasm 86 } // namespace wasm
80 } // namespace internal 87 } // namespace internal
81 } // namespace v8 88 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-result.h ('k') | test/common/wasm/wasm-module-runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698