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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
801 const Immediate& raw_null = | 801 const Immediate& raw_null = |
802 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 802 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
803 if (FLAG_inline_alloc) { | 803 if (FLAG_inline_alloc) { |
804 Label slow_case; | 804 Label slow_case; |
805 // First compute the rounded instance size. | 805 // First compute the rounded instance size. |
806 // EDX: number of context variables. | 806 // EDX: number of context variables. |
807 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); | 807 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); |
808 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 808 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); |
809 __ andl(EBX, Immediate(-kObjectAlignment)); | 809 __ andl(EBX, Immediate(-kObjectAlignment)); |
810 | 810 |
811 __ MaybeTraceAllocation(kContextCid, | |
812 EAX, | |
813 &slow_case, | |
814 /* near_jump = */ false, | |
Florian Schneider
2015/08/14 11:35:09
Use Assembler::kFarJump instead.
Cutch
2015/08/14 13:54:36
Done here and elsewhere.
| |
815 /* inline_isolate = */ false); | |
816 | |
811 // Now allocate the object. | 817 // Now allocate the object. |
812 // EDX: number of context variables. | 818 // EDX: number of context variables. |
813 const intptr_t cid = kContextCid; | 819 const intptr_t cid = kContextCid; |
814 Heap::Space space = Heap::SpaceForAllocation(cid); | 820 Heap::Space space = Heap::SpaceForAllocation(cid); |
815 __ movl(ECX, Address(THR, Thread::heap_offset())); | 821 __ movl(ECX, Address(THR, Thread::heap_offset())); |
816 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); | 822 __ movl(EAX, Address(ECX, Heap::TopOffset(space))); |
817 __ addl(EBX, EAX); | 823 __ addl(EBX, EAX); |
818 // Check if the allocation fits into the remaining space. | 824 // Check if the allocation fits into the remaining space. |
819 // EAX: potential new object. | 825 // EAX: potential new object. |
820 // EBX: potential next object start. | 826 // EBX: potential next object start. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1013 // when the object initialization should be done as a loop or as | 1019 // when the object initialization should be done as a loop or as |
1014 // straight line code. | 1020 // straight line code. |
1015 const int kInlineInstanceSize = 12; // In words. | 1021 const int kInlineInstanceSize = 12; // In words. |
1016 const intptr_t instance_size = cls.instance_size(); | 1022 const intptr_t instance_size = cls.instance_size(); |
1017 ASSERT(instance_size > 0); | 1023 ASSERT(instance_size > 0); |
1018 if (is_cls_parameterized) { | 1024 if (is_cls_parameterized) { |
1019 __ movl(EDX, Address(ESP, kObjectTypeArgumentsOffset)); | 1025 __ movl(EDX, Address(ESP, kObjectTypeArgumentsOffset)); |
1020 // EDX: instantiated type arguments. | 1026 // EDX: instantiated type arguments. |
1021 } | 1027 } |
1022 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1028 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
1023 !cls.trace_allocation()) { | 1029 !cls.TraceAllocation()) { |
1024 Label slow_case; | 1030 Label slow_case; |
1025 // Allocate the object and update top to point to | 1031 // Allocate the object and update top to point to |
1026 // next object start and initialize the allocated object. | 1032 // next object start and initialize the allocated object. |
1027 // EDX: instantiated type arguments (if is_cls_parameterized). | 1033 // EDX: instantiated type arguments (if is_cls_parameterized). |
1028 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1034 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
1029 __ movl(EDI, Address(THR, Thread::heap_offset())); | 1035 __ movl(EDI, Address(THR, Thread::heap_offset())); |
1030 __ movl(EAX, Address(EDI, Heap::TopOffset(space))); | 1036 __ movl(EAX, Address(EDI, Heap::TopOffset(space))); |
1031 __ leal(EBX, Address(EAX, instance_size)); | 1037 __ leal(EBX, Address(EAX, instance_size)); |
1032 // Check if the allocation fits into the remaining space. | 1038 // Check if the allocation fits into the remaining space. |
1033 // EAX: potential new object start. | 1039 // EAX: potential new object start. |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2080 // EBX: entry point. | 2086 // EBX: entry point. |
2081 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2087 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2082 EmitMegamorphicLookup(assembler, EDI, EBX, EBX); | 2088 EmitMegamorphicLookup(assembler, EDI, EBX, EBX); |
2083 __ ret(); | 2089 __ ret(); |
2084 } | 2090 } |
2085 | 2091 |
2086 | 2092 |
2087 } // namespace dart | 2093 } // namespace dart |
2088 | 2094 |
2089 #endif // defined TARGET_ARCH_IA32 | 2095 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |