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. |