OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. | 590 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. |
591 ASSERT(kSmiTagShift == 1); | 591 ASSERT(kSmiTagShift == 1); |
592 __ andl(EBX, Immediate(-kObjectAlignment)); | 592 __ andl(EBX, Immediate(-kObjectAlignment)); |
593 | 593 |
594 // ECX: array element type. | 594 // ECX: array element type. |
595 // EDX: array length as Smi. | 595 // EDX: array length as Smi. |
596 // EBX: allocation size. | 596 // EBX: allocation size. |
597 | 597 |
598 const intptr_t cid = kArrayCid; | 598 const intptr_t cid = kArrayCid; |
599 Heap::Space space = Heap::SpaceForAllocation(cid); | 599 Heap::Space space = Heap::SpaceForAllocation(cid); |
600 __ LoadIsolate(EDI); | 600 __ movl(EDI, Address(THR, Thread::heap_offset())); |
601 __ movl(EDI, Address(EDI, Isolate::heap_offset())); | |
602 __ movl(EAX, Address(EDI, Heap::TopOffset(space))); | 601 __ movl(EAX, Address(EDI, Heap::TopOffset(space))); |
603 __ addl(EBX, EAX); | 602 __ addl(EBX, EAX); |
604 __ j(CARRY, &slow_case); | 603 __ j(CARRY, &slow_case); |
605 | 604 |
606 // Check if the allocation fits into the remaining space. | 605 // Check if the allocation fits into the remaining space. |
607 // EAX: potential new object start. | 606 // EAX: potential new object start. |
608 // EBX: potential next object start. | 607 // EBX: potential next object start. |
609 // EDI: heap. | 608 // EDI: heap. |
610 // ECX: array element type. | 609 // ECX: array element type. |
611 // EDX: array length as Smi). | 610 // EDX: array length as Smi). |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 // First compute the rounded instance size. | 813 // First compute the rounded instance size. |
815 // EDX: number of context variables. | 814 // EDX: number of context variables. |
816 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); | 815 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); |
817 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 816 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); |
818 __ andl(EBX, Immediate(-kObjectAlignment)); | 817 __ andl(EBX, Immediate(-kObjectAlignment)); |
819 | 818 |
820 // Now allocate the object. | 819 // Now allocate the object. |
821 // EDX: number of context variables. | 820 // EDX: number of context variables. |
822 const intptr_t cid = kContextCid; | 821 const intptr_t cid = kContextCid; |
823 Heap::Space space = Heap::SpaceForAllocation(cid); | 822 Heap::Space space = Heap::SpaceForAllocation(cid); |
824 __ LoadIsolate(ECX); | 823 __ movl(ECX, Address(THR, Thread::heap_offset())); |
825 __ movl(ECX, Address(ECX, Isolate::heap_offset())); | |
826 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); | 824 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); |
827 __ addl(EBX, EAX); | 825 __ addl(EBX, EAX); |
828 // Check if the allocation fits into the remaining space. | 826 // Check if the allocation fits into the remaining space. |
829 // EAX: potential new object. | 827 // EAX: potential new object. |
830 // EBX: potential next object start. | 828 // EBX: potential next object start. |
831 // EDX: number of context variables. | 829 // EDX: number of context variables. |
832 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); | 830 __ cmpl(EBX, Address(ECX, Heap::EndOffset(space))); |
833 if (FLAG_use_slow_path) { | 831 if (FLAG_use_slow_path) { |
834 __ jmp(&slow_case); | 832 __ jmp(&slow_case); |
835 } else { | 833 } else { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 if (is_cls_parameterized) { | 1027 if (is_cls_parameterized) { |
1030 __ movl(EDX, Address(ESP, kObjectTypeArgumentsOffset)); | 1028 __ movl(EDX, Address(ESP, kObjectTypeArgumentsOffset)); |
1031 // EDX: instantiated type arguments. | 1029 // EDX: instantiated type arguments. |
1032 } | 1030 } |
1033 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1031 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
1034 !cls.trace_allocation()) { | 1032 !cls.trace_allocation()) { |
1035 Label slow_case; | 1033 Label slow_case; |
1036 // Allocate the object and update top to point to | 1034 // Allocate the object and update top to point to |
1037 // next object start and initialize the allocated object. | 1035 // next object start and initialize the allocated object. |
1038 // EDX: instantiated type arguments (if is_cls_parameterized). | 1036 // EDX: instantiated type arguments (if is_cls_parameterized). |
1039 Heap* heap = Isolate::Current()->heap(); | |
1040 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1037 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
1041 __ movl(EAX, Address::Absolute(heap->TopAddress(space))); | 1038 __ movl(EDI, Address(THR, Thread::heap_offset())); |
| 1039 __ movl(EAX, Address(EDI, Heap::TopOffset(space))); |
1042 __ leal(EBX, Address(EAX, instance_size)); | 1040 __ leal(EBX, Address(EAX, instance_size)); |
1043 // Check if the allocation fits into the remaining space. | 1041 // Check if the allocation fits into the remaining space. |
1044 // EAX: potential new object start. | 1042 // EAX: potential new object start. |
1045 // EBX: potential next object start. | 1043 // EBX: potential next object start. |
1046 __ cmpl(EBX, Address::Absolute(heap->EndAddress(space))); | 1044 // EDI: heap. |
| 1045 __ cmpl(EBX, Address(EDI, Heap::EndOffset(space))); |
1047 if (FLAG_use_slow_path) { | 1046 if (FLAG_use_slow_path) { |
1048 __ jmp(&slow_case); | 1047 __ jmp(&slow_case); |
1049 } else { | 1048 } else { |
1050 __ j(ABOVE_EQUAL, &slow_case); | 1049 __ j(ABOVE_EQUAL, &slow_case); |
1051 } | 1050 } |
1052 __ movl(Address::Absolute(heap->TopAddress(space)), EBX); | 1051 __ movl(Address(EDI, Heap::TopOffset(space)), EBX); |
1053 __ UpdateAllocationStats(cls.id(), ECX, space); | 1052 __ UpdateAllocationStats(cls.id(), ECX, space, |
| 1053 /* inline_isolate = */ false); |
1054 | 1054 |
1055 // EAX: new object start (untagged). | 1055 // EAX: new object start (untagged). |
1056 // EBX: next object start. | 1056 // EBX: next object start. |
1057 // EDX: new object type arguments (if is_cls_parameterized). | 1057 // EDX: new object type arguments (if is_cls_parameterized). |
1058 // Set the tags. | 1058 // Set the tags. |
1059 uword tags = 0; | 1059 uword tags = 0; |
1060 tags = RawObject::SizeTag::update(instance_size, tags); | 1060 tags = RawObject::SizeTag::update(instance_size, tags); |
1061 ASSERT(cls.id() != kIllegalCid); | 1061 ASSERT(cls.id() != kIllegalCid); |
1062 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1062 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1063 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); | 1063 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 // EBX: entry point. | 2095 // EBX: entry point. |
2096 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2096 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2097 EmitMegamorphicLookup(assembler, EDI, EBX, EBX); | 2097 EmitMegamorphicLookup(assembler, EDI, EBX, EBX); |
2098 __ ret(); | 2098 __ ret(); |
2099 } | 2099 } |
2100 | 2100 |
2101 | 2101 |
2102 } // namespace dart | 2102 } // namespace dart |
2103 | 2103 |
2104 #endif // defined TARGET_ARCH_IA32 | 2104 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |