OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 | 98 |
99 int RelocInfo::target_address_size() { | 99 int RelocInfo::target_address_size() { |
100 return Assembler::kSpecialTargetSize; | 100 return Assembler::kSpecialTargetSize; |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 void RelocInfo::set_target_address(Address target, | 104 void RelocInfo::set_target_address(Address target, |
105 WriteBarrierMode write_barrier_mode, | 105 WriteBarrierMode write_barrier_mode, |
106 ICacheFlushMode icache_flush_mode) { | 106 ICacheFlushMode icache_flush_mode) { |
107 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode); | 107 Assembler::set_target_address_at(isolate_, pc_, host_, target, |
108 Assembler::set_target_address_at(pc_, host_, target); | 108 icache_flush_mode); |
| 109 Assembler::set_target_address_at(isolate_, pc_, host_, target); |
109 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 110 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
110 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && | 111 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && |
111 IsCodeTarget(rmode_)) { | 112 IsCodeTarget(rmode_)) { |
112 Object* target_code = Code::GetCodeFromTargetAddress(target); | 113 Object* target_code = Code::GetCodeFromTargetAddress(target); |
113 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 114 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
114 host(), this, HeapObject::cast(target_code)); | 115 host(), this, HeapObject::cast(target_code)); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 | 119 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 DCHECK(*pc_ == kCallOpcode); | 224 DCHECK(*pc_ == kCallOpcode); |
224 return Code::GetCodeFromTargetAddress( | 225 return Code::GetCodeFromTargetAddress( |
225 Assembler::target_address_at(pc_ + 1, host_)); | 226 Assembler::target_address_at(pc_ + 1, host_)); |
226 } | 227 } |
227 | 228 |
228 | 229 |
229 void RelocInfo::set_code_age_stub(Code* stub, | 230 void RelocInfo::set_code_age_stub(Code* stub, |
230 ICacheFlushMode icache_flush_mode) { | 231 ICacheFlushMode icache_flush_mode) { |
231 DCHECK(*pc_ == kCallOpcode); | 232 DCHECK(*pc_ == kCallOpcode); |
232 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 233 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
233 Assembler::set_target_address_at(pc_ + 1, host_, stub->instruction_start(), | 234 Assembler::set_target_address_at( |
234 icache_flush_mode); | 235 isolate_, pc_ + 1, host_, stub->instruction_start(), icache_flush_mode); |
235 } | 236 } |
236 | 237 |
237 | 238 |
238 Address RelocInfo::debug_call_address() { | 239 Address RelocInfo::debug_call_address() { |
239 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | 240 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
240 Address location = pc_ + Assembler::kPatchDebugBreakSlotAddressOffset; | 241 Address location = pc_ + Assembler::kPatchDebugBreakSlotAddressOffset; |
241 return Assembler::target_address_at(location, host_); | 242 return Assembler::target_address_at(location, host_); |
242 } | 243 } |
243 | 244 |
244 | 245 |
245 void RelocInfo::set_debug_call_address(Address target) { | 246 void RelocInfo::set_debug_call_address(Address target) { |
246 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | 247 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
247 Address location = pc_ + Assembler::kPatchDebugBreakSlotAddressOffset; | 248 Address location = pc_ + Assembler::kPatchDebugBreakSlotAddressOffset; |
248 Assembler::set_target_address_at(location, host_, target); | 249 Assembler::set_target_address_at(isolate_, location, host_, target); |
249 if (host() != NULL) { | 250 if (host() != NULL) { |
250 Object* target_code = Code::GetCodeFromTargetAddress(target); | 251 Object* target_code = Code::GetCodeFromTargetAddress(target); |
251 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 252 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
252 host(), this, HeapObject::cast(target_code)); | 253 host(), this, HeapObject::cast(target_code)); |
253 } | 254 } |
254 } | 255 } |
255 | 256 |
256 | 257 |
257 void RelocInfo::WipeOut() { | 258 void RelocInfo::WipeOut() { |
258 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) || | 259 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) || |
259 IsInternalReference(rmode_)) { | 260 IsInternalReference(rmode_)) { |
260 Memory::Address_at(pc_) = NULL; | 261 Memory::Address_at(pc_) = NULL; |
261 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { | 262 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
262 // Effectively write zero into the relocation. | 263 // Effectively write zero into the relocation. |
263 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); | 264 Assembler::set_target_address_at(isolate_, pc_, host_, |
| 265 pc_ + sizeof(int32_t)); |
264 } else { | 266 } else { |
265 UNREACHABLE(); | 267 UNREACHABLE(); |
266 } | 268 } |
267 } | 269 } |
268 | 270 |
269 | 271 |
270 bool RelocInfo::IsPatchedReturnSequence() { | 272 bool RelocInfo::IsPatchedReturnSequence() { |
271 return *pc_ == kCallOpcode; | 273 return *pc_ == kCallOpcode; |
272 } | 274 } |
273 | 275 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 reinterpret_cast<uint16_t*>(pc_)[0] = value; | 449 reinterpret_cast<uint16_t*>(pc_)[0] = value; |
448 pc_ += sizeof(uint16_t); | 450 pc_ += sizeof(uint16_t); |
449 } | 451 } |
450 | 452 |
451 | 453 |
452 Address Assembler::target_address_at(Address pc, Address constant_pool) { | 454 Address Assembler::target_address_at(Address pc, Address constant_pool) { |
453 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); | 455 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); |
454 } | 456 } |
455 | 457 |
456 | 458 |
457 void Assembler::set_target_address_at(Address pc, Address constant_pool, | 459 void Assembler::set_target_address_at(Isolate* isolate, Address pc, |
458 Address target, | 460 Address constant_pool, Address target, |
459 ICacheFlushMode icache_flush_mode) { | 461 ICacheFlushMode icache_flush_mode) { |
460 int32_t* p = reinterpret_cast<int32_t*>(pc); | 462 int32_t* p = reinterpret_cast<int32_t*>(pc); |
461 *p = target - (pc + sizeof(int32_t)); | 463 *p = target - (pc + sizeof(int32_t)); |
462 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 464 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
463 Assembler::FlushICacheWithoutIsolate(p, sizeof(int32_t)); | 465 Assembler::FlushICache(isolate, p, sizeof(int32_t)); |
464 } | 466 } |
465 } | 467 } |
466 | 468 |
467 | 469 |
468 Address Assembler::target_address_from_return_address(Address pc) { | 470 Address Assembler::target_address_from_return_address(Address pc) { |
469 return pc - kCallTargetAddressOffset; | 471 return pc - kCallTargetAddressOffset; |
470 } | 472 } |
471 | 473 |
472 | 474 |
473 Displacement Assembler::disp_at(Label* L) { | 475 Displacement Assembler::disp_at(Label* L) { |
(...skipping 19 matching lines...) Expand all Loading... |
493 int offset = L->near_link_pos() - pc_offset(); | 495 int offset = L->near_link_pos() - pc_offset(); |
494 DCHECK(is_int8(offset)); | 496 DCHECK(is_int8(offset)); |
495 disp = static_cast<byte>(offset & 0xFF); | 497 disp = static_cast<byte>(offset & 0xFF); |
496 } | 498 } |
497 L->link_to(pc_offset(), Label::kNear); | 499 L->link_to(pc_offset(), Label::kNear); |
498 *pc_++ = disp; | 500 *pc_++ = disp; |
499 } | 501 } |
500 | 502 |
501 | 503 |
502 void Assembler::deserialization_set_target_internal_reference_at( | 504 void Assembler::deserialization_set_target_internal_reference_at( |
503 Address pc, Address target, RelocInfo::Mode mode) { | 505 Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) { |
504 Memory::Address_at(pc) = target; | 506 Memory::Address_at(pc) = target; |
505 } | 507 } |
506 | 508 |
507 | 509 |
508 void Operand::set_modrm(int mod, Register rm) { | 510 void Operand::set_modrm(int mod, Register rm) { |
509 DCHECK((mod & -4) == 0); | 511 DCHECK((mod & -4) == 0); |
510 buf_[0] = mod << 6 | rm.code(); | 512 buf_[0] = mod << 6 | rm.code(); |
511 len_ = 1; | 513 len_ = 1; |
512 } | 514 } |
513 | 515 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 | 553 |
552 Operand::Operand(Immediate imm) { | 554 Operand::Operand(Immediate imm) { |
553 // [disp/r] | 555 // [disp/r] |
554 set_modrm(0, ebp); | 556 set_modrm(0, ebp); |
555 set_dispr(imm.x_, imm.rmode_); | 557 set_dispr(imm.x_, imm.rmode_); |
556 } | 558 } |
557 } // namespace internal | 559 } // namespace internal |
558 } // namespace v8 | 560 } // namespace v8 |
559 | 561 |
560 #endif // V8_X87_ASSEMBLER_X87_INL_H_ | 562 #endif // V8_X87_ASSEMBLER_X87_INL_H_ |
OLD | NEW |