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

Unified Diff: runtime/vm/code_generator_ia32.cc

Issue 8592004: null is an instance of Dynamic (fix issue 443). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator_ia32.cc
===================================================================
--- runtime/vm/code_generator_ia32.cc (revision 1713)
+++ runtime/vm/code_generator_ia32.cc (working copy)
@@ -1399,20 +1399,25 @@
return;
}
- // A NULL object always returns false for all types other than Object
- // (and Null).
const Immediate raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
- Label non_null, done;
- __ cmpl(EAX, raw_null);
- __ j(NOT_EQUAL, &non_null, Assembler::kNearJump);
- __ PushObject(negate_result ? bool_true : bool_false);
- __ jmp(&done, Assembler::kNearJump);
-
- __ Bind(&non_null);
+ Label done;
// If type is instantiated and non-parameterized, we can inline code
// checking whether the tested instance is a Smi.
if (type.IsInstantiated()) {
+ // A null object is not an instance of any type, except of Object, Dynamic,
+ // and Null type.
srdjan 2011/11/21 19:37:08 It may be simpler to explain this in positive form
regis 2011/11/21 19:53:31 I'll remove the mention of Null type, since it is
+ // We can only inline this null check if the type is instantiated at compile
+ // time, since an uninstantiated type at compile time could be Object or
+ // Dynamic at run time.
+ Label non_null;
+ __ cmpl(EAX, raw_null);
+ __ j(NOT_EQUAL, &non_null, Assembler::kNearJump);
+ __ PushObject(negate_result ? bool_true : bool_false);
+ __ jmp(&done, Assembler::kNearJump);
+
+ __ Bind(&non_null);
+
const Class& type_class = Class::ZoneHandle(type.type_class());
const bool requires_type_arguments = type_class.HasTypeArguments();
// A Smi object cannot be the instance of a parameterized class.
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698