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