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

Unified Diff: runtime/vm/flow_graph_compiler_ia32.cc

Issue 18054022: Fix 11574: Smi is a subtype of parametrizable Compare. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/vm/flow_graph_compiler_ia32.cc
===================================================================
--- runtime/vm/flow_graph_compiler_ia32.cc (revision 24599)
+++ runtime/vm/flow_graph_compiler_ia32.cc (working copy)
@@ -233,9 +233,17 @@
const Class& type_class = Class::ZoneHandle(type.type_class());
ASSERT(type_class.HasTypeArguments());
const Register kInstanceReg = EAX;
- // A Smi object cannot be the instance of a parameterized class.
+ Error& malformed_error = Error::Handle();
+ const Type& int_type = Type::Handle(Type::IntType());
+ const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error);
+ // Malforrmed type should have been handled at graph construction time.
+ ASSERT(smi_is_ok || malformed_error.IsNull());
__ testl(kInstanceReg, Immediate(kSmiTagMask));
- __ j(ZERO, is_not_instance_lbl);
+ if (smi_is_ok) {
+ __ j(ZERO, is_instance_lbl);
+ } else {
+ __ j(ZERO, is_not_instance_lbl);
+ }
const AbstractTypeArguments& type_arguments =
AbstractTypeArguments::ZoneHandle(type.arguments());
const bool is_raw_type = type_arguments.IsNull() ||
@@ -514,7 +522,6 @@
}
if (type.IsInstantiated()) {
const Class& type_class = Class::ZoneHandle(type.type_class());
- // A Smi object cannot be the instance of a parameterized class.
// A class equality check is only applicable with a dst type of a
// non-parameterized class or with a raw dst type of a parameterized class.
if (type_class.HasTypeArguments()) {

Powered by Google App Engine
This is Rietveld 408576698