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

Unified Diff: runtime/vm/code_generator.cc

Issue 260713008: Add support for javascript incompatibility warnings. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 35921)
+++ runtime/vm/code_generator.cc (working copy)
@@ -56,6 +56,7 @@
DECLARE_FLAG(int, deoptimization_counter_threshold);
DECLARE_FLAG(bool, enable_type_checks);
DECLARE_FLAG(bool, report_usage_count);
+DECLARE_FLAG(bool, warn_on_javascript_incompatibility);
DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement.");
DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement.");
@@ -787,8 +788,7 @@
}
-// Handles inline cache misses by updating the IC data array of the call
-// site.
+// Handles inline cache misses by updating the IC data array of the call site.
// Arg0: Receiver object.
// Arg1: IC data object.
// Returns: target function with compiled code or null.
@@ -798,14 +798,26 @@
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
GrowableArray<const Instance*> args(1);
args.Add(&receiver);
+ if (FLAG_warn_on_javascript_incompatibility) {
+ if (receiver.IsDouble() &&
+ String::Handle(ic_data.target_name()).Equals(Symbols::toString())) {
+ const double value = Double::Cast(receiver).value();
+ if (floor(value) == value) {
+ Exceptions::JSWarning(ic_data,
+ "javascript incompatibility: string "
+ "representation of an integral value of type "
+ "'double' has no decimal mark and no fractional "
+ "part");
+ }
+ }
+ }
const Function& result =
Function::Handle(InlineCacheMissHandler(args, ic_data));
arguments.SetReturn(result);
}
-// Handles inline cache misses by updating the IC data array of the call
-// site.
+// Handles inline cache misses by updating the IC data array of the call site.
// Arg0: Receiver object.
// Arg1: Argument after receiver.
// Arg2: IC data object.
@@ -824,8 +836,7 @@
}
-// Handles inline cache misses by updating the IC data array of the call
-// site.
+// Handles inline cache misses by updating the IC data array of the call site.
// Arg0: Receiver object.
// Arg1: Argument after receiver.
// Arg2: Second argument after receiver.

Powered by Google App Engine
This is Rietveld 408576698