| 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 | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Jump table entry | 71 // Jump table entry |
| 72 return Memory::Address_at(pc_); | 72 return Memory::Address_at(pc_); |
| 73 } else { | 73 } else { |
| 74 // mov sequence | 74 // mov sequence |
| 75 DCHECK(IsInternalReferenceEncoded(rmode_)); | 75 DCHECK(IsInternalReferenceEncoded(rmode_)); |
| 76 return Assembler::target_address_at(pc_, host_); | 76 return Assembler::target_address_at(pc_, host_); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 void RelocInfo::set_target_internal_reference(Address target) { | 81 Address RelocInfo::target_internal_reference_address() { |
| 82 if (IsInternalReference(rmode_)) { | 82 DCHECK(IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); |
| 83 // Jump table entry | 83 return reinterpret_cast<Address>(pc_); |
| 84 Memory::Address_at(pc_) = target; | |
| 85 } else { | |
| 86 // mov sequence | |
| 87 DCHECK(IsInternalReferenceEncoded(rmode_)); | |
| 88 Assembler::set_target_address_at(pc_, host_, target, SKIP_ICACHE_FLUSH); | |
| 89 } | |
| 90 } | 84 } |
| 91 | 85 |
| 92 | 86 |
| 93 Address RelocInfo::target_address() { | 87 Address RelocInfo::target_address() { |
| 94 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 88 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
| 95 return Assembler::target_address_at(pc_, host_); | 89 return Assembler::target_address_at(pc_, host_); |
| 96 } | 90 } |
| 97 | 91 |
| 98 | 92 |
| 99 Address RelocInfo::target_address_address() { | 93 Address RelocInfo::target_address_address() { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 295 |
| 302 Object** RelocInfo::call_object_address() { | 296 Object** RelocInfo::call_object_address() { |
| 303 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 297 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 304 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 298 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 305 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize); | 299 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize); |
| 306 } | 300 } |
| 307 | 301 |
| 308 | 302 |
| 309 void RelocInfo::WipeOut() { | 303 void RelocInfo::WipeOut() { |
| 310 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || | 304 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || |
| 311 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_)); | 305 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || |
| 312 Assembler::set_target_address_at(pc_, host_, NULL); | 306 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); |
| 307 if (IsInternalReference(rmode_)) { |
| 308 // Jump table entry |
| 309 Memory::Address_at(pc_) = NULL; |
| 310 } else if (IsInternalReferenceEncoded(rmode_)) { |
| 311 // mov sequence |
| 312 // Currently used only by deserializer, no need to flush. |
| 313 Assembler::set_target_address_at(pc_, host_, NULL, SKIP_ICACHE_FLUSH); |
| 314 } else { |
| 315 Assembler::set_target_address_at(pc_, host_, NULL); |
| 316 } |
| 313 } | 317 } |
| 314 | 318 |
| 315 | 319 |
| 316 bool RelocInfo::IsPatchedReturnSequence() { | 320 bool RelocInfo::IsPatchedReturnSequence() { |
| 317 // | 321 // |
| 318 // The patched return sequence is defined by | 322 // The patched return sequence is defined by |
| 319 // BreakLocation::SetDebugBreakAtReturn() | 323 // BreakLocation::SetDebugBreakAtReturn() |
| 320 // FIXED_SEQUENCE | 324 // FIXED_SEQUENCE |
| 321 | 325 |
| 322 Instr instr0 = Assembler::instr_at(pc_); | 326 Instr instr0 = Assembler::instr_at(pc_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 349 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { | 353 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { |
| 350 RelocInfo::Mode mode = rmode(); | 354 RelocInfo::Mode mode = rmode(); |
| 351 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 355 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 352 visitor->VisitEmbeddedPointer(this); | 356 visitor->VisitEmbeddedPointer(this); |
| 353 } else if (RelocInfo::IsCodeTarget(mode)) { | 357 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 354 visitor->VisitCodeTarget(this); | 358 visitor->VisitCodeTarget(this); |
| 355 } else if (mode == RelocInfo::CELL) { | 359 } else if (mode == RelocInfo::CELL) { |
| 356 visitor->VisitCell(this); | 360 visitor->VisitCell(this); |
| 357 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 361 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 358 visitor->VisitExternalReference(this); | 362 visitor->VisitExternalReference(this); |
| 363 } else if (mode == RelocInfo::INTERNAL_REFERENCE || |
| 364 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { |
| 365 visitor->VisitInternalReference(this); |
| 359 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 366 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
| 360 visitor->VisitCodeAgeSequence(this); | 367 visitor->VisitCodeAgeSequence(this); |
| 361 } else if (((RelocInfo::IsJSReturn(mode) && IsPatchedReturnSequence()) || | 368 } else if (((RelocInfo::IsJSReturn(mode) && IsPatchedReturnSequence()) || |
| 362 (RelocInfo::IsDebugBreakSlot(mode) && | 369 (RelocInfo::IsDebugBreakSlot(mode) && |
| 363 IsPatchedDebugBreakSlotSequence())) && | 370 IsPatchedDebugBreakSlotSequence())) && |
| 364 isolate->debug()->has_break_points()) { | 371 isolate->debug()->has_break_points()) { |
| 365 visitor->VisitDebugTarget(this); | 372 visitor->VisitDebugTarget(this); |
| 366 } else if (IsRuntimeEntry(mode)) { | 373 } else if (IsRuntimeEntry(mode)) { |
| 367 visitor->VisitRuntimeEntry(this); | 374 visitor->VisitRuntimeEntry(this); |
| 368 } | 375 } |
| 369 } | 376 } |
| 370 | 377 |
| 371 | 378 |
| 372 template <typename StaticVisitor> | 379 template <typename StaticVisitor> |
| 373 void RelocInfo::Visit(Heap* heap) { | 380 void RelocInfo::Visit(Heap* heap) { |
| 374 RelocInfo::Mode mode = rmode(); | 381 RelocInfo::Mode mode = rmode(); |
| 375 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 382 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 376 StaticVisitor::VisitEmbeddedPointer(heap, this); | 383 StaticVisitor::VisitEmbeddedPointer(heap, this); |
| 377 } else if (RelocInfo::IsCodeTarget(mode)) { | 384 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 378 StaticVisitor::VisitCodeTarget(heap, this); | 385 StaticVisitor::VisitCodeTarget(heap, this); |
| 379 } else if (mode == RelocInfo::CELL) { | 386 } else if (mode == RelocInfo::CELL) { |
| 380 StaticVisitor::VisitCell(heap, this); | 387 StaticVisitor::VisitCell(heap, this); |
| 381 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 388 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 382 StaticVisitor::VisitExternalReference(this); | 389 StaticVisitor::VisitExternalReference(this); |
| 390 } else if (mode == RelocInfo::INTERNAL_REFERENCE || |
| 391 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { |
| 392 StaticVisitor::VisitInternalReference(this); |
| 383 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 393 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
| 384 StaticVisitor::VisitCodeAgeSequence(heap, this); | 394 StaticVisitor::VisitCodeAgeSequence(heap, this); |
| 385 } else if (heap->isolate()->debug()->has_break_points() && | 395 } else if (heap->isolate()->debug()->has_break_points() && |
| 386 ((RelocInfo::IsJSReturn(mode) && IsPatchedReturnSequence()) || | 396 ((RelocInfo::IsJSReturn(mode) && IsPatchedReturnSequence()) || |
| 387 (RelocInfo::IsDebugBreakSlot(mode) && | 397 (RelocInfo::IsDebugBreakSlot(mode) && |
| 388 IsPatchedDebugBreakSlotSequence()))) { | 398 IsPatchedDebugBreakSlotSequence()))) { |
| 389 StaticVisitor::VisitDebugTarget(heap, this); | 399 StaticVisitor::VisitDebugTarget(heap, this); |
| 390 } else if (IsRuntimeEntry(mode)) { | 400 } else if (IsRuntimeEntry(mode)) { |
| 391 StaticVisitor::VisitRuntimeEntry(this); | 401 StaticVisitor::VisitRuntimeEntry(this); |
| 392 } | 402 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 477 |
| 468 // This sets the branch destination (which gets loaded at the call address). | 478 // This sets the branch destination (which gets loaded at the call address). |
| 469 // This is for calls and branches within generated code. The serializer | 479 // This is for calls and branches within generated code. The serializer |
| 470 // has already deserialized the mov instructions etc. | 480 // has already deserialized the mov instructions etc. |
| 471 // There is a FIXED_SEQUENCE assumption here | 481 // There is a FIXED_SEQUENCE assumption here |
| 472 void Assembler::deserialization_set_special_target_at( | 482 void Assembler::deserialization_set_special_target_at( |
| 473 Address instruction_payload, Code* code, Address target) { | 483 Address instruction_payload, Code* code, Address target) { |
| 474 set_target_address_at(instruction_payload, code, target); | 484 set_target_address_at(instruction_payload, code, target); |
| 475 } | 485 } |
| 476 | 486 |
| 487 |
| 488 void Assembler::deserialization_set_target_internal_reference_at( |
| 489 Address pc, Address target) { |
| 490 if (IsLis(instr_at(pc)) && IsOri(instr_at(pc + kInstrSize))) { |
| 491 Code* code = NULL; |
| 492 set_target_address_at(pc, code, target, SKIP_ICACHE_FLUSH); |
| 493 } else { |
| 494 Memory::Address_at(pc) = target; |
| 495 } |
| 496 } |
| 497 |
| 498 |
| 477 // This code assumes the FIXED_SEQUENCE of lis/ori | 499 // This code assumes the FIXED_SEQUENCE of lis/ori |
| 478 void Assembler::set_target_address_at(Address pc, | 500 void Assembler::set_target_address_at(Address pc, |
| 479 ConstantPoolArray* constant_pool, | 501 ConstantPoolArray* constant_pool, |
| 480 Address target, | 502 Address target, |
| 481 ICacheFlushMode icache_flush_mode) { | 503 ICacheFlushMode icache_flush_mode) { |
| 482 Instr instr1 = instr_at(pc); | 504 Instr instr1 = instr_at(pc); |
| 483 Instr instr2 = instr_at(pc + kInstrSize); | 505 Instr instr2 = instr_at(pc + kInstrSize); |
| 484 // Interpret 2 instructions generated by lis/ori | 506 // Interpret 2 instructions generated by lis/ori |
| 485 if (IsLis(instr1) && IsOri(instr2)) { | 507 if (IsLis(instr1) && IsOri(instr2)) { |
| 486 #if V8_TARGET_ARCH_PPC64 | 508 #if V8_TARGET_ARCH_PPC64 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 } | 552 } |
| 531 #endif | 553 #endif |
| 532 return; | 554 return; |
| 533 } | 555 } |
| 534 UNREACHABLE(); | 556 UNREACHABLE(); |
| 535 } | 557 } |
| 536 } | 558 } |
| 537 } // namespace v8::internal | 559 } // namespace v8::internal |
| 538 | 560 |
| 539 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_ | 561 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_ |
| OLD | NEW |