| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // The first byte of a relocation record has a tag in its low 2 bits: | 273 // The first byte of a relocation record has a tag in its low 2 bits: |
| 274 // Here are the record schemes, depending on the low tag and optional higher | 274 // Here are the record schemes, depending on the low tag and optional higher |
| 275 // tags. | 275 // tags. |
| 276 // | 276 // |
| 277 // Low tag: | 277 // Low tag: |
| 278 // 00: embedded_object: [6-bit pc delta] 00 | 278 // 00: embedded_object: [6-bit pc delta] 00 |
| 279 // | 279 // |
| 280 // 01: code_target: [6-bit pc delta] 01 | 280 // 01: code_target: [6-bit pc delta] 01 |
| 281 // | 281 // |
| 282 // 10: short_data_record: [6-bit pc delta] 10 followed by | 282 // 10: short_data_record: [6-bit pc delta] 10 followed by |
| 283 // [6-bit data delta] [2-bit data type tag] | 283 // [8-bit data delta] |
| 284 // | 284 // |
| 285 // 11: long_record [6 bit reloc mode] 11 | 285 // 11: long_record [6 bit reloc mode] 11 |
| 286 // followed by pc delta | 286 // followed by pc delta |
| 287 // followed by optional data depending on type. | 287 // followed by optional data depending on type. |
| 288 // | 288 // |
| 289 // 1-bit data type tags, used in short_data_record and data_jump long_record: | |
| 290 // code_target_with_id: 0 | |
| 291 // deopt_reason: 1 | |
| 292 // | |
| 293 // If a pc delta exceeds 6 bits, it is split into a remainder that fits into | 289 // If a pc delta exceeds 6 bits, it is split into a remainder that fits into |
| 294 // 6 bits and a part that does not. The latter is encoded as a long record | 290 // 6 bits and a part that does not. The latter is encoded as a long record |
| 295 // with PC_JUMP as pseudo reloc info mode. The former is encoded as part of | 291 // with PC_JUMP as pseudo reloc info mode. The former is encoded as part of |
| 296 // the following record in the usual way. The long pc jump record has variable | 292 // the following record in the usual way. The long pc jump record has variable |
| 297 // length: | 293 // length: |
| 298 // pc-jump: [PC_JUMP] 11 | 294 // pc-jump: [PC_JUMP] 11 |
| 299 // [7 bits data] 0 | 295 // [7 bits data] 0 |
| 300 // ... | 296 // ... |
| 301 // [7 bits data] 1 | 297 // [7 bits data] 1 |
| 302 // (Bits 6..31 of pc delta, with leading zeroes | 298 // (Bits 6..31 of pc delta, with leading zeroes |
| 303 // dropped, and last non-zero chunk tagged with 1.) | 299 // dropped, and last non-zero chunk tagged with 1.) |
| 304 | 300 |
| 305 const int kTagBits = 2; | 301 const int kTagBits = 2; |
| 306 const int kTagMask = (1 << kTagBits) - 1; | 302 const int kTagMask = (1 << kTagBits) - 1; |
| 307 const int kLongTagBits = 6; | 303 const int kLongTagBits = 6; |
| 308 const int kShortDataTypeTagBits = 1; | |
| 309 const int kShortDataBits = kBitsPerByte - kShortDataTypeTagBits; | |
| 310 | 304 |
| 311 const int kEmbeddedObjectTag = 0; | 305 const int kEmbeddedObjectTag = 0; |
| 312 const int kCodeTargetTag = 1; | 306 const int kCodeTargetTag = 1; |
| 313 const int kLocatableTag = 2; | 307 const int kLocatableTag = 2; |
| 314 const int kDefaultTag = 3; | 308 const int kDefaultTag = 3; |
| 315 | 309 |
| 316 const int kSmallPCDeltaBits = kBitsPerByte - kTagBits; | 310 const int kSmallPCDeltaBits = kBitsPerByte - kTagBits; |
| 317 const int kSmallPCDeltaMask = (1 << kSmallPCDeltaBits) - 1; | 311 const int kSmallPCDeltaMask = (1 << kSmallPCDeltaBits) - 1; |
| 318 const int RelocInfo::kMaxSmallPCDelta = kSmallPCDeltaMask; | 312 const int RelocInfo::kMaxSmallPCDelta = kSmallPCDeltaMask; |
| 319 | 313 |
| 320 const int kChunkBits = 7; | 314 const int kChunkBits = 7; |
| 321 const int kChunkMask = (1 << kChunkBits) - 1; | 315 const int kChunkMask = (1 << kChunkBits) - 1; |
| 322 const int kLastChunkTagBits = 1; | 316 const int kLastChunkTagBits = 1; |
| 323 const int kLastChunkTagMask = 1; | 317 const int kLastChunkTagMask = 1; |
| 324 const int kLastChunkTag = 1; | 318 const int kLastChunkTag = 1; |
| 325 | 319 |
| 326 const int kCodeWithIdTag = 0; | |
| 327 const int kDeoptReasonTag = 1; | |
| 328 | |
| 329 void RelocInfo::update_wasm_memory_reference( | 320 void RelocInfo::update_wasm_memory_reference( |
| 330 Isolate* isolate, Address old_base, Address new_base, | 321 Isolate* isolate, Address old_base, Address new_base, |
| 331 ICacheFlushMode icache_flush_mode) { | 322 ICacheFlushMode icache_flush_mode) { |
| 332 DCHECK(IsWasmMemoryReference(rmode_)); | 323 DCHECK(IsWasmMemoryReference(rmode_)); |
| 333 Address updated_reference = new_base + (wasm_memory_reference() - old_base); | 324 Address updated_reference = new_base + (wasm_memory_reference() - old_base); |
| 334 // The reference is not checked here but at runtime. Validity of references | 325 // The reference is not checked here but at runtime. Validity of references |
| 335 // may change over time. | 326 // may change over time. |
| 336 unchecked_update_wasm_memory_reference(isolate, updated_reference, | 327 unchecked_update_wasm_memory_reference(isolate, updated_reference, |
| 337 icache_flush_mode); | 328 icache_flush_mode); |
| 338 } | 329 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 return pc_delta & kSmallPCDeltaMask; | 395 return pc_delta & kSmallPCDeltaMask; |
| 405 } | 396 } |
| 406 | 397 |
| 407 | 398 |
| 408 void RelocInfoWriter::WriteShortTaggedPC(uint32_t pc_delta, int tag) { | 399 void RelocInfoWriter::WriteShortTaggedPC(uint32_t pc_delta, int tag) { |
| 409 // Write a byte of tagged pc-delta, possibly preceded by an explicit pc-jump. | 400 // Write a byte of tagged pc-delta, possibly preceded by an explicit pc-jump. |
| 410 pc_delta = WriteLongPCJump(pc_delta); | 401 pc_delta = WriteLongPCJump(pc_delta); |
| 411 *--pos_ = pc_delta << kTagBits | tag; | 402 *--pos_ = pc_delta << kTagBits | tag; |
| 412 } | 403 } |
| 413 | 404 |
| 414 | 405 void RelocInfoWriter::WriteShortData(intptr_t data_delta) { |
| 415 void RelocInfoWriter::WriteShortTaggedData(intptr_t data_delta, int tag) { | 406 *--pos_ = static_cast<byte>(data_delta); |
| 416 *--pos_ = static_cast<byte>(data_delta << kShortDataTypeTagBits | tag); | |
| 417 } | 407 } |
| 418 | 408 |
| 419 | 409 |
| 420 void RelocInfoWriter::WriteMode(RelocInfo::Mode rmode) { | 410 void RelocInfoWriter::WriteMode(RelocInfo::Mode rmode) { |
| 421 STATIC_ASSERT(RelocInfo::NUMBER_OF_MODES <= (1 << kLongTagBits)); | 411 STATIC_ASSERT(RelocInfo::NUMBER_OF_MODES <= (1 << kLongTagBits)); |
| 422 *--pos_ = static_cast<int>((rmode << kTagBits) | kDefaultTag); | 412 *--pos_ = static_cast<int>((rmode << kTagBits) | kDefaultTag); |
| 423 } | 413 } |
| 424 | 414 |
| 425 | 415 |
| 426 void RelocInfoWriter::WriteModeAndPC(uint32_t pc_delta, RelocInfo::Mode rmode) { | 416 void RelocInfoWriter::WriteModeAndPC(uint32_t pc_delta, RelocInfo::Mode rmode) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 DCHECK(rinfo->pc() - last_pc_ >= 0); | 448 DCHECK(rinfo->pc() - last_pc_ >= 0); |
| 459 // Use unsigned delta-encoding for pc. | 449 // Use unsigned delta-encoding for pc. |
| 460 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); | 450 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
| 461 | 451 |
| 462 // The two most common modes are given small tags, and usually fit in a byte. | 452 // The two most common modes are given small tags, and usually fit in a byte. |
| 463 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 453 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
| 464 WriteShortTaggedPC(pc_delta, kEmbeddedObjectTag); | 454 WriteShortTaggedPC(pc_delta, kEmbeddedObjectTag); |
| 465 } else if (rmode == RelocInfo::CODE_TARGET) { | 455 } else if (rmode == RelocInfo::CODE_TARGET) { |
| 466 WriteShortTaggedPC(pc_delta, kCodeTargetTag); | 456 WriteShortTaggedPC(pc_delta, kCodeTargetTag); |
| 467 DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize); | 457 DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize); |
| 468 } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | |
| 469 // Use signed delta-encoding for id. | |
| 470 DCHECK_EQ(static_cast<int>(rinfo->data()), rinfo->data()); | |
| 471 int id_delta = static_cast<int>(rinfo->data()) - last_id_; | |
| 472 // Check if delta is small enough to fit in a tagged byte. | |
| 473 if (is_intn(id_delta, kShortDataBits)) { | |
| 474 WriteShortTaggedPC(pc_delta, kLocatableTag); | |
| 475 WriteShortTaggedData(id_delta, kCodeWithIdTag); | |
| 476 } else { | |
| 477 // Otherwise, use costly encoding. | |
| 478 WriteModeAndPC(pc_delta, rmode); | |
| 479 WriteIntData(id_delta); | |
| 480 } | |
| 481 last_id_ = static_cast<int>(rinfo->data()); | |
| 482 } else if (rmode == RelocInfo::DEOPT_REASON) { | 458 } else if (rmode == RelocInfo::DEOPT_REASON) { |
| 483 DCHECK(rinfo->data() < (1 << kShortDataBits)); | 459 DCHECK(rinfo->data() < (1 << kBitsPerByte)); |
| 484 WriteShortTaggedPC(pc_delta, kLocatableTag); | 460 WriteShortTaggedPC(pc_delta, kLocatableTag); |
| 485 WriteShortTaggedData(rinfo->data(), kDeoptReasonTag); | 461 WriteShortData(rinfo->data()); |
| 486 } else { | 462 } else { |
| 487 WriteModeAndPC(pc_delta, rmode); | 463 WriteModeAndPC(pc_delta, rmode); |
| 488 if (RelocInfo::IsComment(rmode)) { | 464 if (RelocInfo::IsComment(rmode)) { |
| 489 WriteData(rinfo->data()); | 465 WriteData(rinfo->data()); |
| 490 } else if (RelocInfo::IsConstPool(rmode) || | 466 } else if (RelocInfo::IsConstPool(rmode) || |
| 491 RelocInfo::IsVeneerPool(rmode) || RelocInfo::IsDeoptId(rmode) || | 467 RelocInfo::IsVeneerPool(rmode) || RelocInfo::IsDeoptId(rmode) || |
| 492 RelocInfo::IsDeoptPosition(rmode) || | 468 RelocInfo::IsDeoptPosition(rmode) || |
| 493 RelocInfo::IsWasmProtectedLanding(rmode)) { | 469 RelocInfo::IsWasmProtectedLanding(rmode)) { |
| 494 WriteIntData(static_cast<int>(rinfo->data())); | 470 WriteIntData(static_cast<int>(rinfo->data())); |
| 495 } | 471 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 516 inline void RelocIterator::ReadShortTaggedPC() { | 492 inline void RelocIterator::ReadShortTaggedPC() { |
| 517 rinfo_.pc_ += *pos_ >> kTagBits; | 493 rinfo_.pc_ += *pos_ >> kTagBits; |
| 518 } | 494 } |
| 519 | 495 |
| 520 | 496 |
| 521 inline void RelocIterator::AdvanceReadPC() { | 497 inline void RelocIterator::AdvanceReadPC() { |
| 522 rinfo_.pc_ += *--pos_; | 498 rinfo_.pc_ += *--pos_; |
| 523 } | 499 } |
| 524 | 500 |
| 525 | 501 |
| 526 void RelocIterator::AdvanceReadId() { | |
| 527 int x = 0; | |
| 528 for (int i = 0; i < kIntSize; i++) { | |
| 529 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; | |
| 530 } | |
| 531 last_id_ += x; | |
| 532 rinfo_.data_ = last_id_; | |
| 533 } | |
| 534 | |
| 535 | |
| 536 void RelocIterator::AdvanceReadInt() { | 502 void RelocIterator::AdvanceReadInt() { |
| 537 int x = 0; | 503 int x = 0; |
| 538 for (int i = 0; i < kIntSize; i++) { | 504 for (int i = 0; i < kIntSize; i++) { |
| 539 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; | 505 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; |
| 540 } | 506 } |
| 541 rinfo_.data_ = x; | 507 rinfo_.data_ = x; |
| 542 } | 508 } |
| 543 | 509 |
| 544 | 510 |
| 545 void RelocIterator::AdvanceReadData() { | 511 void RelocIterator::AdvanceReadData() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 559 for (int i = 0; i < kIntSize; i++) { | 525 for (int i = 0; i < kIntSize; i++) { |
| 560 byte pc_jump_part = *--pos_; | 526 byte pc_jump_part = *--pos_; |
| 561 pc_jump |= (pc_jump_part >> kLastChunkTagBits) << i * kChunkBits; | 527 pc_jump |= (pc_jump_part >> kLastChunkTagBits) << i * kChunkBits; |
| 562 if ((pc_jump_part & kLastChunkTagMask) == 1) break; | 528 if ((pc_jump_part & kLastChunkTagMask) == 1) break; |
| 563 } | 529 } |
| 564 // The least significant kSmallPCDeltaBits bits will be added | 530 // The least significant kSmallPCDeltaBits bits will be added |
| 565 // later. | 531 // later. |
| 566 rinfo_.pc_ += pc_jump << kSmallPCDeltaBits; | 532 rinfo_.pc_ += pc_jump << kSmallPCDeltaBits; |
| 567 } | 533 } |
| 568 | 534 |
| 569 | 535 inline void RelocIterator::ReadShortData() { |
| 570 inline int RelocIterator::GetShortDataTypeTag() { | 536 uint8_t unsigned_b = *pos_; |
| 571 return *pos_ & ((1 << kShortDataTypeTagBits) - 1); | 537 rinfo_.data_ = unsigned_b; |
| 572 } | 538 } |
| 573 | 539 |
| 574 | 540 |
| 575 inline void RelocIterator::ReadShortTaggedId() { | |
| 576 int8_t signed_b = *pos_; | |
| 577 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | |
| 578 last_id_ += signed_b >> kShortDataTypeTagBits; | |
| 579 rinfo_.data_ = last_id_; | |
| 580 } | |
| 581 | |
| 582 | |
| 583 inline void RelocIterator::ReadShortTaggedData() { | |
| 584 uint8_t unsigned_b = *pos_; | |
| 585 rinfo_.data_ = unsigned_b >> kShortDataTypeTagBits; | |
| 586 } | |
| 587 | |
| 588 | |
| 589 void RelocIterator::next() { | 541 void RelocIterator::next() { |
| 590 DCHECK(!done()); | 542 DCHECK(!done()); |
| 591 // Basically, do the opposite of RelocInfoWriter::Write. | 543 // Basically, do the opposite of RelocInfoWriter::Write. |
| 592 // Reading of data is as far as possible avoided for unwanted modes, | 544 // Reading of data is as far as possible avoided for unwanted modes, |
| 593 // but we must always update the pc. | 545 // but we must always update the pc. |
| 594 // | 546 // |
| 595 // We exit this loop by returning when we find a mode we want. | 547 // We exit this loop by returning when we find a mode we want. |
| 596 while (pos_ > end_) { | 548 while (pos_ > end_) { |
| 597 int tag = AdvanceGetTag(); | 549 int tag = AdvanceGetTag(); |
| 598 if (tag == kEmbeddedObjectTag) { | 550 if (tag == kEmbeddedObjectTag) { |
| 599 ReadShortTaggedPC(); | 551 ReadShortTaggedPC(); |
| 600 if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return; | 552 if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return; |
| 601 } else if (tag == kCodeTargetTag) { | 553 } else if (tag == kCodeTargetTag) { |
| 602 ReadShortTaggedPC(); | 554 ReadShortTaggedPC(); |
| 603 if (SetMode(RelocInfo::CODE_TARGET)) return; | 555 if (SetMode(RelocInfo::CODE_TARGET)) return; |
| 604 } else if (tag == kLocatableTag) { | 556 } else if (tag == kLocatableTag) { |
| 605 ReadShortTaggedPC(); | 557 ReadShortTaggedPC(); |
| 606 Advance(); | 558 Advance(); |
| 607 int data_type_tag = GetShortDataTypeTag(); | 559 if (SetMode(RelocInfo::DEOPT_REASON)) { |
| 608 if (data_type_tag == kCodeWithIdTag) { | 560 ReadShortData(); |
| 609 if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) { | 561 return; |
| 610 ReadShortTaggedId(); | |
| 611 return; | |
| 612 } | |
| 613 } else { | |
| 614 DCHECK(data_type_tag == kDeoptReasonTag); | |
| 615 if (SetMode(RelocInfo::DEOPT_REASON)) { | |
| 616 ReadShortTaggedData(); | |
| 617 return; | |
| 618 } | |
| 619 } | 562 } |
| 620 } else { | 563 } else { |
| 621 DCHECK(tag == kDefaultTag); | 564 DCHECK(tag == kDefaultTag); |
| 622 RelocInfo::Mode rmode = GetMode(); | 565 RelocInfo::Mode rmode = GetMode(); |
| 623 if (rmode == RelocInfo::PC_JUMP) { | 566 if (rmode == RelocInfo::PC_JUMP) { |
| 624 AdvanceReadLongPCJump(); | 567 AdvanceReadLongPCJump(); |
| 625 } else { | 568 } else { |
| 626 AdvanceReadPC(); | 569 AdvanceReadPC(); |
| 627 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 570 if (RelocInfo::IsComment(rmode)) { |
| 628 if (SetMode(rmode)) { | |
| 629 AdvanceReadId(); | |
| 630 return; | |
| 631 } | |
| 632 Advance(kIntSize); | |
| 633 } else if (RelocInfo::IsComment(rmode)) { | |
| 634 if (SetMode(rmode)) { | 571 if (SetMode(rmode)) { |
| 635 AdvanceReadData(); | 572 AdvanceReadData(); |
| 636 return; | 573 return; |
| 637 } | 574 } |
| 638 Advance(kIntptrSize); | 575 Advance(kIntptrSize); |
| 639 } else if (RelocInfo::IsConstPool(rmode) || | 576 } else if (RelocInfo::IsConstPool(rmode) || |
| 640 RelocInfo::IsVeneerPool(rmode) || | 577 RelocInfo::IsVeneerPool(rmode) || |
| 641 RelocInfo::IsDeoptId(rmode) || | 578 RelocInfo::IsDeoptId(rmode) || |
| 642 RelocInfo::IsDeoptPosition(rmode) || | 579 RelocInfo::IsDeoptPosition(rmode) || |
| 643 RelocInfo::IsWasmProtectedLanding(rmode)) { | 580 RelocInfo::IsWasmProtectedLanding(rmode)) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 666 | 603 |
| 667 RelocIterator::RelocIterator(Code* code, int mode_mask) { | 604 RelocIterator::RelocIterator(Code* code, int mode_mask) { |
| 668 rinfo_.host_ = code; | 605 rinfo_.host_ = code; |
| 669 rinfo_.pc_ = code->instruction_start(); | 606 rinfo_.pc_ = code->instruction_start(); |
| 670 rinfo_.data_ = 0; | 607 rinfo_.data_ = 0; |
| 671 // Relocation info is read backwards. | 608 // Relocation info is read backwards. |
| 672 pos_ = code->relocation_start() + code->relocation_size(); | 609 pos_ = code->relocation_start() + code->relocation_size(); |
| 673 end_ = code->relocation_start(); | 610 end_ = code->relocation_start(); |
| 674 done_ = false; | 611 done_ = false; |
| 675 mode_mask_ = mode_mask; | 612 mode_mask_ = mode_mask; |
| 676 last_id_ = 0; | |
| 677 byte* sequence = code->FindCodeAgeSequence(); | 613 byte* sequence = code->FindCodeAgeSequence(); |
| 678 // We get the isolate from the map, because at serialization time | 614 // We get the isolate from the map, because at serialization time |
| 679 // the code pointer has been cloned and isn't really in heap space. | 615 // the code pointer has been cloned and isn't really in heap space. |
| 680 Isolate* isolate = code->map()->GetIsolate(); | 616 Isolate* isolate = code->map()->GetIsolate(); |
| 681 if (sequence != NULL && !Code::IsYoungSequence(isolate, sequence)) { | 617 if (sequence != NULL && !Code::IsYoungSequence(isolate, sequence)) { |
| 682 code_age_sequence_ = sequence; | 618 code_age_sequence_ = sequence; |
| 683 } else { | 619 } else { |
| 684 code_age_sequence_ = NULL; | 620 code_age_sequence_ = NULL; |
| 685 } | 621 } |
| 686 if (mode_mask_ == 0) pos_ = end_; | 622 if (mode_mask_ == 0) pos_ = end_; |
| 687 next(); | 623 next(); |
| 688 } | 624 } |
| 689 | 625 |
| 690 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { | 626 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { |
| 691 rinfo_.pc_ = desc.buffer; | 627 rinfo_.pc_ = desc.buffer; |
| 692 rinfo_.data_ = 0; | 628 rinfo_.data_ = 0; |
| 693 // Relocation info is read backwards. | 629 // Relocation info is read backwards. |
| 694 pos_ = desc.buffer + desc.buffer_size; | 630 pos_ = desc.buffer + desc.buffer_size; |
| 695 end_ = pos_ - desc.reloc_size; | 631 end_ = pos_ - desc.reloc_size; |
| 696 done_ = false; | 632 done_ = false; |
| 697 mode_mask_ = mode_mask; | 633 mode_mask_ = mode_mask; |
| 698 last_id_ = 0; | |
| 699 code_age_sequence_ = NULL; | 634 code_age_sequence_ = NULL; |
| 700 if (mode_mask_ == 0) pos_ = end_; | 635 if (mode_mask_ == 0) pos_ = end_; |
| 701 next(); | 636 next(); |
| 702 } | 637 } |
| 703 | 638 |
| 704 | 639 |
| 705 // ----------------------------------------------------------------------------- | 640 // ----------------------------------------------------------------------------- |
| 706 // Implementation of RelocInfo | 641 // Implementation of RelocInfo |
| 707 | 642 |
| 708 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 643 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 728 const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { | 663 const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { |
| 729 switch (rmode) { | 664 switch (rmode) { |
| 730 case NONE32: | 665 case NONE32: |
| 731 return "no reloc 32"; | 666 return "no reloc 32"; |
| 732 case NONE64: | 667 case NONE64: |
| 733 return "no reloc 64"; | 668 return "no reloc 64"; |
| 734 case EMBEDDED_OBJECT: | 669 case EMBEDDED_OBJECT: |
| 735 return "embedded object"; | 670 return "embedded object"; |
| 736 case CODE_TARGET: | 671 case CODE_TARGET: |
| 737 return "code target"; | 672 return "code target"; |
| 738 case CODE_TARGET_WITH_ID: | |
| 739 return "code target with id"; | |
| 740 case CELL: | 673 case CELL: |
| 741 return "property cell"; | 674 return "property cell"; |
| 742 case RUNTIME_ENTRY: | 675 case RUNTIME_ENTRY: |
| 743 return "runtime entry"; | 676 return "runtime entry"; |
| 744 case COMMENT: | 677 case COMMENT: |
| 745 return "comment"; | 678 return "comment"; |
| 746 case EXTERNAL_REFERENCE: | 679 case EXTERNAL_REFERENCE: |
| 747 return "external reference"; | 680 return "external reference"; |
| 748 case INTERNAL_REFERENCE: | 681 case INTERNAL_REFERENCE: |
| 749 return "internal reference"; | 682 return "internal reference"; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 } else if (rmode_ == EXTERNAL_REFERENCE) { | 736 } else if (rmode_ == EXTERNAL_REFERENCE) { |
| 804 ExternalReferenceEncoder ref_encoder(isolate); | 737 ExternalReferenceEncoder ref_encoder(isolate); |
| 805 os << " (" | 738 os << " (" |
| 806 << ref_encoder.NameOfAddress(isolate, target_external_reference()) | 739 << ref_encoder.NameOfAddress(isolate, target_external_reference()) |
| 807 << ") (" << static_cast<const void*>(target_external_reference()) | 740 << ") (" << static_cast<const void*>(target_external_reference()) |
| 808 << ")"; | 741 << ")"; |
| 809 } else if (IsCodeTarget(rmode_)) { | 742 } else if (IsCodeTarget(rmode_)) { |
| 810 Code* code = Code::GetCodeFromTargetAddress(target_address()); | 743 Code* code = Code::GetCodeFromTargetAddress(target_address()); |
| 811 os << " (" << Code::Kind2String(code->kind()) << ") (" | 744 os << " (" << Code::Kind2String(code->kind()) << ") (" |
| 812 << static_cast<const void*>(target_address()) << ")"; | 745 << static_cast<const void*>(target_address()) << ")"; |
| 813 if (rmode_ == CODE_TARGET_WITH_ID) { | |
| 814 os << " (id=" << static_cast<int>(data_) << ")"; | |
| 815 } | |
| 816 } else if (IsRuntimeEntry(rmode_) && | 746 } else if (IsRuntimeEntry(rmode_) && |
| 817 isolate->deoptimizer_data() != NULL) { | 747 isolate->deoptimizer_data() != NULL) { |
| 818 // Depotimization bailouts are stored as runtime entries. | 748 // Depotimization bailouts are stored as runtime entries. |
| 819 int id = Deoptimizer::GetDeoptimizationId( | 749 int id = Deoptimizer::GetDeoptimizationId( |
| 820 isolate, target_address(), Deoptimizer::EAGER); | 750 isolate, target_address(), Deoptimizer::EAGER); |
| 821 if (id != Deoptimizer::kNotDeoptimizationEntry) { | 751 if (id != Deoptimizer::kNotDeoptimizationEntry) { |
| 822 os << " (deoptimization bailout " << id << ")"; | 752 os << " (deoptimization bailout " << id << ")"; |
| 823 } | 753 } |
| 824 } else if (IsConstPool(rmode_)) { | 754 } else if (IsConstPool(rmode_)) { |
| 825 os << " (size " << static_cast<int>(data_) << ")"; | 755 os << " (size " << static_cast<int>(data_) << ")"; |
| 826 } | 756 } |
| 827 | 757 |
| 828 os << "\n"; | 758 os << "\n"; |
| 829 } | 759 } |
| 830 #endif // ENABLE_DISASSEMBLER | 760 #endif // ENABLE_DISASSEMBLER |
| 831 | 761 |
| 832 | 762 |
| 833 #ifdef VERIFY_HEAP | 763 #ifdef VERIFY_HEAP |
| 834 void RelocInfo::Verify(Isolate* isolate) { | 764 void RelocInfo::Verify(Isolate* isolate) { |
| 835 switch (rmode_) { | 765 switch (rmode_) { |
| 836 case EMBEDDED_OBJECT: | 766 case EMBEDDED_OBJECT: |
| 837 Object::VerifyPointer(target_object()); | 767 Object::VerifyPointer(target_object()); |
| 838 break; | 768 break; |
| 839 case CELL: | 769 case CELL: |
| 840 Object::VerifyPointer(target_cell()); | 770 Object::VerifyPointer(target_cell()); |
| 841 break; | 771 break; |
| 842 case CODE_TARGET_WITH_ID: | |
| 843 case CODE_TARGET: { | 772 case CODE_TARGET: { |
| 844 // convert inline target address to code object | 773 // convert inline target address to code object |
| 845 Address addr = target_address(); | 774 Address addr = target_address(); |
| 846 CHECK(addr != NULL); | 775 CHECK(addr != NULL); |
| 847 // Check that we can find the right code object. | 776 // Check that we can find the right code object. |
| 848 Code* code = Code::GetCodeFromTargetAddress(addr); | 777 Code* code = Code::GetCodeFromTargetAddress(addr); |
| 849 Object* found = isolate->FindCodeObject(addr); | 778 Object* found = isolate->FindCodeObject(addr); |
| 850 CHECK(found->IsCode()); | 779 CHECK(found->IsCode()); |
| 851 CHECK(code->address() == HeapObject::cast(found)->address()); | 780 CHECK(code->address() == HeapObject::cast(found)->address()); |
| 852 break; | 781 break; |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 | 1945 |
| 2017 void Assembler::DataAlign(int m) { | 1946 void Assembler::DataAlign(int m) { |
| 2018 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); | 1947 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); |
| 2019 while ((pc_offset() & (m - 1)) != 0) { | 1948 while ((pc_offset() & (m - 1)) != 0) { |
| 2020 db(0); | 1949 db(0); |
| 2021 } | 1950 } |
| 2022 } | 1951 } |
| 2023 | 1952 |
| 2024 } // namespace internal | 1953 } // namespace internal |
| 2025 } // namespace v8 | 1954 } // namespace v8 |
| OLD | NEW |