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