Chromium Code Reviews| 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). |
| @@ -1398,7 +1407,7 @@ |
| // 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 (requires_type_arguments) { |
| - const TypeArguments& type_arguments = |
| + const TypeArguments& type_arguments = |
|
siva
2011/11/30 01:53:32
extra space?
srdjan
2011/11/30 01:58:16
Done.
|
| TypeArguments::Handle(type.arguments()); |
| const bool is_raw_type = type_arguments.IsNull() || |
| type_arguments.IsDynamicTypes(type_arguments.Length()); |
| @@ -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). |