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

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

Issue 2974403002: Revert "Moves the top_ and end_ words of the Scavenger into mutator thread." (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" // NOLINT 5 #include "vm/globals.h" // NOLINT
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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 Register temp_reg) { 2623 Register temp_reg) {
2624 ASSERT(failure != NULL); 2624 ASSERT(failure != NULL);
2625 ASSERT(temp_reg != kNoRegister); 2625 ASSERT(temp_reg != kNoRegister);
2626 if (FLAG_inline_alloc) { 2626 if (FLAG_inline_alloc) {
2627 // If this allocation is traced, program will jump to failure path 2627 // If this allocation is traced, program will jump to failure path
2628 // (i.e. the allocation stub) which will allocate the object and trace the 2628 // (i.e. the allocation stub) which will allocate the object and trace the
2629 // allocation call site. 2629 // allocation call site.
2630 NOT_IN_PRODUCT( 2630 NOT_IN_PRODUCT(
2631 MaybeTraceAllocation(cls.id(), temp_reg, failure, near_jump)); 2631 MaybeTraceAllocation(cls.id(), temp_reg, failure, near_jump));
2632 const intptr_t instance_size = cls.instance_size(); 2632 const intptr_t instance_size = cls.instance_size();
2633 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 2633 Heap::Space space = Heap::kNew;
2634 movl(instance_reg, Address(THR, Thread::top_offset())); 2634 movl(temp_reg, Address(THR, Thread::heap_offset()));
2635 movl(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
2635 addl(instance_reg, Immediate(instance_size)); 2636 addl(instance_reg, Immediate(instance_size));
2636 // instance_reg: potential next object start. 2637 // instance_reg: potential next object start.
2637 cmpl(instance_reg, Address(THR, Thread::end_offset())); 2638 cmpl(instance_reg, Address(temp_reg, Heap::EndOffset(space)));
2638 j(ABOVE_EQUAL, failure, near_jump); 2639 j(ABOVE_EQUAL, failure, near_jump);
2639 // Successfully allocated the object, now update top to point to 2640 // Successfully allocated the object, now update top to point to
2640 // next object start and store the class in the class field of object. 2641 // next object start and store the class in the class field of object.
2641 movl(Address(THR, Thread::top_offset()), instance_reg); 2642 movl(Address(temp_reg, Heap::TopOffset(space)), instance_reg);
2642 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), temp_reg, space)); 2643 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), temp_reg, space));
2643 ASSERT(instance_size >= kHeapObjectTag); 2644 ASSERT(instance_size >= kHeapObjectTag);
2644 subl(instance_reg, Immediate(instance_size - kHeapObjectTag)); 2645 subl(instance_reg, Immediate(instance_size - kHeapObjectTag));
2645 uint32_t tags = 0; 2646 uint32_t tags = 0;
2646 tags = RawObject::SizeTag::update(instance_size, tags); 2647 tags = RawObject::SizeTag::update(instance_size, tags);
2647 ASSERT(cls.id() != kIllegalCid); 2648 ASSERT(cls.id() != kIllegalCid);
2648 tags = RawObject::ClassIdTag::update(cls.id(), tags); 2649 tags = RawObject::ClassIdTag::update(cls.id(), tags);
2649 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); 2650 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags));
2650 } else { 2651 } else {
2651 jmp(failure); 2652 jmp(failure);
2652 } 2653 }
2653 } 2654 }
2654 2655
2655 2656
2656 void Assembler::TryAllocateArray(intptr_t cid, 2657 void Assembler::TryAllocateArray(intptr_t cid,
2657 intptr_t instance_size, 2658 intptr_t instance_size,
2658 Label* failure, 2659 Label* failure,
2659 bool near_jump, 2660 bool near_jump,
2660 Register instance, 2661 Register instance,
2661 Register end_address, 2662 Register end_address,
2662 Register temp_reg) { 2663 Register temp_reg) {
2663 ASSERT(failure != NULL); 2664 ASSERT(failure != NULL);
2664 ASSERT(temp_reg != kNoRegister); 2665 ASSERT(temp_reg != kNoRegister);
2665 if (FLAG_inline_alloc) { 2666 if (FLAG_inline_alloc) {
2666 // If this allocation is traced, program will jump to failure path 2667 // If this allocation is traced, program will jump to failure path
2667 // (i.e. the allocation stub) which will allocate the object and trace the 2668 // (i.e. the allocation stub) which will allocate the object and trace the
2668 // allocation call site. 2669 // allocation call site.
2669 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp_reg, failure, near_jump)); 2670 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp_reg, failure, near_jump));
2670 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 2671 Heap::Space space = Heap::kNew;
2671 movl(instance, Address(THR, Thread::top_offset())); 2672 movl(temp_reg, Address(THR, Thread::heap_offset()));
2673 movl(instance, Address(temp_reg, Heap::TopOffset(space)));
2672 movl(end_address, instance); 2674 movl(end_address, instance);
2673 2675
2674 addl(end_address, Immediate(instance_size)); 2676 addl(end_address, Immediate(instance_size));
2675 j(CARRY, failure); 2677 j(CARRY, failure);
2676 2678
2677 // Check if the allocation fits into the remaining space. 2679 // Check if the allocation fits into the remaining space.
2678 // EAX: potential new object start. 2680 // EAX: potential new object start.
2679 // EBX: potential next object start. 2681 // EBX: potential next object start.
2680 cmpl(end_address, Address(THR, Thread::end_offset())); 2682 cmpl(end_address, Address(temp_reg, Heap::EndOffset(space)));
2681 j(ABOVE_EQUAL, failure); 2683 j(ABOVE_EQUAL, failure);
2682 2684
2683 // Successfully allocated the object(s), now update top to point to 2685 // Successfully allocated the object(s), now update top to point to
2684 // next object start and initialize the object. 2686 // next object start and initialize the object.
2685 movl(Address(THR, Thread::top_offset()), end_address); 2687 movl(Address(temp_reg, Heap::TopOffset(space)), end_address);
2686 addl(instance, Immediate(kHeapObjectTag)); 2688 addl(instance, Immediate(kHeapObjectTag));
2687 NOT_IN_PRODUCT( 2689 NOT_IN_PRODUCT(
2688 UpdateAllocationStatsWithSize(cid, instance_size, temp_reg, space)); 2690 UpdateAllocationStatsWithSize(cid, instance_size, temp_reg, space));
2689 2691
2690 // Initialize the tags. 2692 // Initialize the tags.
2691 uint32_t tags = 0; 2693 uint32_t tags = 0;
2692 tags = RawObject::ClassIdTag::update(cid, tags); 2694 tags = RawObject::ClassIdTag::update(cid, tags);
2693 tags = RawObject::SizeTag::update(instance_size, tags); 2695 tags = RawObject::SizeTag::update(instance_size, tags);
2694 movl(FieldAddress(instance, Object::tags_offset()), Immediate(tags)); 2696 movl(FieldAddress(instance, Object::tags_offset()), Immediate(tags));
2695 } else { 2697 } else {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 3022
3021 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3023 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3022 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3024 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3023 return xmm_reg_names[reg]; 3025 return xmm_reg_names[reg];
3024 } 3026 }
3025 3027
3026 3028
3027 } // namespace dart 3029 } // namespace dart
3028 3030
3029 #endif // defined TARGET_ARCH_IA32 3031 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698