| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ASSERT(!object.is(rsi) && !value.is(rsi) && !smi_index.is(rsi)); | 184 ASSERT(!object.is(rsi) && !value.is(rsi) && !smi_index.is(rsi)); |
| 185 | 185 |
| 186 // First, check if a remembered set write is even needed. The tests below | 186 // First, check if a remembered set write is even needed. The tests below |
| 187 // catch stores of Smis and stores into young gen (which does not have space | 187 // catch stores of Smis and stores into young gen (which does not have space |
| 188 // for the remembered set bits. | 188 // for the remembered set bits. |
| 189 Label done; | 189 Label done; |
| 190 JumpIfSmi(value, &done); | 190 JumpIfSmi(value, &done); |
| 191 | 191 |
| 192 RecordWriteNonSmi(object, offset, value, smi_index); | 192 RecordWriteNonSmi(object, offset, value, smi_index); |
| 193 bind(&done); | 193 bind(&done); |
| 194 |
| 195 // Clobber all input registers when running with the debug-code flag |
| 196 // turned on to provoke errors. This clobbering repeats the |
| 197 // clobbering done inside RecordWriteNonSmi but it's necessary to |
| 198 // avoid having the fast case for smis leave the registers |
| 199 // unchanged. |
| 200 if (FLAG_debug_code) { |
| 201 movq(object, bit_cast<int64_t>(kZapValue), RelocInfo::NONE); |
| 202 movq(value, bit_cast<int64_t>(kZapValue), RelocInfo::NONE); |
| 203 movq(smi_index, bit_cast<int64_t>(kZapValue), RelocInfo::NONE); |
| 204 } |
| 194 } | 205 } |
| 195 | 206 |
| 196 | 207 |
| 197 void MacroAssembler::RecordWriteNonSmi(Register object, | 208 void MacroAssembler::RecordWriteNonSmi(Register object, |
| 198 int offset, | 209 int offset, |
| 199 Register scratch, | 210 Register scratch, |
| 200 Register smi_index) { | 211 Register smi_index) { |
| 201 Label done; | 212 Label done; |
| 213 |
| 214 if (FLAG_debug_code) { |
| 215 Label okay; |
| 216 JumpIfNotSmi(object, &okay); |
| 217 Abort("MacroAssembler::RecordWriteNonSmi cannot deal with smis"); |
| 218 bind(&okay); |
| 219 } |
| 220 |
| 202 // Test that the object address is not in the new space. We cannot | 221 // Test that the object address is not in the new space. We cannot |
| 203 // set remembered set bits in the new space. | 222 // set remembered set bits in the new space. |
| 204 movq(scratch, object); | 223 movq(scratch, object); |
| 205 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); | 224 ASSERT(is_int32(static_cast<int64_t>(Heap::NewSpaceMask()))); |
| 206 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); | 225 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); |
| 207 movq(kScratchRegister, ExternalReference::new_space_start()); | 226 movq(kScratchRegister, ExternalReference::new_space_start()); |
| 208 cmpq(scratch, kScratchRegister); | 227 cmpq(scratch, kScratchRegister); |
| 209 j(equal, &done); | 228 j(equal, &done); |
| 210 | 229 |
| 211 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize)) { | 230 if ((offset > 0) && (offset < Page::kMaxHeapObjectSize)) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 241 // record write code isn't going to save us any memory. | 260 // record write code isn't going to save us any memory. |
| 242 if (generating_stub()) { | 261 if (generating_stub()) { |
| 243 RecordWriteHelper(this, object, dst, scratch); | 262 RecordWriteHelper(this, object, dst, scratch); |
| 244 } else { | 263 } else { |
| 245 RecordWriteStub stub(object, dst, scratch); | 264 RecordWriteStub stub(object, dst, scratch); |
| 246 CallStub(&stub); | 265 CallStub(&stub); |
| 247 } | 266 } |
| 248 } | 267 } |
| 249 | 268 |
| 250 bind(&done); | 269 bind(&done); |
| 270 |
| 271 // Clobber all input registers when running with the debug-code flag |
| 272 // turned on to provoke errors. |
| 273 if (FLAG_debug_code) { |
| 274 movq(object, bit_cast<int64_t>(kZapValue), RelocInfo::NONE); |
| 275 movq(scratch, bit_cast<int64_t>(kZapValue), RelocInfo::NONE); |
| 276 movq(smi_index, bit_cast<int64_t>(kZapValue), RelocInfo::NONE); |
| 277 } |
| 251 } | 278 } |
| 252 | 279 |
| 253 | 280 |
| 254 void MacroAssembler::Assert(Condition cc, const char* msg) { | 281 void MacroAssembler::Assert(Condition cc, const char* msg) { |
| 255 if (FLAG_debug_code) Check(cc, msg); | 282 if (FLAG_debug_code) Check(cc, msg); |
| 256 } | 283 } |
| 257 | 284 |
| 258 | 285 |
| 259 void MacroAssembler::Check(Condition cc, const char* msg) { | 286 void MacroAssembler::Check(Condition cc, const char* msg) { |
| 260 Label L; | 287 Label L; |
| (...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2540 CodePatcher::~CodePatcher() { | 2567 CodePatcher::~CodePatcher() { |
| 2541 // Indicate that code has changed. | 2568 // Indicate that code has changed. |
| 2542 CPU::FlushICache(address_, size_); | 2569 CPU::FlushICache(address_, size_); |
| 2543 | 2570 |
| 2544 // Check that the code was patched as expected. | 2571 // Check that the code was patched as expected. |
| 2545 ASSERT(masm_.pc_ == address_ + size_); | 2572 ASSERT(masm_.pc_ == address_ + size_); |
| 2546 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2573 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 2547 } | 2574 } |
| 2548 | 2575 |
| 2549 } } // namespace v8::internal | 2576 } } // namespace v8::internal |
| OLD | NEW |