Chromium Code Reviews| Index: runtime/vm/flow_graph_compiler_x64.cc |
| diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc |
| index ba2fc440c8c05102b6a981b28b2b22a7e8186945..1ee056bee487f19f011473c8ad6c7b682696a4c2 100644 |
| --- a/runtime/vm/flow_graph_compiler_x64.cc |
| +++ b/runtime/vm/flow_graph_compiler_x64.cc |
| @@ -138,7 +138,7 @@ void FlowGraphCompiler::Bailout(const char* reason) { |
| 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( |
| + const Class& cls = Class::Handle(Library::Handle( |
| Library::CoreImplLibrary()).LookupClass(class_name)); |
|
srdjan
2012/05/30 16:44:00
This should be ZoneHandle as it is escaping its cr
Ivan Posva
2012/05/30 17:13:42
The real issue here is that this function is break
Vyacheslav Egorov (Google)
2012/05/30 17:52:37
Fixed.
|
| ASSERT(!cls.IsNull()); |
| return &cls; |
| @@ -172,9 +172,9 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( |
| if (is_raw_type) { |
| // Dynamic type argument, check only classes. |
| // List is a very common case. |
| - __ movq(R10, FieldAddress(RAX, Object::class_offset())); |
| + __ LoadClassIndexOfObject(R10, RAX); |
| if (!type_class.is_interface()) { |
| - __ CompareObject(R10, type_class); |
| + __ cmpl(R10, Immediate(type_class.index())); |
| __ j(EQUAL, is_instance_lbl); |
| } |
| if (type.IsListInterface()) { |
| @@ -240,7 +240,7 @@ void FlowGraphCompiler::CheckClasses(const GrowableArray<const Class*>& classes, |
| Label* is_instance_lbl, |
| Label* is_not_instance_lbl) { |
| for (intptr_t i = 0; i < classes.length(); i++) { |
| - __ CompareObject(R10, *classes[i]); |
| + __ cmpl(R10, Immediate(classes[i]->index())); |
| __ j(EQUAL, is_instance_lbl); |
| } |
| __ jmp(is_not_instance_lbl); |
| @@ -280,18 +280,17 @@ void FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( |
| ObjectStore* object_store = Isolate::Current()->object_store(); |
| // Compare if the classes are equal. Instance is not Smi. |
| __ Bind(&compare_classes); |
| - __ movq(R10, FieldAddress(RAX, Object::class_offset())); |
| + __ LoadClassIndexOfObject(R10, RAX); |
| // If type is an interface, we can skip the class equality check. |
| if (!type_class.is_interface()) { |
| - __ CompareObject(R10, type_class); |
| + __ cmpl(R10, Immediate(type_class.index())); |
| __ j(EQUAL, is_instance_lbl); |
| } |
| // Check for interfaces that cannot be implemented by user. |
| // (see ClassFinalizer::ResolveInterfaces for list of restricted interfaces). |
| // Bool interface can be implemented only by core class Bool. |
| if (type.IsBoolInterface()) { |
| - const Class& bool_class = Class::ZoneHandle(object_store->bool_class()); |
| - __ CompareObject(R10, bool_class); |
| + __ cmpl(R10, Immediate(kBool)); |
| __ j(EQUAL, is_instance_lbl); |
| __ jmp(is_not_instance_lbl); |
| return; |
| @@ -300,8 +299,9 @@ void FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( |
| // Check if instance is a closure. |
| const Immediate raw_null = |
| Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ movq(R10, FieldAddress(R10, Class::signature_function_offset())); |
| - __ cmpq(R10, raw_null); |
| + __ LoadClassByIndex(R13, R10); |
|
srdjan
2012/05/30 16:44:00
You could reuse R10 instead of R13, since you are
|
| + __ movq(R13, FieldAddress(R13, Class::signature_function_offset())); |
| + __ cmpq(R13, raw_null); |
| __ j(NOT_EQUAL, is_instance_lbl); |
| __ jmp(is_not_instance_lbl); |
| return; |
| @@ -310,9 +310,9 @@ void FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( |
| // Note that instance is not Smi(checked above). |
| if (type.IsSubtypeOf( |
| Type::Handle(Type::NumberInterface()), &malformed_error)) { |
| - const Class& mint_class = Class::ZoneHandle(object_store->mint_class()); |
| - const Class& bigint_class = Class::ZoneHandle(object_store->bigint_class()); |
| - const Class& double_class = Class::ZoneHandle(object_store->double_class()); |
| + const Class& mint_class = Class::Handle(object_store->mint_class()); |
| + const Class& bigint_class = Class::Handle(object_store->bigint_class()); |
| + const Class& double_class = Class::Handle(object_store->double_class()); |
| GrowableArray<const Class*> args; |
| if (type.IsNumberInterface()) { |
| args.Add(&double_class); |
| @@ -329,17 +329,17 @@ void FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( |
| } |
| if (type.IsStringInterface()) { |
| const Class& one_byte_string_class = |
| - Class::ZoneHandle(object_store->one_byte_string_class()); |
| + Class::Handle(object_store->one_byte_string_class()); |
| const Class& two_byte_string_class = |
| - Class::ZoneHandle(object_store->two_byte_string_class()); |
| + Class::Handle(object_store->two_byte_string_class()); |
| const Class& four_byte_string_class = |
| - Class::ZoneHandle(object_store->four_byte_string_class()); |
| + Class::Handle(object_store->four_byte_string_class()); |
| const Class& external_one_byte_string_class = |
| - Class::ZoneHandle(object_store->external_one_byte_string_class()); |
| + Class::Handle(object_store->external_one_byte_string_class()); |
| const Class& external_two_byte_string_class = |
| - Class::ZoneHandle(object_store->external_two_byte_string_class()); |
| + Class::Handle(object_store->external_two_byte_string_class()); |
| const Class& external_four_byte_string_class = |
| - Class::ZoneHandle(object_store->external_four_byte_string_class()); |
| + Class::Handle(object_store->external_four_byte_string_class()); |
| GrowableArray<const Class*> args; |
| args.Add(&one_byte_string_class); |
| args.Add(&two_byte_string_class); |
| @@ -368,7 +368,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( |
| const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
| const Immediate raw_null = |
| Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ movq(R10, FieldAddress(RAX, Object::class_offset())); |
| + __ LoadClassOfObject(R10, RAX, R13); |
| // Check immediate superclass equality. |
| __ movq(R13, FieldAddress(R10, Class::super_type_offset())); |
| __ movq(R13, FieldAddress(R13, Type::type_class_offset())); |
| @@ -417,8 +417,9 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest( |
| // Can handle only type arguments that are instances of TypeArguments. |
| // (runtime checks canonicalize type arguments). |
| Label fall_through; |
| - __ movq(R10, FieldAddress(RDX, Object::class_offset())); |
| - __ CompareObject(R10, Object::ZoneHandle(Object::type_arguments_class())); |
| + __ CompareClassOfObject(RDX, |
| + Class::Handle(Object::type_arguments_class()), |
| + R10); |
| __ j(NOT_EQUAL, &fall_through); |
| __ movq(RDI, |
| FieldAddress(RDX, TypeArguments::type_at_offset(type.Index()))); |
| @@ -1016,8 +1017,9 @@ void FlowGraphCompiler::VisitExtractConstructorTypeArguments( |
| // No need to check the instantiator (RAX) for null here, because a null |
| // instantiator will have the wrong class (Null instead of TypeArguments). |
| Label type_arguments_uninstantiated; |
| - __ LoadObject(RCX, Class::ZoneHandle(Object::type_arguments_class())); |
| - __ cmpq(RCX, FieldAddress(RAX, Object::class_offset())); |
| + __ CompareClassOfObject(RAX, |
| + Class::Handle(Object::type_arguments_class()), |
| + RCX); |
| __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump); |
| Immediate arguments_length = |
| Immediate(Smi::RawValue(comp->type_arguments().Length())); |