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

Side by Side Diff: src/ia32/macro-assembler-ia32.h

Issue 6824078: Move most of the incremental marking write barrier to generated code. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 8 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // --------------------------------------------------------------------------- 67 // ---------------------------------------------------------------------------
68 // GC Support 68 // GC Support
69 69
70 void IncrementalMarkingRecordWriteHelper(Register object, 70 void IncrementalMarkingRecordWriteHelper(Register object,
71 Register value, 71 Register value,
72 Register address); 72 Register address);
73 73
74 // For page containing |object| mark region covering |addr| dirty. 74 // For page containing |object| mark region covering |addr| dirty.
75 // RememberedSetHelper only works if the object is not in new 75 // RememberedSetHelper only works if the object is not in new
76 // space. 76 // space.
77 void RememberedSetHelper(Register object, 77 void RememberedSetHelper(Register addr,
78 Register addr,
79 Register scratch, 78 Register scratch,
80 SaveFPRegsMode save_fp); 79 SaveFPRegsMode save_fp);
81 80
82 // Check if object is in new space. 81 // Check if object is in new space.
83 // scratch can be object itself, but it will be clobbered. 82 // scratch can be object itself, but it will be clobbered.
84 template <typename LabelType> 83 template <typename LabelType>
85 void InNewSpace(Register object, 84 void InNewSpace(Register object,
86 Register scratch, 85 Register scratch,
87 Condition cc, // equal for new space, not_equal otherwise. 86 Condition cc, // equal for new space, not_equal otherwise.
88 LabelType* branch); 87 LabelType* branch);
89 88
90 // For page containing |object| mark region covering [object+offset] 89 // Check if old-space object is on a scan-on-scavenge page.
91 // dirty. |object| is the object being stored into, |value| is the 90 template <typename LabelType>
92 // object being stored. If offset is zero, then the scratch register 91 void HasScanOnScavenge(Register object,
93 // contains the array index into the elements array represented as a 92 Register scratch,
94 // Smi. All registers are clobbered by the operation. RecordWrite 93 LabelType* scan_on_scavenge);
94
95 // Check if an object has a given incremental marking colour. Also uses ecx!
96 // The colour bits are found by splitting the address at the bit offset
97 // indicated by the mask: bits that are zero in the mask are used for the
98 // address of the bitmap, and bits that are one in the mask are used for the
99 // index of the bit.
100 template <typename LabelType>
101 void HasColour(Register object,
102 Register scratch0,
103 Register scratch1,
104 LabelType* has_colour,
105 uint32_t mask,
106 int header_size,
107 int first_bit,
108 int second_bit,
109 bool in_new_space);
110
111 template <typename LabelType>
112 void InOldSpaceIsBlack(Register object,
113 Register scratch0,
114 Register scratch1,
115 LabelType* is_black);
116
117 template <typename LabelType>
118 void InNewSpaceIsBlack(Register object,
119 Register scratch0,
120 Register scratch1,
121 LabelType* is_black);
122
123 // Checks the colour of an object. If the object is already grey or black
124 // then we just fall through, since it is already live. If it is white and
125 // we can determine that it doesn't need to be scanned, then we just mark it
126 // black and fall through. For the rest we jump to the label so the
127 // incremental marker can fix its assumptions.
128 template <typename LabelType>
129 void MarkBlack(Register object,
130 Register scratch1,
131 Register scratch2,
132 LabelType* object_is_white_and_not_data,
133 bool in_new_space);
134
135 // Checks whether an object is data-only, ie it does need to be scanned by the
136 // garbage collector.
137 template <typename LabelType>
138 void IsDataObject(Register value,
139 Register scratch,
140 LabelType* not_data_object,
141 bool in_new_space);
142
143 // Notify the garbage collector that we wrote a pointer into an object.
144 // |object| is the object being stored into, |value| is the object being
145 // stored. All registers are clobbered by the operation. RecordWriteField
146 // filters out smis so it does not update the write barrier if the value is a
147 // smi. The offset is the offset from the start of the object, not the offset
148 // from the tagged HeapObject pointer. For use with FieldOperand(reg, off).
149 void RecordWriteField(Register object,
150 int offset,
151 Register value,
152 Register scratch,
153 SaveFPRegsMode save_fp);
154
155 // As above, but the offset has the tag presubtracted. For use with
156 // Operand(reg, off).
157 inline void RecordWriteContextSlot(Register context,
158 int offset,
159 Register value,
160 Register scratch,
161 SaveFPRegsMode save_fp) {
162 RecordWriteField(context,
163 offset + kHeapObjectTag,
164 value,
165 scratch,
166 save_fp);
167 }
168
169
170
171
172 // Notify the garbage collector that we wrote a pointer into a fixed array.
173 // |array| is the array being stored into, |value| is the
174 // object being stored. |index| is the array index represented as a
175 // Smi. All registers are clobbered by the operation RecordWriteArray
95 // filters out smis so it does not update the write barrier if the 176 // filters out smis so it does not update the write barrier if the
96 // value is a smi. 177 // value is a smi.
97 void RecordWrite(Register object, 178 void RecordWriteArray(Register array,
98 int offset, 179 Register value,
99 Register value, 180 Register index,
100 Register scratch, 181 SaveFPRegsMode save_fp);
101 SaveFPRegsMode save_fp);
102 182
103 // For page containing |object| mark region covering |address| 183 // For page containing |object| mark region covering |address|
104 // dirty. |object| is the object being stored into, |value| is the 184 // dirty. |object| is the object being stored into, |value| is the
105 // object being stored. All registers are clobbered by the 185 // object being stored. All registers are clobbered by the
106 // operation. RecordWrite filters out smis so it does not update the 186 // operation. RecordWrite filters out smis so it does not update the
107 // write barrier if the value is a smi. 187 // write barrier if the value is a smi.
108 void RecordWrite(Register object, 188 void RecordWrite(Register object,
109 Register address, 189 Register address,
110 Register value, 190 Register value,
111 EmitRememberedSet emit_remembered_set, 191 EmitRememberedSet emit_remembered_set,
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 779
700 780
701 template <typename LabelType> 781 template <typename LabelType>
702 void MacroAssembler::InNewSpace(Register object, 782 void MacroAssembler::InNewSpace(Register object,
703 Register scratch, 783 Register scratch,
704 Condition cc, 784 Condition cc,
705 LabelType* branch) { 785 LabelType* branch) {
706 ASSERT(cc == equal || cc == not_equal); 786 ASSERT(cc == equal || cc == not_equal);
707 if (Serializer::enabled()) { 787 if (Serializer::enabled()) {
708 // Can't do arithmetic on external references if it might get serialized. 788 // Can't do arithmetic on external references if it might get serialized.
709 mov(scratch, Operand(object)); 789 Move(scratch, object);
710 // The mask isn't really an address. We load it as an external reference in 790 // The mask isn't really an address. We load it as an external reference in
711 // case the size of the new space is different between the snapshot maker 791 // case the size of the new space is different between the snapshot maker
712 // and the running system. 792 // and the running system.
713 and_(Operand(scratch), Immediate(ExternalReference::new_space_mask())); 793 and_(Operand(scratch), Immediate(ExternalReference::new_space_mask()));
714 cmp(Operand(scratch), Immediate(ExternalReference::new_space_start())); 794 cmp(Operand(scratch), Immediate(ExternalReference::new_space_start()));
715 j(cc, branch); 795 j(cc, branch);
716 } else { 796 } else {
717 int32_t new_space_start = reinterpret_cast<int32_t>( 797 int32_t new_space_start = reinterpret_cast<int32_t>(
718 ExternalReference::new_space_start().address()); 798 ExternalReference::new_space_start().address());
719 lea(scratch, Operand(object, -new_space_start)); 799 if (object.is(scratch)) {
800 sub(Operand(scratch), Immediate(new_space_start));
801 } else {
802 lea(scratch, Operand(object, -new_space_start));
803 }
720 and_(scratch, Heap::NewSpaceMask()); 804 and_(scratch, Heap::NewSpaceMask());
721 j(cc, branch); 805 j(cc, branch);
722 } 806 }
723 } 807 }
724 808
725 809
726 // The code patcher is used to patch (typically) small parts of code e.g. for 810 // The code patcher is used to patch (typically) small parts of code e.g. for
727 // debugging and other types of instrumentation. When using the code patcher 811 // debugging and other types of instrumentation. When using the code patcher
728 // the exact number of bytes specified must be emitted. Is not legal to emit 812 // the exact number of bytes specified must be emitted. Is not legal to emit
729 // relocation information. If any of these constraints are violated it causes 813 // relocation information. If any of these constraints are violated it causes
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 } \ 888 } \
805 masm-> 889 masm->
806 #else 890 #else
807 #define ACCESS_MASM(masm) masm-> 891 #define ACCESS_MASM(masm) masm->
808 #endif 892 #endif
809 893
810 894
811 } } // namespace v8::internal 895 } } // namespace v8::internal
812 896
813 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ 897 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698