| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 296 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 297 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 297 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 298 if (rmode_ == EMBEDDED_OBJECT) { | 298 if (rmode_ == EMBEDDED_OBJECT) { |
| 299 return Memory::Object_Handle_at(pc_); | 299 return Memory::Object_Handle_at(pc_); |
| 300 } else { | 300 } else { |
| 301 return origin->code_target_object_handle_at(pc_); | 301 return origin->code_target_object_handle_at(pc_); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 | 305 |
| 306 Object** RelocInfo::target_object_address() { | 306 Address RelocInfo::target_reference() { |
| 307 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 307 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
| 308 return reinterpret_cast<Object**>(pc_); | 308 return Memory::Address_at(pc_); |
| 309 } | 309 } |
| 310 | 310 |
| 311 | 311 |
| 312 Address* RelocInfo::target_reference_address() { | |
| 313 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | |
| 314 return reinterpret_cast<Address*>(pc_); | |
| 315 } | |
| 316 | |
| 317 | |
| 318 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { | 312 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { |
| 319 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 313 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 320 ASSERT(!target->IsConsString()); | 314 ASSERT(!target->IsConsString()); |
| 321 Memory::Object_at(pc_) = target; | 315 Memory::Object_at(pc_) = target; |
| 322 CPU::FlushICache(pc_, sizeof(Address)); | 316 CPU::FlushICache(pc_, sizeof(Address)); |
| 323 if (mode == UPDATE_WRITE_BARRIER && | 317 if (mode == UPDATE_WRITE_BARRIER && |
| 324 host() != NULL && | 318 host() != NULL && |
| 325 target->IsHeapObject()) { | 319 target->IsHeapObject()) { |
| 326 host()->GetHeap()->incremental_marking()->RecordWrite( | 320 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 327 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 321 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (mode == UPDATE_WRITE_BARRIER && | 357 if (mode == UPDATE_WRITE_BARRIER && |
| 364 host() != NULL) { | 358 host() != NULL) { |
| 365 // TODO(1550) We are passing NULL as a slot because cell can never be on | 359 // TODO(1550) We are passing NULL as a slot because cell can never be on |
| 366 // evacuation candidate. | 360 // evacuation candidate. |
| 367 host()->GetHeap()->incremental_marking()->RecordWrite( | 361 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 368 host(), NULL, cell); | 362 host(), NULL, cell); |
| 369 } | 363 } |
| 370 } | 364 } |
| 371 | 365 |
| 372 | 366 |
| 367 void RelocInfo::WipeOut() { |
| 368 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { |
| 369 Memory::Address_at(pc_) = NULL; |
| 370 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
| 371 // Effectively write zero into the relocation. |
| 372 Assembler::set_target_address_at(pc_, pc_ + sizeof(int32_t)); |
| 373 } else { |
| 374 UNREACHABLE(); |
| 375 } |
| 376 } |
| 377 |
| 378 |
| 373 bool RelocInfo::IsPatchedReturnSequence() { | 379 bool RelocInfo::IsPatchedReturnSequence() { |
| 374 // The recognized call sequence is: | 380 // The recognized call sequence is: |
| 375 // movq(kScratchRegister, address); call(kScratchRegister); | 381 // movq(kScratchRegister, address); call(kScratchRegister); |
| 376 // It only needs to be distinguished from a return sequence | 382 // It only needs to be distinguished from a return sequence |
| 377 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 | 383 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 |
| 378 // The 11th byte is int3 (0xCC) in the return sequence and | 384 // The 11th byte is int3 (0xCC) in the return sequence and |
| 379 // REX.WB (0x48+register bit) for the call sequence. | 385 // REX.WB (0x48+register bit) for the call sequence. |
| 380 #ifdef ENABLE_DEBUGGER_SUPPORT | 386 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 381 return pc_[Assembler::kMoveAddressIntoScratchRegisterInstructionLength] != | 387 return pc_[Assembler::kMoveAddressIntoScratchRegisterInstructionLength] != |
| 382 0xCC; | 388 0xCC; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 ASSERT(len_ == 1 || len_ == 2); | 551 ASSERT(len_ == 1 || len_ == 2); |
| 546 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 552 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 547 *p = disp; | 553 *p = disp; |
| 548 len_ += sizeof(int32_t); | 554 len_ += sizeof(int32_t); |
| 549 } | 555 } |
| 550 | 556 |
| 551 | 557 |
| 552 } } // namespace v8::internal | 558 } } // namespace v8::internal |
| 553 | 559 |
| 554 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 560 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |