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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 592 |
593 // Check for maximum allowed length. | 593 // Check for maximum allowed length. |
594 const Immediate& max_len = | 594 const Immediate& max_len = |
595 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements))); | 595 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements))); |
596 __ cmpl(EDX, max_len); | 596 __ cmpl(EDX, max_len); |
597 __ j(GREATER, &slow_case); | 597 __ j(GREATER, &slow_case); |
598 | 598 |
599 NOT_IN_PRODUCT( | 599 NOT_IN_PRODUCT( |
600 __ MaybeTraceAllocation(kArrayCid, EAX, &slow_case, Assembler::kFarJump)); | 600 __ MaybeTraceAllocation(kArrayCid, EAX, &slow_case, Assembler::kFarJump)); |
601 | 601 |
602 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 602 const intptr_t fixed_size_plus_alignment_padding = |
603 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. | 603 sizeof(RawArray) + kObjectAlignment - 1; |
| 604 // EDX is Smi. |
| 605 __ leal(EBX, Address(EDX, TIMES_2, fixed_size_plus_alignment_padding)); |
604 ASSERT(kSmiTagShift == 1); | 606 ASSERT(kSmiTagShift == 1); |
605 __ andl(EBX, Immediate(-kObjectAlignment)); | 607 __ andl(EBX, Immediate(-kObjectAlignment)); |
606 | 608 |
607 // ECX: array element type. | 609 // ECX: array element type. |
608 // EDX: array length as Smi. | 610 // EDX: array length as Smi. |
609 // EBX: allocation size. | 611 // EBX: allocation size. |
610 | 612 |
611 const intptr_t cid = kArrayCid; | 613 const intptr_t cid = kArrayCid; |
612 Heap::Space space = Heap::kNew; | 614 Heap::Space space = Heap::kNew; |
613 __ movl(EDI, Address(THR, Thread::heap_offset())); | 615 __ movl(EDI, Address(THR, Thread::heap_offset())); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 // Input: | 819 // Input: |
818 // EDX: number of context variables. | 820 // EDX: number of context variables. |
819 // Output: | 821 // Output: |
820 // EAX: new allocated RawContext object. | 822 // EAX: new allocated RawContext object. |
821 // EBX and EDX are destroyed. | 823 // EBX and EDX are destroyed. |
822 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 824 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
823 if (FLAG_inline_alloc) { | 825 if (FLAG_inline_alloc) { |
824 Label slow_case; | 826 Label slow_case; |
825 // First compute the rounded instance size. | 827 // First compute the rounded instance size. |
826 // EDX: number of context variables. | 828 // EDX: number of context variables. |
827 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); | 829 intptr_t fixed_size_plus_alignment_padding = |
828 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 830 (sizeof(RawContext) + kObjectAlignment - 1); |
| 831 __ leal(EBX, Address(EDX, TIMES_4, fixed_size_plus_alignment_padding)); |
829 __ andl(EBX, Immediate(-kObjectAlignment)); | 832 __ andl(EBX, Immediate(-kObjectAlignment)); |
830 | 833 |
831 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, EAX, &slow_case, | 834 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, EAX, &slow_case, |
832 Assembler::kFarJump)); | 835 Assembler::kFarJump)); |
833 | 836 |
834 // Now allocate the object. | 837 // Now allocate the object. |
835 // EDX: number of context variables. | 838 // EDX: number of context variables. |
836 const intptr_t cid = kContextCid; | 839 const intptr_t cid = kContextCid; |
837 Heap::Space space = Heap::kNew; | 840 Heap::Space space = Heap::kNew; |
838 __ movl(ECX, Address(THR, Thread::heap_offset())); | 841 __ movl(ECX, Address(THR, Thread::heap_offset())); |
(...skipping 25 matching lines...) Expand all Loading... |
864 __ subl(EBX, EAX); | 867 __ subl(EBX, EAX); |
865 __ addl(EAX, Immediate(kHeapObjectTag)); | 868 __ addl(EAX, Immediate(kHeapObjectTag)); |
866 // Generate isolate-independent code to allow sharing between isolates. | 869 // Generate isolate-independent code to allow sharing between isolates. |
867 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EBX, EDI, space)); | 870 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, EBX, EDI, space)); |
868 | 871 |
869 // Calculate the size tag. | 872 // Calculate the size tag. |
870 // EAX: new object. | 873 // EAX: new object. |
871 // EDX: number of context variables. | 874 // EDX: number of context variables. |
872 { | 875 { |
873 Label size_tag_overflow, done; | 876 Label size_tag_overflow, done; |
874 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 877 __ leal(EBX, Address(EDX, TIMES_4, fixed_size_plus_alignment_padding)); |
875 __ andl(EBX, Immediate(-kObjectAlignment)); | 878 __ andl(EBX, Immediate(-kObjectAlignment)); |
876 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 879 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
877 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 880 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
878 __ shll(EBX, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); | 881 __ shll(EBX, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); |
879 __ jmp(&done); | 882 __ jmp(&done); |
880 | 883 |
881 __ Bind(&size_tag_overflow); | 884 __ Bind(&size_tag_overflow); |
882 // Set overflow size tag value. | 885 // Set overflow size tag value. |
883 __ movl(EBX, Immediate(0)); | 886 __ movl(EBX, Immediate(0)); |
884 | 887 |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2115 } | 2118 } |
2116 | 2119 |
2117 | 2120 |
2118 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { | 2121 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { |
2119 __ int3(); | 2122 __ int3(); |
2120 } | 2123 } |
2121 | 2124 |
2122 } // namespace dart | 2125 } // namespace dart |
2123 | 2126 |
2124 #endif // defined TARGET_ARCH_IA32 | 2127 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |