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

Unified Diff: runtime/lib/errors.cc

Issue 1307363005: Add optional message argument to assert statements in the VM. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/errors_patch.dart » ('j') | runtime/lib/errors_patch.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/errors.cc
diff --git a/runtime/lib/errors.cc b/runtime/lib/errors.cc
index 8383a307634ed1be18f7ce59591253d79ff75652..a0c4295dc68e98fa603cf14eb42933a71756b80a 100644
--- a/runtime/lib/errors.cc
+++ b/runtime/lib/errors.cc
@@ -14,15 +14,15 @@ namespace dart {
// Arg0: index of the first token of the failed assertion.
// Arg1: index of the first token after the failed assertion.
// Return value: none, throws an exception.
-DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 2) {
+DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 3) {
// No need to type check the arguments. This function can only be called
// internally from the VM.
intptr_t assertion_start =
Smi::CheckedHandle(arguments->NativeArgAt(0)).Value();
intptr_t assertion_end =
Smi::CheckedHandle(arguments->NativeArgAt(1)).Value();
-
- const Array& args = Array::Handle(Array::New(4));
+ const Instance& message = Instance::CheckedHandle(arguments->NativeArgAt(2));
+ const Array& args = Array::Handle(Array::New(5));
DartFrameIterator iterator;
iterator.NextFrame(); // Skip native call.
@@ -43,6 +43,7 @@ DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 2) {
args.SetAt(1, String::Handle(script.url()));
args.SetAt(2, Smi::Handle(Smi::New(from_line)));
args.SetAt(3, Smi::Handle(Smi::New(script.HasSource() ? from_column : -1)));
+ args.SetAt(4, message);
Exceptions::ThrowByType(Exceptions::kAssertion, args);
UNREACHABLE();
« no previous file with comments | « no previous file | runtime/lib/errors_patch.dart » ('j') | runtime/lib/errors_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698