OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 | 230 |
231 // Clobber clobbered input registers when running with the debug-code flag | 231 // Clobber clobbered input registers when running with the debug-code flag |
232 // turned on to provoke errors. | 232 // turned on to provoke errors. |
233 if (emit_debug_code()) { | 233 if (emit_debug_code()) { |
234 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 234 mov(value, Immediate(BitCast<int32_t>(kZapValue))); |
235 mov(dst, Immediate(BitCast<int32_t>(kZapValue))); | 235 mov(dst, Immediate(BitCast<int32_t>(kZapValue))); |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 | 239 |
240 void MacroAssembler::RecordWriteForMap( | |
241 Register object, | |
242 Handle<Map> map, | |
243 Register scratch1, | |
244 Register scratch2, | |
245 SaveFPRegsMode save_fp) { | |
246 // First, check if a write barrier is even needed. The tests below | |
247 // catch stores of Smis. | |
Erik Corry
2012/06/06 11:04:26
Comment seems to be out of date.
| |
248 Label done; | |
249 | |
250 Register address = scratch1; | |
251 Register value = scratch2; | |
252 if (emit_debug_code()) { | |
253 Label ok; | |
254 lea(address, FieldOperand(object, HeapObject::kMapOffset)); | |
255 test_b(address, (1 << kPointerSizeLog2) - 1); | |
256 j(zero, &ok, Label::kNear); | |
257 int3(); | |
258 bind(&ok); | |
259 } | |
260 | |
261 ASSERT(!object.is(value)); | |
262 ASSERT(!object.is(address)); | |
263 ASSERT(!value.is(address)); | |
264 if (emit_debug_code()) { | |
265 AbortIfSmi(object); | |
266 } | |
267 | |
268 if (!FLAG_incremental_marking) { | |
269 return; | |
270 } | |
271 | |
272 // A single check of the map's pages interesting flag suffices, since it is | |
273 // only set during incremental collection, and it's guaranteed that the from | |
274 // object's interesting flag is also set. | |
Michael Starzinger
2012/06/06 09:41:17
Can we add to the comment that this relies on "map
danno
2012/06/06 10:58:28
Done.
| |
275 CheckPageFlag(map, | |
276 MemoryChunk::kPointersToHereAreInterestingMask, | |
277 zero, | |
278 &done, | |
279 Label::kNear); | |
280 | |
281 // Delay the initialization of |address| and |value| for the stub until it's | |
282 // known that the will be needed. Up until this point their value are not | |
283 // needed since they are embedded in the operands of instructions that need | |
284 // them. | |
285 lea(address, FieldOperand(object, HeapObject::kMapOffset)); | |
286 mov(value, Immediate(map)); | |
287 RecordWriteStub stub(object, value, address, OMIT_REMEMBERED_SET, save_fp); | |
288 CallStub(&stub); | |
289 | |
290 bind(&done); | |
291 | |
292 // Clobber clobbered input registers when running with the debug-code flag | |
293 // turned on to provoke errors. | |
294 if (emit_debug_code()) { | |
295 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | |
296 mov(scratch1, Immediate(BitCast<int32_t>(kZapValue))); | |
297 mov(scratch2, Immediate(BitCast<int32_t>(kZapValue))); | |
298 } | |
299 } | |
300 | |
301 | |
240 void MacroAssembler::RecordWrite(Register object, | 302 void MacroAssembler::RecordWrite(Register object, |
241 Register address, | 303 Register address, |
242 Register value, | 304 Register value, |
243 SaveFPRegsMode fp_mode, | 305 SaveFPRegsMode fp_mode, |
244 RememberedSetAction remembered_set_action, | 306 RememberedSetAction remembered_set_action, |
245 SmiCheck smi_check) { | 307 SmiCheck smi_check) { |
246 ASSERT(!object.is(value)); | 308 ASSERT(!object.is(value)); |
247 ASSERT(!object.is(address)); | 309 ASSERT(!object.is(address)); |
248 ASSERT(!value.is(address)); | 310 ASSERT(!value.is(address)); |
249 if (emit_debug_code()) { | 311 if (emit_debug_code()) { |
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2611 if (mask < (1 << kBitsPerByte)) { | 2673 if (mask < (1 << kBitsPerByte)) { |
2612 test_b(Operand(scratch, MemoryChunk::kFlagsOffset), | 2674 test_b(Operand(scratch, MemoryChunk::kFlagsOffset), |
2613 static_cast<uint8_t>(mask)); | 2675 static_cast<uint8_t>(mask)); |
2614 } else { | 2676 } else { |
2615 test(Operand(scratch, MemoryChunk::kFlagsOffset), Immediate(mask)); | 2677 test(Operand(scratch, MemoryChunk::kFlagsOffset), Immediate(mask)); |
2616 } | 2678 } |
2617 j(cc, condition_met, condition_met_distance); | 2679 j(cc, condition_met, condition_met_distance); |
2618 } | 2680 } |
2619 | 2681 |
2620 | 2682 |
2683 void MacroAssembler::CheckPageFlag( | |
2684 Handle<Map> map, | |
2685 int mask, | |
2686 Condition cc, | |
2687 Label* condition_met, | |
2688 Label::Distance condition_met_distance) { | |
2689 ASSERT(cc == zero || cc == not_zero); | |
2690 uint32_t masked_address = reinterpret_cast<uint32_t>(*map) & | |
2691 ~Page::kPageAlignmentMask; | |
2692 Page* page = reinterpret_cast<Page*>(masked_address); | |
Michael Starzinger
2012/06/06 09:41:17
Better use the following "Page* page = Page::FromA
danno
2012/06/06 10:58:28
Done.
| |
2693 ExternalReference reference(ExternalReference::page_flags(page)); | |
2694 if (mask < (1 << kBitsPerByte)) { | |
2695 test_b(Operand::StaticVariable(reference), static_cast<uint8_t>(mask)); | |
2696 } else { | |
2697 test(Operand::StaticVariable(reference), Immediate(mask)); | |
2698 } | |
2699 j(cc, condition_met, condition_met_distance); | |
2700 } | |
2701 | |
2702 | |
2621 void MacroAssembler::JumpIfBlack(Register object, | 2703 void MacroAssembler::JumpIfBlack(Register object, |
2622 Register scratch0, | 2704 Register scratch0, |
2623 Register scratch1, | 2705 Register scratch1, |
2624 Label* on_black, | 2706 Label* on_black, |
2625 Label::Distance on_black_near) { | 2707 Label::Distance on_black_near) { |
2626 HasColor(object, scratch0, scratch1, | 2708 HasColor(object, scratch0, scratch1, |
2627 on_black, on_black_near, | 2709 on_black, on_black_near, |
2628 1, 0); // kBlackBitPattern. | 2710 1, 0); // kBlackBitPattern. |
2629 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); | 2711 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); |
2630 } | 2712 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2822 // Load the prototype from the map and loop if non-null. | 2904 // Load the prototype from the map and loop if non-null. |
2823 bind(&check_prototype); | 2905 bind(&check_prototype); |
2824 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 2906 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); |
2825 cmp(ecx, isolate()->factory()->null_value()); | 2907 cmp(ecx, isolate()->factory()->null_value()); |
2826 j(not_equal, &next); | 2908 j(not_equal, &next); |
2827 } | 2909 } |
2828 | 2910 |
2829 } } // namespace v8::internal | 2911 } } // namespace v8::internal |
2830 | 2912 |
2831 #endif // V8_TARGET_ARCH_IA32 | 2913 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |