Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 10536067: Generate code for store buffer updates in open-coded object field stores. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: finish addressing review comments Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
661 // EAX: new object start as a tagged pointer. 661 // EAX: new object start as a tagged pointer.
662 // EBX: new object end address. 662 // EBX: new object end address.
663 // ECX: array element type. 663 // ECX: array element type.
664 // EDX: Array length as Smi. 664 // EDX: Array length as Smi.
665 665
666 // Store the type argument field. 666 // Store the type argument field.
667 __ StoreIntoObject(EAX, 667 __ StoreIntoObjectNoBarrier(
668 FieldAddress(EAX, Array::type_arguments_offset()), 668 EAX,
669 ECX); 669 FieldAddress(EAX, Array::type_arguments_offset()),
670 ECX);
670 671
671 // Set the length field. 672 // Set the length field.
672 __ StoreIntoObject(EAX, 673 __ StoreIntoObjectNoBarrier(
673 FieldAddress(EAX, Array::length_offset()), 674 EAX,
674 EDX); 675 FieldAddress(EAX, Array::length_offset()),
676 EDX);
675 677
676 // Calculate the size tag. 678 // Calculate the size tag.
677 // EAX: new object start as a tagged pointer. 679 // EAX: new object start as a tagged pointer.
678 // EBX: new object end address. 680 // EBX: new object end address.
679 // EDX: Array length as Smi. 681 // EDX: Array length as Smi.
680 { 682 {
681 Label size_tag_overflow, done; 683 Label size_tag_overflow, done;
682 __ leal(ECX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. 684 __ leal(ECX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi.
683 ASSERT(kSmiTagShift == 1); 685 ASSERT(kSmiTagShift == 1);
684 __ andl(ECX, Immediate(-kObjectAlignment)); 686 __ andl(ECX, Immediate(-kObjectAlignment));
(...skipping 16 matching lines...) Expand all
701 // EBX: new object end address. 703 // EBX: new object end address.
702 // EDX: Array length as Smi. 704 // EDX: Array length as Smi.
703 __ leal(ECX, FieldAddress(EAX, Array::data_offset())); 705 __ leal(ECX, FieldAddress(EAX, Array::data_offset()));
704 // ECX: iterator which initially points to the start of the variable 706 // ECX: iterator which initially points to the start of the variable
705 // data area to be initialized. 707 // data area to be initialized.
706 Label done; 708 Label done;
707 Label init_loop; 709 Label init_loop;
708 __ Bind(&init_loop); 710 __ Bind(&init_loop);
709 __ cmpl(ECX, EBX); 711 __ cmpl(ECX, EBX);
710 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); 712 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump);
713 // TODO(cshapiro): StoreIntoObjectNoBarrier
711 __ movl(Address(ECX, 0), raw_null); 714 __ movl(Address(ECX, 0), raw_null);
712 __ addl(ECX, Immediate(kWordSize)); 715 __ addl(ECX, Immediate(kWordSize));
713 __ jmp(&init_loop, Assembler::kNearJump); 716 __ jmp(&init_loop, Assembler::kNearJump);
714 __ Bind(&done); 717 __ Bind(&done);
715 718
716 // Done allocating and initializing the array. 719 // Done allocating and initializing the array.
717 // EAX: new object. 720 // EAX: new object.
718 // EDX: Array length as Smi (preserved for the caller.) 721 // EDX: Array length as Smi (preserved for the caller.)
719 __ ret(); 722 __ ret();
720 } 723 }
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 // TOS + 2: instance. 1857 // TOS + 2: instance.
1855 // TOS + 3: cache array. 1858 // TOS + 3: cache array.
1856 // Result in ECX: null -> not found, otherwise result (true or false). 1859 // Result in ECX: null -> not found, otherwise result (true or false).
1857 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { 1860 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) {
1858 GenerateSubtypeNTestCacheStub(assembler, 3); 1861 GenerateSubtypeNTestCacheStub(assembler, 3);
1859 } 1862 }
1860 1863
1861 } // namespace dart 1864 } // namespace dart
1862 1865
1863 #endif // defined TARGET_ARCH_IA32 1866 #endif // defined TARGET_ARCH_IA32
OLDNEW
« runtime/vm/code_generator.cc ('K') | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698