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

Unified Diff: runtime/lib/object.cc

Issue 340203003: Cleanup of error and warning reporting. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: runtime/lib/object.cc
===================================================================
--- runtime/lib/object.cc (revision 37456)
+++ runtime/lib/object.cc (working copy)
@@ -10,6 +10,7 @@
#include "vm/heap.h"
#include "vm/native_entry.h"
#include "vm/object.h"
+#include "vm/report.h"
#include "vm/stack_frame.h"
#include "vm/symbols.h"
@@ -111,32 +112,14 @@
}
-static void JSWarning(const char* msg) {
- DartFrameIterator iterator;
- iterator.NextFrame(); // Skip native call.
- StackFrame* caller_frame = iterator.NextFrame();
- ASSERT(caller_frame != NULL);
- const Code& caller_code = Code::Handle(caller_frame->LookupDartCode());
- ASSERT(!caller_code.IsNull());
- const uword caller_pc = caller_frame->pc();
- // Assume an instance call.
- ICData& ic_data = ICData::Handle();
- CodePatcher::GetInstanceCallAt(caller_pc, caller_code, &ic_data);
- ASSERT(!ic_data.IsNull());
- // Report warning only if not already reported at this location.
- if (!ic_data.IssuedJSWarning()) {
- ic_data.SetIssuedJSWarning();
- Exceptions::JSWarning(caller_frame, "%s", msg);
- }
-}
-
-
static void WarnOnJSIntegralNumTypeTest(
const Instance& instance,
const TypeArguments& instantiator_type_arguments,
const AbstractType& type) {
const bool instance_is_int = instance.IsInteger();
const bool instance_is_double = instance.IsDouble();
+ const bool is_static_native = false; // Object_instanceOf and Object_as are
+ // not static native calls.
if (!(instance_is_int || instance_is_double)) {
return;
}
@@ -148,14 +131,16 @@
if (instantiated_type.IsIntType()) {
const double value = Double::Cast(instance).value();
if (floor(value) == value) {
- JSWarning("integral value of type 'double' is also considered to be "
- "of type 'int'");
+ Report::JSWarningFromNative(is_static_native,
hausner 2014/06/18 21:48:53 As discussed offline, I prefer passing false as a
regis 2014/06/18 22:13:28 Done.
+ "integral value of type 'double' is also considered to be "
+ "of type 'int'");
}
}
} else {
ASSERT(instance_is_int);
if (instantiated_type.IsDoubleType()) {
- JSWarning("integer value is also considered to be of type 'double'");
+ Report::JSWarningFromNative(is_static_native,
+ "integer value is also considered to be of type 'double'");
}
}
}

Powered by Google App Engine
This is Rietveld 408576698