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

Unified Diff: runtime/vm/code_generator_ia32.cc

Issue 8686016: Inline instance of test with List<Dynamic>. (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 | « no previous file | no next file » | 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 1909)
+++ runtime/vm/code_generator_ia32.cc (working copy)
@@ -1346,6 +1346,15 @@
}
+static const Class* CoreClass(const char* c_name) {
+ const String& class_name = String::Handle(String::NewSymbol(c_name));
+ const Class& cls = Class::ZoneHandle(Library::Handle(
+ Library::CoreImplLibrary()).LookupClass(class_name));
+ ASSERT(!cls.IsNull());
+ return &cls;
+}
+
+
// Optimize instanceof type test by adding inlined tests for:
// - NULL -> return false.
// - Smi -> compile time subtype check (only if dst class is not parameterized).
@@ -1407,8 +1416,19 @@
__ j(ZERO, &runtime_call, Assembler::kNearJump);
// Object not Smi.
if (is_raw_type) {
- if (!type_class.is_interface()) {
+ if (type.IsListInterface()) {
+ Label push_result;
+ // TODO(srdjan) also accept List<Object>.
__ movl(ECX, FieldAddress(EAX, Object::class_offset()));
+ __ CompareObject(ECX, *CoreClass("ObjectArray"));
+ __ j(EQUAL, &push_result, Assembler::kNearJump);
+ __ CompareObject(ECX, *CoreClass("GrowableObjectArray"));
+ __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump);
+ __ Bind(&push_result);
+ __ PushObject(negate_result ? bool_false : bool_true);
+ __ jmp(&done, Assembler::kNearJump);
+ } else if (!type_class.is_interface()) {
+ __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
__ CompareObject(ECX, type_class);
__ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump);
__ PushObject(negate_result ? bool_false : bool_true);
@@ -1492,15 +1512,6 @@
}
-static const Class* CoreClass(const char* c_name) {
- const String& class_name = String::Handle(String::NewSymbol(c_name));
- const Class& cls = Class::ZoneHandle(Library::Handle(
- Library::CoreImplLibrary()).LookupClass(class_name));
- ASSERT(!cls.IsNull());
- return &cls;
-}
-
-
// Optimize assignable type check by adding inlined tests for:
// - NULL -> return NULL.
// - Smi -> compile time subtype check (only if dst class is not parameterized).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698