OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 }; | 161 }; |
162 | 162 |
163 | 163 |
164 void RecordWriteStub::Generate(MacroAssembler* masm) { | 164 void RecordWriteStub::Generate(MacroAssembler* masm) { |
165 RecordWriteHelper(masm, object_, addr_, scratch_); | 165 RecordWriteHelper(masm, object_, addr_, scratch_); |
166 masm->ret(0); | 166 masm->ret(0); |
167 } | 167 } |
168 | 168 |
169 | 169 |
| 170 void MacroAssembler::InNewSpace(Register object, |
| 171 Register scratch, |
| 172 Condition cc, |
| 173 Label* branch) { |
| 174 ASSERT(cc == equal || cc == not_equal); |
| 175 if (!scratch.is(object)) { |
| 176 movq(scratch, object); |
| 177 } |
| 178 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); |
| 179 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); |
| 180 movq(kScratchRegister, ExternalReference::new_space_start()); |
| 181 cmpq(scratch, kScratchRegister); |
| 182 j(cc, branch); |
| 183 } |
| 184 |
| 185 |
170 // Set the remembered set bit for [object+offset]. | 186 // Set the remembered set bit for [object+offset]. |
171 // object is the object being stored into, value is the object being stored. | 187 // object is the object being stored into, value is the object being stored. |
172 // If offset is zero, then the smi_index register contains the array index into | 188 // If offset is zero, then the smi_index register contains the array index into |
173 // the elements array represented as a smi. Otherwise it can be used as a | 189 // the elements array represented as a smi. Otherwise it can be used as a |
174 // scratch register. | 190 // scratch register. |
175 // All registers are clobbered by the operation. | 191 // All registers are clobbered by the operation. |
176 void MacroAssembler::RecordWrite(Register object, | 192 void MacroAssembler::RecordWrite(Register object, |
177 int offset, | 193 int offset, |
178 Register value, | 194 Register value, |
179 Register smi_index) { | 195 Register smi_index) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 228 |
213 if (FLAG_debug_code) { | 229 if (FLAG_debug_code) { |
214 Label okay; | 230 Label okay; |
215 JumpIfNotSmi(object, &okay); | 231 JumpIfNotSmi(object, &okay); |
216 Abort("MacroAssembler::RecordWriteNonSmi cannot deal with smis"); | 232 Abort("MacroAssembler::RecordWriteNonSmi cannot deal with smis"); |
217 bind(&okay); | 233 bind(&okay); |
218 } | 234 } |
219 | 235 |
220 // Test that the object address is not in the new space. We cannot | 236 // Test that the object address is not in the new space. We cannot |
221 // set remembered set bits in the new space. | 237 // set remembered set bits in the new space. |
222 movq(scratch, object); | 238 InNewSpace(object, scratch, equal, &done); |
223 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); | |
224 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); | |
225 movq(kScratchRegister, ExternalReference::new_space_start()); | |
226 cmpq(scratch, kScratchRegister); | |
227 j(equal, &done); | |
228 | 239 |
229 // The offset is relative to a tagged or untagged HeapObject pointer, | 240 // The offset is relative to a tagged or untagged HeapObject pointer, |
230 // so either offset or offset + kHeapObjectTag must be a | 241 // so either offset or offset + kHeapObjectTag must be a |
231 // multiple of kPointerSize. | 242 // multiple of kPointerSize. |
232 ASSERT(IsAligned(offset, kPointerSize) || | 243 ASSERT(IsAligned(offset, kPointerSize) || |
233 IsAligned(offset + kHeapObjectTag, kPointerSize)); | 244 IsAligned(offset + kHeapObjectTag, kPointerSize)); |
234 | 245 |
235 // We use optimized write barrier code if the word being written to is not in | 246 // We use optimized write barrier code if the word being written to is not in |
236 // a large object page, or is in the first "page" of a large object page. | 247 // a large object page, or is in the first "page" of a large object page. |
237 // We make sure that an offset is inside the right limits whether it is | 248 // We make sure that an offset is inside the right limits whether it is |
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 CodePatcher::~CodePatcher() { | 2699 CodePatcher::~CodePatcher() { |
2689 // Indicate that code has changed. | 2700 // Indicate that code has changed. |
2690 CPU::FlushICache(address_, size_); | 2701 CPU::FlushICache(address_, size_); |
2691 | 2702 |
2692 // Check that the code was patched as expected. | 2703 // Check that the code was patched as expected. |
2693 ASSERT(masm_.pc_ == address_ + size_); | 2704 ASSERT(masm_.pc_ == address_ + size_); |
2694 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2705 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2695 } | 2706 } |
2696 | 2707 |
2697 } } // namespace v8::internal | 2708 } } // namespace v8::internal |
OLD | NEW |