| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 and_(scratch, Immediate(static_cast<int32_t>(HEAP->NewSpaceMask()))); | 254 and_(scratch, Immediate(static_cast<int32_t>(HEAP->NewSpaceMask()))); |
| 255 j(cc, branch, near_jump); | 255 j(cc, branch, near_jump); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 | 259 |
| 260 void MacroAssembler::RecordWrite(Register object, | 260 void MacroAssembler::RecordWrite(Register object, |
| 261 int offset, | 261 int offset, |
| 262 Register value, | 262 Register value, |
| 263 Register index) { | 263 Register index) { |
| 264 // The compiled code assumes that record write doesn't change the | |
| 265 // context register, so we check that none of the clobbered | |
| 266 // registers are rsi. | |
| 267 ASSERT(!object.is(rsi) && !value.is(rsi) && !index.is(rsi)); | |
| 268 | |
| 269 // First, check if a write barrier is even needed. The tests below | 264 // First, check if a write barrier is even needed. The tests below |
| 270 // catch stores of smis and stores into the young generation. | 265 // catch stores of smis and stores into the young generation. |
| 271 Label done; | 266 Label done; |
| 272 JumpIfSmi(value, &done); | 267 JumpIfSmi(value, &done); |
| 273 | 268 |
| 274 RecordWriteNonSmi(object, offset, value, index); | 269 RecordWriteNonSmi(object, offset, value, index); |
| 275 bind(&done); | 270 bind(&done); |
| 276 | 271 |
| 277 // Clobber all input registers when running with the debug-code flag | 272 // Clobber all input registers when running with the debug-code flag |
| 278 // turned on to provoke errors. This clobbering repeats the | 273 // turned on to provoke errors. This clobbering repeats the |
| 279 // clobbering done inside RecordWriteNonSmi but it's necessary to | 274 // clobbering done inside RecordWriteNonSmi but it's necessary to |
| 280 // avoid having the fast case for smis leave the registers | 275 // avoid having the fast case for smis leave the registers |
| 281 // unchanged. | 276 // unchanged. |
| 282 if (emit_debug_code()) { | 277 if (emit_debug_code()) { |
| 283 movq(object, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 278 movq(object, BitCast<int64_t>(kZapValue), RelocInfo::NONE); |
| 284 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 279 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE); |
| 285 movq(index, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 280 movq(index, BitCast<int64_t>(kZapValue), RelocInfo::NONE); |
| 286 } | 281 } |
| 287 } | 282 } |
| 288 | 283 |
| 289 | 284 |
| 290 void MacroAssembler::RecordWrite(Register object, | 285 void MacroAssembler::RecordWrite(Register object, |
| 291 Register address, | 286 Register address, |
| 292 Register value) { | 287 Register value) { |
| 293 // The compiled code assumes that record write doesn't change the | |
| 294 // context register, so we check that none of the clobbered | |
| 295 // registers are rsi. | |
| 296 ASSERT(!object.is(rsi) && !value.is(rsi) && !address.is(rsi)); | |
| 297 | |
| 298 // First, check if a write barrier is even needed. The tests below | 288 // First, check if a write barrier is even needed. The tests below |
| 299 // catch stores of smis and stores into the young generation. | 289 // catch stores of smis and stores into the young generation. |
| 300 Label done; | 290 Label done; |
| 301 JumpIfSmi(value, &done); | 291 JumpIfSmi(value, &done); |
| 302 | 292 |
| 303 InNewSpace(object, value, equal, &done); | 293 InNewSpace(object, value, equal, &done); |
| 304 | 294 |
| 305 RecordWriteHelper(object, address, value); | 295 RecordWriteHelper(object, address, value); |
| 306 | 296 |
| 307 bind(&done); | 297 bind(&done); |
| (...skipping 3580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3888 CPU::FlushICache(address_, size_); | 3878 CPU::FlushICache(address_, size_); |
| 3889 | 3879 |
| 3890 // Check that the code was patched as expected. | 3880 // Check that the code was patched as expected. |
| 3891 ASSERT(masm_.pc_ == address_ + size_); | 3881 ASSERT(masm_.pc_ == address_ + size_); |
| 3892 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 3882 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 3893 } | 3883 } |
| 3894 | 3884 |
| 3895 } } // namespace v8::internal | 3885 } } // namespace v8::internal |
| 3896 | 3886 |
| 3897 #endif // V8_TARGET_ARCH_X64 | 3887 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |