OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 bool RelocInfo::IsPatchedReturnSequence() { | 389 bool RelocInfo::IsPatchedReturnSequence() { |
390 // The recognized call sequence is: | 390 // The recognized call sequence is: |
391 // movq(kScratchRegister, address); call(kScratchRegister); | 391 // movq(kScratchRegister, address); call(kScratchRegister); |
392 // It only needs to be distinguished from a return sequence | 392 // It only needs to be distinguished from a return sequence |
393 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 | 393 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 |
394 // The 11th byte is int3 (0xCC) in the return sequence and | 394 // The 11th byte is int3 (0xCC) in the return sequence and |
395 // REX.WB (0x48+register bit) for the call sequence. | 395 // REX.WB (0x48+register bit) for the call sequence. |
396 #ifdef ENABLE_DEBUGGER_SUPPORT | |
397 return pc_[Assembler::kMoveAddressIntoScratchRegisterInstructionLength] != | 396 return pc_[Assembler::kMoveAddressIntoScratchRegisterInstructionLength] != |
398 0xCC; | 397 0xCC; |
399 #else | |
400 return false; | |
401 #endif | |
402 } | 398 } |
403 | 399 |
404 | 400 |
405 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 401 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { |
406 return !Assembler::IsNop(pc()); | 402 return !Assembler::IsNop(pc()); |
407 } | 403 } |
408 | 404 |
409 | 405 |
410 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { | 406 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { |
411 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 407 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 CPU::FlushICache(pc_, sizeof(Address)); | 473 CPU::FlushICache(pc_, sizeof(Address)); |
478 } else if (RelocInfo::IsCodeTarget(mode)) { | 474 } else if (RelocInfo::IsCodeTarget(mode)) { |
479 visitor->VisitCodeTarget(this); | 475 visitor->VisitCodeTarget(this); |
480 } else if (mode == RelocInfo::CELL) { | 476 } else if (mode == RelocInfo::CELL) { |
481 visitor->VisitCell(this); | 477 visitor->VisitCell(this); |
482 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 478 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
483 visitor->VisitExternalReference(this); | 479 visitor->VisitExternalReference(this); |
484 CPU::FlushICache(pc_, sizeof(Address)); | 480 CPU::FlushICache(pc_, sizeof(Address)); |
485 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 481 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
486 visitor->VisitCodeAgeSequence(this); | 482 visitor->VisitCodeAgeSequence(this); |
487 #ifdef ENABLE_DEBUGGER_SUPPORT | |
488 } else if (((RelocInfo::IsJSReturn(mode) && | 483 } else if (((RelocInfo::IsJSReturn(mode) && |
489 IsPatchedReturnSequence()) || | 484 IsPatchedReturnSequence()) || |
490 (RelocInfo::IsDebugBreakSlot(mode) && | 485 (RelocInfo::IsDebugBreakSlot(mode) && |
491 IsPatchedDebugBreakSlotSequence())) && | 486 IsPatchedDebugBreakSlotSequence())) && |
492 isolate->debug()->has_break_points()) { | 487 isolate->debug()->has_break_points()) { |
493 visitor->VisitDebugTarget(this); | 488 visitor->VisitDebugTarget(this); |
494 #endif | |
495 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 489 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
496 visitor->VisitRuntimeEntry(this); | 490 visitor->VisitRuntimeEntry(this); |
497 } | 491 } |
498 } | 492 } |
499 | 493 |
500 | 494 |
501 template<typename StaticVisitor> | 495 template<typename StaticVisitor> |
502 void RelocInfo::Visit(Heap* heap) { | 496 void RelocInfo::Visit(Heap* heap) { |
503 RelocInfo::Mode mode = rmode(); | 497 RelocInfo::Mode mode = rmode(); |
504 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 498 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
505 StaticVisitor::VisitEmbeddedPointer(heap, this); | 499 StaticVisitor::VisitEmbeddedPointer(heap, this); |
506 CPU::FlushICache(pc_, sizeof(Address)); | 500 CPU::FlushICache(pc_, sizeof(Address)); |
507 } else if (RelocInfo::IsCodeTarget(mode)) { | 501 } else if (RelocInfo::IsCodeTarget(mode)) { |
508 StaticVisitor::VisitCodeTarget(heap, this); | 502 StaticVisitor::VisitCodeTarget(heap, this); |
509 } else if (mode == RelocInfo::CELL) { | 503 } else if (mode == RelocInfo::CELL) { |
510 StaticVisitor::VisitCell(heap, this); | 504 StaticVisitor::VisitCell(heap, this); |
511 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 505 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
512 StaticVisitor::VisitExternalReference(this); | 506 StaticVisitor::VisitExternalReference(this); |
513 CPU::FlushICache(pc_, sizeof(Address)); | 507 CPU::FlushICache(pc_, sizeof(Address)); |
514 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 508 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
515 StaticVisitor::VisitCodeAgeSequence(heap, this); | 509 StaticVisitor::VisitCodeAgeSequence(heap, this); |
516 #ifdef ENABLE_DEBUGGER_SUPPORT | |
517 } else if (heap->isolate()->debug()->has_break_points() && | 510 } else if (heap->isolate()->debug()->has_break_points() && |
518 ((RelocInfo::IsJSReturn(mode) && | 511 ((RelocInfo::IsJSReturn(mode) && |
519 IsPatchedReturnSequence()) || | 512 IsPatchedReturnSequence()) || |
520 (RelocInfo::IsDebugBreakSlot(mode) && | 513 (RelocInfo::IsDebugBreakSlot(mode) && |
521 IsPatchedDebugBreakSlotSequence()))) { | 514 IsPatchedDebugBreakSlotSequence()))) { |
522 StaticVisitor::VisitDebugTarget(heap, this); | 515 StaticVisitor::VisitDebugTarget(heap, this); |
523 #endif | |
524 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 516 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
525 StaticVisitor::VisitRuntimeEntry(this); | 517 StaticVisitor::VisitRuntimeEntry(this); |
526 } | 518 } |
527 } | 519 } |
528 | 520 |
529 | 521 |
530 // ----------------------------------------------------------------------------- | 522 // ----------------------------------------------------------------------------- |
531 // Implementation of Operand | 523 // Implementation of Operand |
532 | 524 |
533 void Operand::set_modrm(int mod, Register rm_reg) { | 525 void Operand::set_modrm(int mod, Register rm_reg) { |
(...skipping 27 matching lines...) Expand all Loading... |
561 ASSERT(len_ == 1 || len_ == 2); | 553 ASSERT(len_ == 1 || len_ == 2); |
562 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 554 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
563 *p = disp; | 555 *p = disp; |
564 len_ += sizeof(int32_t); | 556 len_ += sizeof(int32_t); |
565 } | 557 } |
566 | 558 |
567 | 559 |
568 } } // namespace v8::internal | 560 } } // namespace v8::internal |
569 | 561 |
570 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 562 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |