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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return Memory::Address_at(pc_); | 160 return Memory::Address_at(pc_); |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 Address RelocInfo::target_internal_reference() { | 164 Address RelocInfo::target_internal_reference() { |
165 DCHECK(rmode_ == INTERNAL_REFERENCE); | 165 DCHECK(rmode_ == INTERNAL_REFERENCE); |
166 return Memory::Address_at(pc_); | 166 return Memory::Address_at(pc_); |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 void RelocInfo::set_target_internal_reference(Address target) { | 170 Address RelocInfo::target_internal_reference_address() { |
171 DCHECK(rmode_ == INTERNAL_REFERENCE); | 171 DCHECK(rmode_ == INTERNAL_REFERENCE); |
172 Memory::Address_at(pc_) = target; | 172 return reinterpret_cast<Address>(pc_); |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 176 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
177 DCHECK(IsRuntimeEntry(rmode_)); | 177 DCHECK(IsRuntimeEntry(rmode_)); |
178 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_)); | 178 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_)); |
179 } | 179 } |
180 | 180 |
181 | 181 |
182 void RelocInfo::set_target_runtime_entry(Address target, | 182 void RelocInfo::set_target_runtime_entry(Address target, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 | 275 |
276 Object** RelocInfo::call_object_address() { | 276 Object** RelocInfo::call_object_address() { |
277 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 277 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
278 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 278 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
279 return reinterpret_cast<Object**>(pc_ + 1); | 279 return reinterpret_cast<Object**>(pc_ + 1); |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 void RelocInfo::WipeOut() { | 283 void RelocInfo::WipeOut() { |
284 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { | 284 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) || |
| 285 IsInternalReference(rmode_)) { |
285 Memory::Address_at(pc_) = NULL; | 286 Memory::Address_at(pc_) = NULL; |
286 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { | 287 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
287 // Effectively write zero into the relocation. | 288 // Effectively write zero into the relocation. |
288 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); | 289 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); |
289 } else { | 290 } else { |
290 UNREACHABLE(); | 291 UNREACHABLE(); |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 | 295 |
(...skipping 11 matching lines...) Expand all Loading... |
306 RelocInfo::Mode mode = rmode(); | 307 RelocInfo::Mode mode = rmode(); |
307 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 308 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
308 visitor->VisitEmbeddedPointer(this); | 309 visitor->VisitEmbeddedPointer(this); |
309 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 310 CpuFeatures::FlushICache(pc_, sizeof(Address)); |
310 } else if (RelocInfo::IsCodeTarget(mode)) { | 311 } else if (RelocInfo::IsCodeTarget(mode)) { |
311 visitor->VisitCodeTarget(this); | 312 visitor->VisitCodeTarget(this); |
312 } else if (mode == RelocInfo::CELL) { | 313 } else if (mode == RelocInfo::CELL) { |
313 visitor->VisitCell(this); | 314 visitor->VisitCell(this); |
314 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 315 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
315 visitor->VisitExternalReference(this); | 316 visitor->VisitExternalReference(this); |
316 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 317 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 318 visitor->VisitInternalReference(this); |
317 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 319 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
318 visitor->VisitCodeAgeSequence(this); | 320 visitor->VisitCodeAgeSequence(this); |
319 } else if (((RelocInfo::IsJSReturn(mode) && | 321 } else if (((RelocInfo::IsJSReturn(mode) && |
320 IsPatchedReturnSequence()) || | 322 IsPatchedReturnSequence()) || |
321 (RelocInfo::IsDebugBreakSlot(mode) && | 323 (RelocInfo::IsDebugBreakSlot(mode) && |
322 IsPatchedDebugBreakSlotSequence())) && | 324 IsPatchedDebugBreakSlotSequence())) && |
323 isolate->debug()->has_break_points()) { | 325 isolate->debug()->has_break_points()) { |
324 visitor->VisitDebugTarget(this); | 326 visitor->VisitDebugTarget(this); |
325 } else if (IsRuntimeEntry(mode)) { | 327 } else if (IsRuntimeEntry(mode)) { |
326 visitor->VisitRuntimeEntry(this); | 328 visitor->VisitRuntimeEntry(this); |
327 } | 329 } |
328 } | 330 } |
329 | 331 |
330 | 332 |
331 template<typename StaticVisitor> | 333 template<typename StaticVisitor> |
332 void RelocInfo::Visit(Heap* heap) { | 334 void RelocInfo::Visit(Heap* heap) { |
333 RelocInfo::Mode mode = rmode(); | 335 RelocInfo::Mode mode = rmode(); |
334 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 336 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
335 StaticVisitor::VisitEmbeddedPointer(heap, this); | 337 StaticVisitor::VisitEmbeddedPointer(heap, this); |
336 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 338 CpuFeatures::FlushICache(pc_, sizeof(Address)); |
337 } else if (RelocInfo::IsCodeTarget(mode)) { | 339 } else if (RelocInfo::IsCodeTarget(mode)) { |
338 StaticVisitor::VisitCodeTarget(heap, this); | 340 StaticVisitor::VisitCodeTarget(heap, this); |
339 } else if (mode == RelocInfo::CELL) { | 341 } else if (mode == RelocInfo::CELL) { |
340 StaticVisitor::VisitCell(heap, this); | 342 StaticVisitor::VisitCell(heap, this); |
341 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 343 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
342 StaticVisitor::VisitExternalReference(this); | 344 StaticVisitor::VisitExternalReference(this); |
343 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 345 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 346 StaticVisitor::VisitInternalReference(this); |
344 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 347 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
345 StaticVisitor::VisitCodeAgeSequence(heap, this); | 348 StaticVisitor::VisitCodeAgeSequence(heap, this); |
346 } else if (heap->isolate()->debug()->has_break_points() && | 349 } else if (heap->isolate()->debug()->has_break_points() && |
347 ((RelocInfo::IsJSReturn(mode) && | 350 ((RelocInfo::IsJSReturn(mode) && |
348 IsPatchedReturnSequence()) || | 351 IsPatchedReturnSequence()) || |
349 (RelocInfo::IsDebugBreakSlot(mode) && | 352 (RelocInfo::IsDebugBreakSlot(mode) && |
350 IsPatchedDebugBreakSlotSequence()))) { | 353 IsPatchedDebugBreakSlotSequence()))) { |
351 StaticVisitor::VisitDebugTarget(heap, this); | 354 StaticVisitor::VisitDebugTarget(heap, this); |
352 } else if (IsRuntimeEntry(mode)) { | 355 } else if (IsRuntimeEntry(mode)) { |
353 StaticVisitor::VisitRuntimeEntry(this); | 356 StaticVisitor::VisitRuntimeEntry(this); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 if (L->is_near_linked()) { | 525 if (L->is_near_linked()) { |
523 int offset = L->near_link_pos() - pc_offset(); | 526 int offset = L->near_link_pos() - pc_offset(); |
524 DCHECK(is_int8(offset)); | 527 DCHECK(is_int8(offset)); |
525 disp = static_cast<byte>(offset & 0xFF); | 528 disp = static_cast<byte>(offset & 0xFF); |
526 } | 529 } |
527 L->link_to(pc_offset(), Label::kNear); | 530 L->link_to(pc_offset(), Label::kNear); |
528 *pc_++ = disp; | 531 *pc_++ = disp; |
529 } | 532 } |
530 | 533 |
531 | 534 |
| 535 void Assembler::deserialization_set_target_internal_reference_at( |
| 536 Address pc, Address target, RelocInfo::Mode mode) { |
| 537 Memory::Address_at(pc) = target; |
| 538 } |
| 539 |
| 540 |
532 void Operand::set_modrm(int mod, Register rm) { | 541 void Operand::set_modrm(int mod, Register rm) { |
533 DCHECK((mod & -4) == 0); | 542 DCHECK((mod & -4) == 0); |
534 buf_[0] = mod << 6 | rm.code(); | 543 buf_[0] = mod << 6 | rm.code(); |
535 len_ = 1; | 544 len_ = 1; |
536 } | 545 } |
537 | 546 |
538 | 547 |
539 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { | 548 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { |
540 DCHECK(len_ == 1); | 549 DCHECK(len_ == 1); |
541 DCHECK((scale & -4) == 0); | 550 DCHECK((scale & -4) == 0); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 583 |
575 | 584 |
576 Operand::Operand(Immediate imm) { | 585 Operand::Operand(Immediate imm) { |
577 // [disp/r] | 586 // [disp/r] |
578 set_modrm(0, ebp); | 587 set_modrm(0, ebp); |
579 set_dispr(imm.x_, imm.rmode_); | 588 set_dispr(imm.x_, imm.rmode_); |
580 } | 589 } |
581 } } // namespace v8::internal | 590 } } // namespace v8::internal |
582 | 591 |
583 #endif // V8_X87_ASSEMBLER_X87_INL_H_ | 592 #endif // V8_X87_ASSEMBLER_X87_INL_H_ |
OLD | NEW |