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

Side by Side Diff: runtime/lib/errors.cc

Issue 1654153002: Introduce a flag to force program abort on type/assertion errors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | runtime/vm/exceptions.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 #include "vm/exceptions.h" 6 #include "vm/exceptions.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/runtime_entry.h" 8 #include "vm/runtime_entry.h"
9 #include "vm/stack_frame.h" 9 #include "vm/stack_frame.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 DECLARE_FLAG(bool, abort_on_assertion_errors);
14
13 // Allocate and throw a new AssertionError. 15 // Allocate and throw a new AssertionError.
14 // Arg0: index of the first token of the failed assertion. 16 // Arg0: index of the first token of the failed assertion.
15 // Arg1: index of the first token after the failed assertion. 17 // Arg1: index of the first token after the failed assertion.
16 // Return value: none, throws an exception. 18 // Return value: none, throws an exception.
17 DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 2) { 19 DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 2) {
20 if (FLAG_abort_on_assertion_errors) {
21 Exceptions::PrintStackTraceAndAbort("an assertion failure");
22 }
23
18 // No need to type check the arguments. This function can only be called 24 // No need to type check the arguments. This function can only be called
19 // internally from the VM. 25 // internally from the VM.
20 intptr_t assertion_start = 26 intptr_t assertion_start =
21 Smi::CheckedHandle(arguments->NativeArgAt(0)).Value(); 27 Smi::CheckedHandle(arguments->NativeArgAt(0)).Value();
22 intptr_t assertion_end = 28 intptr_t assertion_end =
23 Smi::CheckedHandle(arguments->NativeArgAt(1)).Value(); 29 Smi::CheckedHandle(arguments->NativeArgAt(1)).Value();
24 30
25 const Array& args = Array::Handle(Array::New(4)); 31 const Array& args = Array::Handle(Array::New(4));
26 32
27 DartFrameIterator iterator; 33 DartFrameIterator iterator;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 134
129 // Rethrow an error with a stacktrace. 135 // Rethrow an error with a stacktrace.
130 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { 136 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) {
131 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); 137 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0));
132 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); 138 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1));
133 Exceptions::ReThrow(thread, error, stacktrace); 139 Exceptions::ReThrow(thread, error, stacktrace);
134 return Object::null(); 140 return Object::null();
135 } 141 }
136 142
137 } // namespace dart 143 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698