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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | 601 |
602 // Check for maximum allowed length. | 602 // Check for maximum allowed length. |
603 const Immediate& max_len = | 603 const Immediate& max_len = |
604 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements))); | 604 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements))); |
605 __ cmpl(EDX, max_len); | 605 __ cmpl(EDX, max_len); |
606 __ j(GREATER, &slow_case); | 606 __ j(GREATER, &slow_case); |
607 | 607 |
608 NOT_IN_PRODUCT( | 608 NOT_IN_PRODUCT( |
609 __ MaybeTraceAllocation(kArrayCid, EAX, &slow_case, Assembler::kFarJump)); | 609 __ MaybeTraceAllocation(kArrayCid, EAX, &slow_case, Assembler::kFarJump)); |
610 | 610 |
611 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 611 const intptr_t fixed_size_plus_alignment_padding = |
612 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. | 612 sizeof(RawArray) + kObjectAlignment - 1; |
| 613 // EDX is Smi. |
| 614 __ leal(EBX, Address(EDX, TIMES_2, fixed_size_plus_alignment_padding)); |
613 ASSERT(kSmiTagShift == 1); | 615 ASSERT(kSmiTagShift == 1); |
614 __ andl(EBX, Immediate(-kObjectAlignment)); | 616 __ andl(EBX, Immediate(-kObjectAlignment)); |
615 | 617 |
616 // ECX: array element type. | 618 // ECX: array element type. |
617 // EDX: array length as Smi. | 619 // EDX: array length as Smi. |
618 // EBX: allocation size. | 620 // EBX: allocation size. |
619 | 621 |
620 const intptr_t cid = kArrayCid; | 622 const intptr_t cid = kArrayCid; |
621 Heap::Space space = Heap::kNew; | 623 Heap::Space space = Heap::kNew; |
622 __ movl(EDI, Address(THR, Thread::heap_offset())); | 624 __ movl(EDI, Address(THR, Thread::heap_offset())); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 // Input: | 828 // Input: |
827 // EDX: number of context variables. | 829 // EDX: number of context variables. |
828 // Output: | 830 // Output: |
829 // EAX: new allocated RawContext object. | 831 // EAX: new allocated RawContext object. |
830 // EBX and EDX are destroyed. | 832 // EBX and EDX are destroyed. |
831 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 833 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
832 if (FLAG_inline_alloc) { | 834 if (FLAG_inline_alloc) { |
833 Label slow_case; | 835 Label slow_case; |
834 // First compute the rounded instance size. | 836 // First compute the rounded instance size. |
835 // EDX: number of context variables. | 837 // EDX: number of context variables. |
836 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); | 838 intptr_t fixed_size_plus_alignment_padding = |
837 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 839 (sizeof(RawContext) + kObjectAlignment - 1); |
| 840 __ leal(EBX, Address(EDX, TIMES_4, fixed_size_plus_alignment_padding)); |
838 __ andl(EBX, Immediate(-kObjectAlignment)); | 841 __ andl(EBX, Immediate(-kObjectAlignment)); |
839 | 842 |
840 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, EAX, &slow_case, | 843 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, EAX, &slow_case, |
841 Assembler::kFarJump)); | 844 Assembler::kFarJump)); |
842 | 845 |
843 // Now allocate the object. | 846 // Now allocate the object. |
844 // EDX: number of context variables. | 847 // EDX: number of context variables. |
845 const intptr_t cid = kContextCid; | 848 const intptr_t cid = kContextCid; |
846 Heap::Space space = Heap::kNew; | 849 Heap::Space space = Heap::kNew; |
847 __ movl(ECX, Address(THR, Thread::heap_offset())); | 850 __ movl(ECX, Address(THR, Thread::heap_offset())); |
(...skipping 25 matching lines...) Expand all Loading... |
873 __ subl(EBX, EAX); | 876 __ subl(EBX, EAX); |
874 __ addl(EAX, Immediate(kHeapObjectTag)); | 877 __ addl(EAX, Immediate(kHeapObjectTag)); |
875 // Generate isolate-independent code to allow sharing between isolates. | 878 // Generate isolate-independent code to allow sharing between isolates. |
876 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EBX, EDI, space)); | 879 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EBX, EDI, space)); |
877 | 880 |
878 // Calculate the size tag. | 881 // Calculate the size tag. |
879 // EAX: new object. | 882 // EAX: new object. |
880 // EDX: number of context variables. | 883 // EDX: number of context variables. |
881 { | 884 { |
882 Label size_tag_overflow, done; | 885 Label size_tag_overflow, done; |
883 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 886 __ leal(EBX, Address(EDX, TIMES_4, fixed_size_plus_alignment_padding)); |
884 __ andl(EBX, Immediate(-kObjectAlignment)); | 887 __ andl(EBX, Immediate(-kObjectAlignment)); |
885 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 888 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
886 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 889 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
887 __ shll(EBX, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); | 890 __ shll(EBX, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); |
888 __ jmp(&done); | 891 __ jmp(&done); |
889 | 892 |
890 __ Bind(&size_tag_overflow); | 893 __ Bind(&size_tag_overflow); |
891 // Set overflow size tag value. | 894 // Set overflow size tag value. |
892 __ movl(EBX, Immediate(0)); | 895 __ movl(EBX, Immediate(0)); |
893 | 896 |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 } | 2135 } |
2133 | 2136 |
2134 | 2137 |
2135 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { | 2138 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { |
2136 __ int3(); | 2139 __ int3(); |
2137 } | 2140 } |
2138 | 2141 |
2139 } // namespace dart | 2142 } // namespace dart |
2140 | 2143 |
2141 #endif // defined TARGET_ARCH_IA32 | 2144 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |