Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 14 matching lines...) Expand all Loading... | |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_IA32) | 30 #if defined(V8_TARGET_ARCH_IA32) |
| 31 | 31 |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "codegen.h" | 33 #include "codegen.h" |
| 34 #include "debug.h" | 34 #include "debug.h" |
| 35 #include "macro-assembler-ia32-inl.h" | |
| 35 #include "runtime.h" | 36 #include "runtime.h" |
| 36 #include "serialize.h" | 37 #include "serialize.h" |
| 37 | 38 |
| 38 namespace v8 { | 39 namespace v8 { |
| 39 namespace internal { | 40 namespace internal { |
| 40 | 41 |
| 41 // ------------------------------------------------------------------------- | 42 // ------------------------------------------------------------------------- |
| 42 // MacroAssembler implementation. | 43 // MacroAssembler implementation. |
| 43 | 44 |
| 44 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 45 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 ASSERT(!object.is(address)); | 210 ASSERT(!object.is(address)); |
| 210 ASSERT(!value.is(address)); | 211 ASSERT(!value.is(address)); |
| 211 if (emit_debug_code()) { | 212 if (emit_debug_code()) { |
| 212 AbortIfSmi(object); | 213 AbortIfSmi(object); |
| 213 } | 214 } |
| 214 | 215 |
| 215 if (emit_remembered_set == OMIT_REMEMBERED_SET && | 216 if (emit_remembered_set == OMIT_REMEMBERED_SET && |
| 216 FLAG_incremental_marking == false) { | 217 FLAG_incremental_marking == false) { |
| 217 return; | 218 return; |
| 218 } | 219 } |
| 220 | |
| 221 if (FLAG_debug_code) { | |
| 222 NearLabel ok; | |
| 223 cmp(value, Operand(address, 0)); | |
| 224 j(equal, &ok); | |
| 225 Abort("Registers did not match in write barrier"); | |
| 226 bind(&ok); | |
| 227 } | |
| 228 | |
| 219 // First, check if a write barrier is even needed. The tests below | 229 // First, check if a write barrier is even needed. The tests below |
| 220 // catch stores of Smis and stores into young gen. | 230 // catch stores of Smis and stores into young gen. |
| 221 NearLabel done; | 231 NearLabel done; |
| 222 | 232 |
| 223 if (smi_check == INLINE_SMI_CHECK) { | 233 if (smi_check == INLINE_SMI_CHECK) { |
| 224 // Skip barrier if writing a smi. | 234 // Skip barrier if writing a smi. |
| 225 ASSERT_EQ(0, kSmiTag); | 235 ASSERT_EQ(0, kSmiTag); |
| 226 test(value, Immediate(kSmiTagMask)); | 236 test(value, Immediate(kSmiTagMask)); |
| 227 j(zero, &done); | 237 j(zero, &done); |
| 228 } | 238 } |
| 229 | 239 |
| 240 CheckPageFlag(value, | |
| 241 value, | |
|
Erik Corry
2011/05/11 18:53:57
Add comment that value is used as scratch here.
Vyacheslav Egorov (Chromium)
2011/05/13 11:06:52
Done.
| |
| 242 MemoryChunk::CONTAINS_INTERESTING_VALUES, | |
| 243 zero, | |
| 244 &done); | |
| 245 CheckPageFlag(object, | |
| 246 value, | |
| 247 MemoryChunk::CONTAINS_INTERESTING_DESTINATIONS, | |
| 248 zero, | |
| 249 &done); | |
| 250 | |
| 230 RecordWriteStub stub(object, value, address, emit_remembered_set, fp_mode); | 251 RecordWriteStub stub(object, value, address, emit_remembered_set, fp_mode); |
| 231 CallStub(&stub); | 252 CallStub(&stub); |
| 232 | 253 |
| 233 if (smi_check == INLINE_SMI_CHECK) { | 254 bind(&done); |
| 234 bind(&done); | |
| 235 } | |
| 236 | 255 |
| 237 // Clobber clobbered registers when running with the debug-code flag | 256 // Clobber clobbered registers when running with the debug-code flag |
| 238 // turned on to provoke errors. | 257 // turned on to provoke errors. |
| 239 if (emit_debug_code()) { | 258 if (emit_debug_code()) { |
| 240 mov(address, Immediate(BitCast<int32_t>(kZapValue))); | 259 mov(address, Immediate(BitCast<int32_t>(kZapValue))); |
| 241 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 260 mov(value, Immediate(BitCast<int32_t>(kZapValue))); |
| 242 } | 261 } |
| 243 } | 262 } |
| 244 | 263 |
| 245 | 264 |
| (...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2137 | 2156 |
| 2138 // Check that the code was patched as expected. | 2157 // Check that the code was patched as expected. |
| 2139 ASSERT(masm_.pc_ == address_ + size_); | 2158 ASSERT(masm_.pc_ == address_ + size_); |
| 2140 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2159 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 2141 } | 2160 } |
| 2142 | 2161 |
| 2143 | 2162 |
| 2144 } } // namespace v8::internal | 2163 } } // namespace v8::internal |
| 2145 | 2164 |
| 2146 #endif // V8_TARGET_ARCH_IA32 | 2165 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |