| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ | 5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ |
| 6 #define V8_X64_ASSEMBLER_X64_INL_H_ | 6 #define V8_X64_ASSEMBLER_X64_INL_H_ |
| 7 | 7 |
| 8 #include "src/x64/assembler-x64.h" | 8 #include "src/x64/assembler-x64.h" |
| 9 | 9 |
| 10 #include "src/base/cpu.h" | 10 #include "src/base/cpu.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 XMMRegister ivreg = {vreg.code()}; | 265 XMMRegister ivreg = {vreg.code()}; |
| 266 emit_vex_prefix(ireg, ivreg, rm, l, pp, mm, w); | 266 emit_vex_prefix(ireg, ivreg, rm, l, pp, mm, w); |
| 267 } | 267 } |
| 268 | 268 |
| 269 | 269 |
| 270 Address Assembler::target_address_at(Address pc, Address constant_pool) { | 270 Address Assembler::target_address_at(Address pc, Address constant_pool) { |
| 271 return Memory::int32_at(pc) + pc + 4; | 271 return Memory::int32_at(pc) + pc + 4; |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 void Assembler::set_target_address_at(Address pc, Address constant_pool, | 275 void Assembler::set_target_address_at(Isolate* isolate, Address pc, |
| 276 Address target, | 276 Address constant_pool, Address target, |
| 277 ICacheFlushMode icache_flush_mode) { | 277 ICacheFlushMode icache_flush_mode) { |
| 278 Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4); | 278 Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4); |
| 279 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 279 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
| 280 Assembler::FlushICacheWithoutIsolate(pc, sizeof(int32_t)); | 280 Assembler::FlushICache(isolate, pc, sizeof(int32_t)); |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 | 284 |
| 285 void Assembler::deserialization_set_target_internal_reference_at( | 285 void Assembler::deserialization_set_target_internal_reference_at( |
| 286 Address pc, Address target, RelocInfo::Mode mode) { | 286 Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) { |
| 287 Memory::Address_at(pc) = target; | 287 Memory::Address_at(pc) = target; |
| 288 } | 288 } |
| 289 | 289 |
| 290 | 290 |
| 291 Address Assembler::target_address_from_return_address(Address pc) { | 291 Address Assembler::target_address_from_return_address(Address pc) { |
| 292 return pc - kCallTargetAddressOffset; | 292 return pc - kCallTargetAddressOffset; |
| 293 } | 293 } |
| 294 | 294 |
| 295 | 295 |
| 296 Handle<Object> Assembler::code_target_object_handle_at(Address pc) { | 296 Handle<Object> Assembler::code_target_object_handle_at(Address pc) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } else { | 347 } else { |
| 348 return kPointerSize; | 348 return kPointerSize; |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 | 351 |
| 352 | 352 |
| 353 void RelocInfo::set_target_address(Address target, | 353 void RelocInfo::set_target_address(Address target, |
| 354 WriteBarrierMode write_barrier_mode, | 354 WriteBarrierMode write_barrier_mode, |
| 355 ICacheFlushMode icache_flush_mode) { | 355 ICacheFlushMode icache_flush_mode) { |
| 356 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 356 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
| 357 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode); | 357 Assembler::set_target_address_at(isolate_, pc_, host_, target, |
| 358 icache_flush_mode); |
| 358 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && | 359 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && |
| 359 IsCodeTarget(rmode_)) { | 360 IsCodeTarget(rmode_)) { |
| 360 Object* target_code = Code::GetCodeFromTargetAddress(target); | 361 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 361 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 362 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 362 host(), this, HeapObject::cast(target_code)); | 363 host(), this, HeapObject::cast(target_code)); |
| 363 } | 364 } |
| 364 } | 365 } |
| 365 | 366 |
| 366 | 367 |
| 367 Object* RelocInfo::target_object() { | 368 Object* RelocInfo::target_object() { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 } | 463 } |
| 463 } | 464 } |
| 464 | 465 |
| 465 | 466 |
| 466 void RelocInfo::WipeOut() { | 467 void RelocInfo::WipeOut() { |
| 467 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) || | 468 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) || |
| 468 IsInternalReference(rmode_)) { | 469 IsInternalReference(rmode_)) { |
| 469 Memory::Address_at(pc_) = NULL; | 470 Memory::Address_at(pc_) = NULL; |
| 470 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { | 471 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
| 471 // Effectively write zero into the relocation. | 472 // Effectively write zero into the relocation. |
| 472 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); | 473 Assembler::set_target_address_at(isolate_, pc_, host_, |
| 474 pc_ + sizeof(int32_t)); |
| 473 } else { | 475 } else { |
| 474 UNREACHABLE(); | 476 UNREACHABLE(); |
| 475 } | 477 } |
| 476 } | 478 } |
| 477 | 479 |
| 478 | 480 |
| 479 bool RelocInfo::IsPatchedReturnSequence() { | 481 bool RelocInfo::IsPatchedReturnSequence() { |
| 480 // The recognized call sequence is: | 482 // The recognized call sequence is: |
| 481 // movq(kScratchRegister, address); call(kScratchRegister); | 483 // movq(kScratchRegister, address); call(kScratchRegister); |
| 482 // It only needs to be distinguished from a return sequence | 484 // It only needs to be distinguished from a return sequence |
| (...skipping 22 matching lines...) Expand all Loading... |
| 505 DCHECK(*pc_ == kCallOpcode); | 507 DCHECK(*pc_ == kCallOpcode); |
| 506 return Code::GetCodeFromTargetAddress( | 508 return Code::GetCodeFromTargetAddress( |
| 507 Assembler::target_address_at(pc_ + 1, host_)); | 509 Assembler::target_address_at(pc_ + 1, host_)); |
| 508 } | 510 } |
| 509 | 511 |
| 510 | 512 |
| 511 void RelocInfo::set_code_age_stub(Code* stub, | 513 void RelocInfo::set_code_age_stub(Code* stub, |
| 512 ICacheFlushMode icache_flush_mode) { | 514 ICacheFlushMode icache_flush_mode) { |
| 513 DCHECK(*pc_ == kCallOpcode); | 515 DCHECK(*pc_ == kCallOpcode); |
| 514 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 516 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
| 515 Assembler::set_target_address_at(pc_ + 1, host_, stub->instruction_start(), | 517 Assembler::set_target_address_at( |
| 516 icache_flush_mode); | 518 isolate_, pc_ + 1, host_, stub->instruction_start(), icache_flush_mode); |
| 517 } | 519 } |
| 518 | 520 |
| 519 | 521 |
| 520 Address RelocInfo::debug_call_address() { | 522 Address RelocInfo::debug_call_address() { |
| 521 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | 523 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
| 522 return Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset); | 524 return Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset); |
| 523 } | 525 } |
| 524 | 526 |
| 525 | 527 |
| 526 void RelocInfo::set_debug_call_address(Address target) { | 528 void RelocInfo::set_debug_call_address(Address target) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 void Operand::set_disp64(int64_t disp) { | 629 void Operand::set_disp64(int64_t disp) { |
| 628 DCHECK_EQ(1, len_); | 630 DCHECK_EQ(1, len_); |
| 629 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); | 631 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); |
| 630 *p = disp; | 632 *p = disp; |
| 631 len_ += sizeof(disp); | 633 len_ += sizeof(disp); |
| 632 } | 634 } |
| 633 } // namespace internal | 635 } // namespace internal |
| 634 } // namespace v8 | 636 } // namespace v8 |
| 635 | 637 |
| 636 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 638 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |