| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 615 |
| 616 if (FLAG_inline_alloc) { | 616 if (FLAG_inline_alloc) { |
| 617 // Compute the size to be allocated, it is based on the array length | 617 // Compute the size to be allocated, it is based on the array length |
| 618 // and it computed as: | 618 // and it computed as: |
| 619 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 619 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
| 620 // Assert that length is a Smi. | 620 // Assert that length is a Smi. |
| 621 __ testl(EDX, Immediate(kSmiTagSize)); | 621 __ testl(EDX, Immediate(kSmiTagSize)); |
| 622 if (FLAG_use_slow_path) { | 622 if (FLAG_use_slow_path) { |
| 623 __ jmp(&slow_case); | 623 __ jmp(&slow_case); |
| 624 } else { | 624 } else { |
| 625 __ j(NOT_ZERO, &slow_case, Assembler::kNearJump); | 625 __ j(NOT_ZERO, &slow_case); |
| 626 } | 626 } |
| 627 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); | 627 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); |
| 628 __ movl(EDI, Address(EDI, Isolate::heap_offset())); | 628 __ movl(EDI, Address(EDI, Isolate::heap_offset())); |
| 629 __ movl(EDI, Address(EDI, Heap::new_space_offset())); | 629 __ movl(EDI, Address(EDI, Heap::new_space_offset())); |
| 630 | 630 |
| 631 // Calculate and align allocation size. | 631 // Calculate and align allocation size. |
| 632 // Load new object start and calculate next object start. | 632 // Load new object start and calculate next object start. |
| 633 // ECX: array element type. | 633 // ECX: array element type. |
| 634 // EDX: Array length as Smi. | 634 // EDX: Array length as Smi. |
| 635 // EDI: Points to new space object. | 635 // EDI: Points to new space object. |
| 636 __ movl(EAX, Address(EDI, Scavenger::top_offset())); | 636 __ movl(EAX, Address(EDI, Scavenger::top_offset())); |
| 637 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 637 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 638 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. | 638 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. |
| 639 ASSERT(kSmiTagShift == 1); | 639 ASSERT(kSmiTagShift == 1); |
| 640 __ andl(EBX, Immediate(-kObjectAlignment)); | 640 __ andl(EBX, Immediate(-kObjectAlignment)); |
| 641 __ leal(EBX, Address(EAX, EBX, TIMES_1, 0)); | 641 __ leal(EBX, Address(EAX, EBX, TIMES_1, 0)); |
| 642 | 642 |
| 643 // Check if the allocation fits into the remaining space. | 643 // Check if the allocation fits into the remaining space. |
| 644 // EAX: potential new object start. | 644 // EAX: potential new object start. |
| 645 // EBX: potential next object start. | 645 // EBX: potential next object start. |
| 646 // ECX: array element type. | 646 // ECX: array element type. |
| 647 // EDX: Array length as Smi. | 647 // EDX: Array length as Smi. |
| 648 // EDI: Points to new space object. | 648 // EDI: Points to new space object. |
| 649 __ cmpl(EBX, Address(EDI, Scavenger::end_offset())); | 649 __ cmpl(EBX, Address(EDI, Scavenger::end_offset())); |
| 650 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); | 650 __ j(ABOVE_EQUAL, &slow_case); |
| 651 | 651 |
| 652 // Successfully allocated the object(s), now update top to point to | 652 // Successfully allocated the object(s), now update top to point to |
| 653 // next object start and initialize the object. | 653 // next object start and initialize the object. |
| 654 // EAX: potential new object start. | 654 // EAX: potential new object start. |
| 655 // EBX: potential next object start. | 655 // EBX: potential next object start. |
| 656 // EDX: Array length as Smi. | 656 // EDX: Array length as Smi. |
| 657 // EDI: Points to new space object. | 657 // EDI: Points to new space object. |
| 658 __ movl(Address(EDI, Scavenger::top_offset()), EBX); | 658 __ movl(Address(EDI, Scavenger::top_offset()), EBX); |
| 659 __ addl(EAX, Immediate(kHeapObjectTag)); | 659 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 660 | 660 |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 // TOS + 2: instance. | 1854 // TOS + 2: instance. |
| 1855 // TOS + 3: cache array. | 1855 // TOS + 3: cache array. |
| 1856 // Result in ECX: null -> not found, otherwise result (true or false). | 1856 // Result in ECX: null -> not found, otherwise result (true or false). |
| 1857 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { | 1857 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { |
| 1858 GenerateSubtypeNTestCacheStub(assembler, 3); | 1858 GenerateSubtypeNTestCacheStub(assembler, 3); |
| 1859 } | 1859 } |
| 1860 | 1860 |
| 1861 } // namespace dart | 1861 } // namespace dart |
| 1862 | 1862 |
| 1863 #endif // defined TARGET_ARCH_IA32 | 1863 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |