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..546da8f24723745f8a69fd1571a19a0da63307cc 100644 |
| --- a/runtime/vm/flow_graph_compiler_x64.cc |
| +++ b/runtime/vm/flow_graph_compiler_x64.cc |
| @@ -136,12 +136,12 @@ void FlowGraphCompiler::Bailout(const char* reason) { |
| } |
| -static const Class* CoreClass(const char* c_name) { |
| +static RawClass* 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; |
| + RawClass* raw_class = Library::Handle( |
| + Library::CoreImplLibrary()).LookupClass(class_name); |
| + ASSERT(raw_class != Class::null()); |
| + return raw_class; |
| } |
| @@ -172,17 +172,17 @@ 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()) { |
| Label unknown; |
| GrowableArray<const Class*> args; |
| - args.Add(CoreClass("ObjectArray")); |
| - args.Add(CoreClass("GrowableObjectArray")); |
| - args.Add(CoreClass("ImmutableArray")); |
| + args.Add(&Class::Handle(CoreClass("ObjectArray"))); |
| + args.Add(&Class::Handle(CoreClass("GrowableObjectArray"))); |
| + args.Add(&Class::Handle(CoreClass("ImmutableArray"))); |
| CheckClasses(args, is_instance_lbl, &unknown); |
| __ Bind(&unknown); |
| } |
| @@ -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); |
| + __ 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()); |
|
Ivan Posva
2012/05/30 18:15:19
kMint
|
| + const Class& bigint_class = Class::Handle(object_store->bigint_class()); |
|
Ivan Posva
2012/05/30 18:15:19
kBigInt
|
| + const Class& double_class = Class::Handle(object_store->double_class()); |
|
Ivan Posva
2012/05/30 18:15:19
kDouble
|
| 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 = |
|
Ivan Posva
2012/05/30 18:15:19
ditto, here and below...
|
| - 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); |
| // Check immediate superclass equality. |
| __ movq(R13, FieldAddress(R10, Class::super_type_offset())); |
| __ movq(R13, FieldAddress(R13, Type::type_class_offset())); |
| @@ -417,8 +417,8 @@ 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())); |
| __ j(NOT_EQUAL, &fall_through); |
| __ movq(RDI, |
| FieldAddress(RDX, TypeArguments::type_at_offset(type.Index()))); |
| @@ -1016,8 +1016,8 @@ 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())); |
| __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump); |
| Immediate arguments_length = |
| Immediate(Smi::RawValue(comp->type_arguments().Length())); |