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

Unified Diff: runtime/vm/code_generator_ia32.cc

Issue 9863043: Inline checks for super class and interfaces (checked mdoe improvements). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | runtime/vm/object.h » ('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 5889)
+++ runtime/vm/code_generator_ia32.cc (working copy)
@@ -1542,7 +1542,11 @@
// because instances cannot be of an interface type.
if (!dst_type_class.is_interface()) {
__ movl(ECX, FieldAddress(EAX, Object::class_offset()));
- TestClassAndJump(dst_type_class, &done);
+ TestClassAndJump(dst_type_class, &done); // Uses ECX.
+ // Check superclass
+ __ movl(ECX, FieldAddress(ECX, Class::super_type_offset()));
+ __ movl(ECX, FieldAddress(ECX, Type::type_class_offset()));
+ TestClassAndJump(dst_type_class, &done); // Uses ECX.
} else {
// However, for specific core library interfaces, we can check for
// specific core library classes.
@@ -1585,6 +1589,31 @@
__ movl(ECX, FieldAddress(ECX, Class::signature_function_offset()));
__ cmpl(ECX, raw_null);
__ j(NOT_EQUAL, &done, Assembler::kNearJump);
+ } else {
+ // Check interfaces.
+ Label fall_through;
+ // Get interfaces array from class.
+ __ movl(EBX, FieldAddress(EAX, Object::class_offset()));
+ __ movl(EBX, FieldAddress(EBX, Class::interfaces_offset()));
+ __ cmpl(EBX, raw_null);
+ __ j(EQUAL, &fall_through, Assembler::kNearJump);
+ // Iterate over interfaces array and check if any of interfaces match.
+ __ movl(EDI, FieldAddress(EBX, Array::length_offset()));
+ // EDI: array index
+ // EBX: array
+ Label loop;
+ __ Bind(&loop);
+ __ subl(EDI, Immediate(Smi::RawValue(1)));
+ __ cmpl(EDI, Immediate(0));
+ __ j(LESS, &runtime_call, Assembler::kNearJump);
+ // EDI is Smi therefore TIMES_2 instead of TIMES_4.
+ // Get type from array.
+ __ movl(ECX, FieldAddress(EBX, EDI, TIMES_2, Array::data_offset()));
+ __ movl(ECX, FieldAddress(ECX, Type::type_class_offset()));
+ TestClassAndJump(dst_type_class, &done); // Uses ECX.
+ __ jmp(&loop, Assembler::kNearJump);
+ // Fall through to runtime code.
+ __ Bind(&fall_through);
}
}
}
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698