OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 : Assembler(buffer, size), | 43 : Assembler(buffer, size), |
44 generating_stub_(false), | 44 generating_stub_(false), |
45 allow_stub_calls_(true), | 45 allow_stub_calls_(true), |
46 code_object_(Heap::undefined_value()) { | 46 code_object_(Heap::undefined_value()) { |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 void MacroAssembler::RecordWriteHelper(Register object, | 50 void MacroAssembler::RecordWriteHelper(Register object, |
51 Register addr, | 51 Register addr, |
52 Register scratch) { | 52 Register scratch) { |
| 53 if (FLAG_debug_code) { |
| 54 // Check that the object is not in new space. |
| 55 Label not_in_new_space; |
| 56 InNewSpace(object, scratch, not_equal, ¬_in_new_space); |
| 57 Abort("new-space object passed to RecordWriteHelper"); |
| 58 bind(¬_in_new_space); |
| 59 } |
| 60 |
53 Label fast; | 61 Label fast; |
54 | 62 |
55 // Compute the page start address from the heap object pointer, and reuse | 63 // Compute the page start address from the heap object pointer, and reuse |
56 // the 'object' register for it. | 64 // the 'object' register for it. |
57 and_(object, ~Page::kPageAlignmentMask); | 65 and_(object, ~Page::kPageAlignmentMask); |
58 Register page_start = object; | 66 Register page_start = object; |
59 | 67 |
60 // Compute the bit addr in the remembered set/index of the pointer in the | 68 // Compute the bit addr in the remembered set/index of the pointer in the |
61 // page. Reuse 'addr' as pointer_offset. | 69 // page. Reuse 'addr' as pointer_offset. |
62 sub(addr, Operand(page_start)); | 70 sub(addr, Operand(page_start)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // All registers are clobbered by the operation. | 135 // All registers are clobbered by the operation. |
128 void MacroAssembler::RecordWrite(Register object, int offset, | 136 void MacroAssembler::RecordWrite(Register object, int offset, |
129 Register value, Register scratch) { | 137 Register value, Register scratch) { |
130 // The compiled code assumes that record write doesn't change the | 138 // The compiled code assumes that record write doesn't change the |
131 // context register, so we check that none of the clobbered | 139 // context register, so we check that none of the clobbered |
132 // registers are esi. | 140 // registers are esi. |
133 ASSERT(!object.is(esi) && !value.is(esi) && !scratch.is(esi)); | 141 ASSERT(!object.is(esi) && !value.is(esi) && !scratch.is(esi)); |
134 | 142 |
135 // First, check if a remembered set write is even needed. The tests below | 143 // First, check if a remembered set write is even needed. The tests below |
136 // catch stores of Smis and stores into young gen (which does not have space | 144 // catch stores of Smis and stores into young gen (which does not have space |
137 // for the remembered set bits. | 145 // for the remembered set bits). |
138 Label done; | 146 Label done; |
139 | 147 |
140 // Skip barrier if writing a smi. | 148 // Skip barrier if writing a smi. |
141 ASSERT_EQ(0, kSmiTag); | 149 ASSERT_EQ(0, kSmiTag); |
142 test(value, Immediate(kSmiTagMask)); | 150 test(value, Immediate(kSmiTagMask)); |
143 j(zero, &done); | 151 j(zero, &done); |
144 | 152 |
145 InNewSpace(object, value, equal, &done); | 153 InNewSpace(object, value, equal, &done); |
146 | 154 |
147 // The offset is relative to a tagged or untagged HeapObject pointer, | 155 // The offset is relative to a tagged or untagged HeapObject pointer, |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 // Indicate that code has changed. | 1695 // Indicate that code has changed. |
1688 CPU::FlushICache(address_, size_); | 1696 CPU::FlushICache(address_, size_); |
1689 | 1697 |
1690 // Check that the code was patched as expected. | 1698 // Check that the code was patched as expected. |
1691 ASSERT(masm_.pc_ == address_ + size_); | 1699 ASSERT(masm_.pc_ == address_ + size_); |
1692 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1700 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1693 } | 1701 } |
1694 | 1702 |
1695 | 1703 |
1696 } } // namespace v8::internal | 1704 } } // namespace v8::internal |
OLD | NEW |