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

Unified Diff: runtime/vm/code_generator_ia32.cc

Issue 8592008: Factor out code part for instanceof, and hardwire "is bool" check. (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 1767)
+++ runtime/vm/code_generator_ia32.cc (working copy)
@@ -1463,22 +1463,20 @@
// Compare if the classes are equal.
__ Bind(&compare_classes);
- if (type_class.is_interface()) {
- if (type.IsStringInterface()) {
- Label runtime_call;
- __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
- const Class& one_byte_string_class = Class::ZoneHandle(
- Isolate::Current()->object_store()->one_byte_string_class());
- __ CompareObject(ECX, one_byte_string_class);
- __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump);
- __ PushObject(negate_result ? bool_false : bool_true);
- __ jmp(&done, Assembler::kNearJump);
- __ Bind(&runtime_call);
- }
- } else { // type_class is not an interface.
+ const Class* compare_class = NULL;
+ if (type.IsStringInterface()) {
+ compare_class = &Class::ZoneHandle(
+ Isolate::Current()->object_store()->one_byte_string_class());
+ } else if (type.IsBoolInterface()) {
+ compare_class = &Class::ZoneHandle(
+ Isolate::Current()->object_store()->bool_class());
+ } else if (!type_class.is_interface()) {
+ compare_class = &type_class;
+ }
+ if (compare_class != NULL) {
Label runtime_call;
__ movl(ECX, FieldAddress(EAX, Object::class_offset()));
- __ CompareObject(ECX, type_class);
+ __ CompareObject(ECX, *compare_class);
__ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump);
__ PushObject(negate_result ? bool_false : bool_true);
__ jmp(&done, Assembler::kNearJump);
@@ -1516,7 +1514,7 @@
// Jumps to label if ECX equals the given class.
// Inputs:
// - ECX: tested class.
-void CodeGenerator::TestClassAndJump(const Class& cls, Label *label) {
+void CodeGenerator::TestClassAndJump(const Class& cls, Label* label) {
__ CompareObject(ECX, cls);
__ j(EQUAL, label, Assembler::kNearJump);
}
« 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