| Index: runtime/vm/stub_code_ia32.cc
|
| diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
|
| index 39cf1a0c0a27496491b236ba2b52b67db6fe3426..b6064a4525f4d79a72a89c2aa933c279fa9decd2 100644
|
| --- a/runtime/vm/stub_code_ia32.cc
|
| +++ b/runtime/vm/stub_code_ia32.cc
|
| @@ -295,7 +295,7 @@ static void MegamorphicLookup(Assembler* assembler) {
|
| __ j(EQUAL, &null_receiver, Assembler::kNearJump);
|
| __ testl(EAX, Immediate(kSmiTagMask));
|
| __ j(ZERO, &smi_receiver, Assembler::kNearJump);
|
| - __ movl(EAX, FieldAddress(EAX, Object::class_offset()));
|
| + __ GetClassOf(EAX, EAX, EDI);
|
| __ jmp(&class_in_eax, Assembler::kNearJump);
|
| __ Bind(&smi_receiver);
|
| // For Smis we need to get the class from the isolate.
|
| @@ -673,16 +673,6 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
|
| FieldAddress(EAX, Array::length_offset()),
|
| EDX);
|
|
|
| - // EAX: new object start as a tagged pointer.
|
| - // EBX: new object end address.
|
| - // EDX: Array length as Smi.
|
| - // Store class value for array.
|
| - __ movl(ECX, FieldAddress(CTX, Context::isolate_offset()));
|
| - __ movl(ECX, Address(ECX, Isolate::object_store_offset()));
|
| - __ movl(ECX, Address(ECX, ObjectStore::array_class_offset()));
|
| - __ StoreIntoObject(EAX,
|
| - FieldAddress(EAX, Array::class_offset()),
|
| - ECX);
|
| // Calculate the size tag.
|
| // EAX: new object start as a tagged pointer.
|
| // EBX: new object end address.
|
| @@ -772,7 +762,7 @@ void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) {
|
| __ j(ZERO, ¬_closure, Assembler::kNearJump); // Not a closure, but a smi.
|
| // Verify that the class of the object is a closure class by checking that
|
| // class.signature_function() is not null.
|
| - __ movl(EAX, FieldAddress(EDI, Object::class_offset()));
|
| + __ GetClassOf(EAX, EDI, ECX);
|
| __ movl(EAX, FieldAddress(EAX, Class::signature_function_offset()));
|
| __ cmpl(EAX, raw_null);
|
| // Actual class is not a closure class.
|
| @@ -1004,13 +994,6 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
|
| __ movl(Address::Absolute(heap->TopAddress()), EBX);
|
| __ addl(EAX, Immediate(kHeapObjectTag));
|
|
|
| - // Initialize the class field in the context object.
|
| - // EAX: new object.
|
| - // EDX: number of context variables.
|
| - __ LoadObject(EBX, context_class); // Load up class field of context.
|
| - __ StoreIntoObject(EAX,
|
| - FieldAddress(EAX, Context::class_offset()),
|
| - EBX);
|
| // Calculate the size tag.
|
| // EAX: new object.
|
| // EDX: number of context variables.
|
| @@ -1169,8 +1152,6 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
|
| EDX);
|
| const Class& ita_cls =
|
| Class::ZoneHandle(Object::instantiated_type_arguments_class());
|
| - __ LoadObject(EDX, ita_cls);
|
| - __ movl(Address(ECX, Instance::class_offset()), EDX); // Set its class.
|
| // Set the tags.
|
| uword tags = 0;
|
| tags = RawObject::SizeTag::update(type_args_size, tags);
|
| @@ -1192,7 +1173,6 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
|
| // EBX: next object start.
|
| // EDI: new object type arguments (if is_cls_parameterized).
|
| __ LoadObject(EDX, cls); // Load class of object to be allocated.
|
| - __ movl(Address(EAX, Instance::class_offset()), EDX);
|
| // Set the tags.
|
| uword tags = 0;
|
| tags = RawObject::SizeTag::update(instance_size, tags);
|
| @@ -1342,11 +1322,8 @@ void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
|
| // next object start and initialize the object.
|
| __ movl(Address::Absolute(heap->TopAddress()), EBX);
|
|
|
| - // Initialize the class field in the object.
|
| // EAX: new closure object.
|
| // ECX: new context object (only if is_implicit_closure).
|
| - __ LoadObject(EDX, cls); // Load signature class of closure.
|
| - __ movl(Address(EAX, Closure::class_offset()), EDX);
|
| // Set the tags.
|
| uword tags = 0;
|
| tags = RawObject::SizeTag::update(closure_size, tags);
|
| @@ -1371,10 +1348,7 @@ void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
|
| } else if (is_implicit_instance_closure) {
|
| // Initialize the new context capturing the receiver.
|
|
|
| - // Set the class field to the Context class.
|
| const Class& context_class = Class::ZoneHandle(Object::context_class());
|
| - __ LoadObject(EBX, context_class);
|
| - __ movl(Address(ECX, Context::class_offset()), EBX);
|
| // Set the tags.
|
| uword tags = 0;
|
| tags = RawObject::SizeTag::update(context_size, tags);
|
| @@ -1576,8 +1550,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
|
| __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (argument_count) is Smi.
|
|
|
| Label get_class, ic_miss;
|
| - __ call(&get_class);
|
| - // EAX: receiver's class
|
| // ECX: IC data array.
|
|
|
| #if defined(DEBUG)
|
| @@ -1601,6 +1573,8 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
|
| // EBX: points directly to the first ic data array element.
|
| Label loop, found;
|
| if (num_args == 1) {
|
| + __ call(&get_class);
|
| + // EAX: receiver's class
|
| __ Bind(&loop);
|
| __ movl(EDI, Address(EBX, 0)); // Get class to check.
|
| __ cmpl(EAX, EDI); // Match?
|
| @@ -1613,21 +1587,22 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
|
| Label no_match;
|
| __ Bind(&loop);
|
| // Get class from IC data to check.
|
| - __ movl(EDI, Address(EBX, 0));
|
| // Get receiver using argument descriptor in EDX.
|
| __ movl(EAX, FieldAddress(EDX, Array::data_offset()));
|
| __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (arg. count) is Smi.
|
| __ call(&get_class);
|
| + // TODO(vegorov): is it possible to switch this code to use class ids?
|
| + __ movl(EDI, Address(EBX, 0));
|
| __ cmpl(EAX, EDI); // Match?
|
| __ j(NOT_EQUAL, &no_match, Assembler::kNearJump);
|
| // Check second class/argument.
|
| // Get class from IC data to check.
|
| - __ movl(EDI, Address(EBX, kWordSize));
|
| // Get next argument.
|
| __ movl(EAX, FieldAddress(EDX, Array::data_offset()));
|
| __ movl(EAX, Address(ESP, EAX, TIMES_2, -kWordSize));
|
| // EAX (argument count) is Smi.
|
| __ call(&get_class);
|
| + __ movl(EDI, Address(EBX, kWordSize));
|
| __ cmpl(EAX, EDI); // Match?
|
| __ j(EQUAL, &found, Assembler::kNearJump);
|
| __ Bind(&no_match);
|
| @@ -1696,7 +1671,7 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
|
| __ ret();
|
|
|
| __ Bind(¬_smi);
|
| - __ movl(EAX, FieldAddress(EAX, Object::class_offset()));
|
| + __ GetClassOf(EAX, EAX, EDI);
|
| __ ret();
|
| }
|
|
|
| @@ -1802,7 +1777,7 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
|
| const Immediate raw_null =
|
| Immediate(reinterpret_cast<intptr_t>(Object::null()));
|
| __ movl(EAX, Address(ESP, kInstanceOffsetInBytes));
|
| - __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
|
| + __ GetClassOf(ECX, EAX, EBX);
|
| // EAX: instance, ECX: instance-class.
|
| // Get instance type arguments
|
| if (n > 1) {
|
|
|