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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // | 279 // |
280 // Long record format: | 280 // Long record format: |
281 // 4-bit middle_tag: | 281 // 4-bit middle_tag: |
282 // 0000 - 1100 : Short record for RelocInfo::Mode middle_tag + 2 | 282 // 0000 - 1100 : Short record for RelocInfo::Mode middle_tag + 2 |
283 // (The middle_tag encodes rmode - RelocInfo::LAST_COMPACT_ENUM, | 283 // (The middle_tag encodes rmode - RelocInfo::LAST_COMPACT_ENUM, |
284 // and is between 0000 and 1100) | 284 // and is between 0000 and 1100) |
285 // The format is: | 285 // The format is: |
286 // 00 [4 bit middle_tag] 11 followed by | 286 // 00 [4 bit middle_tag] 11 followed by |
287 // 00 [6 bit pc delta] | 287 // 00 [6 bit pc delta] |
288 // | 288 // |
289 // 1101: constant pool. Used on ARM only for now. | 289 // 1101: constant or veneer pool. Used only on ARM and A64 for now. |
290 // The format is: 11 1101 11 | 290 // The format is: [2-bit sub-type] 1101 11 |
291 // signed int (size of the constant pool). | 291 // signed int (size of the pool). |
| 292 // The 2-bit sub-types are: |
| 293 // 00: constant pool |
| 294 // 01: veneer pool |
292 // 1110: long_data_record | 295 // 1110: long_data_record |
293 // The format is: [2-bit data_type_tag] 1110 11 | 296 // The format is: [2-bit data_type_tag] 1110 11 |
294 // signed intptr_t, lowest byte written first | 297 // signed intptr_t, lowest byte written first |
295 // (except data_type code_target_with_id, which | 298 // (except data_type code_target_with_id, which |
296 // is followed by a signed int, not intptr_t.) | 299 // is followed by a signed int, not intptr_t.) |
297 // | 300 // |
298 // 1111: long_pc_jump | 301 // 1111: long_pc_jump |
299 // The format is: | 302 // The format is: |
300 // pc-jump: 00 1111 11, | 303 // pc-jump: 00 1111 11, |
301 // 00 [6 bits pc delta] | 304 // 00 [6 bits pc delta] |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 const int kLastChunkTag = 1; | 341 const int kLastChunkTag = 1; |
339 | 342 |
340 | 343 |
341 const int kDataJumpExtraTag = kPCJumpExtraTag - 1; | 344 const int kDataJumpExtraTag = kPCJumpExtraTag - 1; |
342 | 345 |
343 const int kCodeWithIdTag = 0; | 346 const int kCodeWithIdTag = 0; |
344 const int kNonstatementPositionTag = 1; | 347 const int kNonstatementPositionTag = 1; |
345 const int kStatementPositionTag = 2; | 348 const int kStatementPositionTag = 2; |
346 const int kCommentTag = 3; | 349 const int kCommentTag = 3; |
347 | 350 |
348 const int kConstPoolExtraTag = kPCJumpExtraTag - 2; | 351 const int kPoolExtraTag = kPCJumpExtraTag - 2; |
349 const int kConstPoolTag = 3; | 352 const int kConstPoolTag = 0; |
| 353 const int kVeneerPoolTag = 1; |
350 | 354 |
351 | 355 |
352 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { | 356 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { |
353 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. | 357 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. |
354 // Otherwise write a variable length PC jump for the bits that do | 358 // Otherwise write a variable length PC jump for the bits that do |
355 // not fit in the kSmallPCDeltaBits bits. | 359 // not fit in the kSmallPCDeltaBits bits. |
356 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; | 360 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; |
357 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); | 361 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); |
358 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; | 362 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; |
359 ASSERT(pc_jump > 0); | 363 ASSERT(pc_jump > 0); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) { | 403 void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) { |
400 WriteExtraTag(kDataJumpExtraTag, top_tag); | 404 WriteExtraTag(kDataJumpExtraTag, top_tag); |
401 for (int i = 0; i < kIntSize; i++) { | 405 for (int i = 0; i < kIntSize; i++) { |
402 *--pos_ = static_cast<byte>(data_delta); | 406 *--pos_ = static_cast<byte>(data_delta); |
403 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 407 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
404 data_delta = data_delta >> kBitsPerByte; | 408 data_delta = data_delta >> kBitsPerByte; |
405 } | 409 } |
406 } | 410 } |
407 | 411 |
408 | 412 |
409 void RelocInfoWriter::WriteExtraTaggedConstPoolData(int data) { | 413 void RelocInfoWriter::WriteExtraTaggedPoolData(int data, int pool_type) { |
410 WriteExtraTag(kConstPoolExtraTag, kConstPoolTag); | 414 WriteExtraTag(kPoolExtraTag, pool_type); |
411 for (int i = 0; i < kIntSize; i++) { | 415 for (int i = 0; i < kIntSize; i++) { |
412 *--pos_ = static_cast<byte>(data); | 416 *--pos_ = static_cast<byte>(data); |
413 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 417 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
414 data = data >> kBitsPerByte; | 418 data = data >> kBitsPerByte; |
415 } | 419 } |
416 } | 420 } |
417 | 421 |
418 | 422 |
419 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { | 423 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { |
420 WriteExtraTag(kDataJumpExtraTag, top_tag); | 424 WriteExtraTag(kDataJumpExtraTag, top_tag); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 // Otherwise, use costly encoding. | 476 // Otherwise, use costly encoding. |
473 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 477 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
474 WriteExtraTaggedIntData(pos_delta, pos_type_tag); | 478 WriteExtraTaggedIntData(pos_delta, pos_type_tag); |
475 } | 479 } |
476 last_position_ = static_cast<int>(rinfo->data()); | 480 last_position_ = static_cast<int>(rinfo->data()); |
477 } else if (RelocInfo::IsComment(rmode)) { | 481 } else if (RelocInfo::IsComment(rmode)) { |
478 // Comments are normally not generated, so we use the costly encoding. | 482 // Comments are normally not generated, so we use the costly encoding. |
479 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 483 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
480 WriteExtraTaggedData(rinfo->data(), kCommentTag); | 484 WriteExtraTaggedData(rinfo->data(), kCommentTag); |
481 ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); | 485 ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); |
482 } else if (RelocInfo::IsConstPool(rmode)) { | 486 } else if (RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)) { |
483 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 487 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
484 WriteExtraTaggedConstPoolData(static_cast<int>(rinfo->data())); | 488 WriteExtraTaggedPoolData(static_cast<int>(rinfo->data()), |
| 489 RelocInfo::IsConstPool(rmode) ? kConstPoolTag |
| 490 : kVeneerPoolTag); |
485 } else { | 491 } else { |
486 ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM); | 492 ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM); |
487 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; | 493 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; |
488 // For all other modes we simply use the mode as the extra tag. | 494 // For all other modes we simply use the mode as the extra tag. |
489 // None of these modes need a data component. | 495 // None of these modes need a data component. |
490 ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); | 496 ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); |
491 WriteExtraTaggedPC(pc_delta, saved_mode); | 497 WriteExtraTaggedPC(pc_delta, saved_mode); |
492 } | 498 } |
493 last_pc_ = rinfo->pc(); | 499 last_pc_ = rinfo->pc(); |
494 #ifdef DEBUG | 500 #ifdef DEBUG |
(...skipping 30 matching lines...) Expand all Loading... |
525 void RelocIterator::AdvanceReadId() { | 531 void RelocIterator::AdvanceReadId() { |
526 int x = 0; | 532 int x = 0; |
527 for (int i = 0; i < kIntSize; i++) { | 533 for (int i = 0; i < kIntSize; i++) { |
528 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; | 534 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; |
529 } | 535 } |
530 last_id_ += x; | 536 last_id_ += x; |
531 rinfo_.data_ = last_id_; | 537 rinfo_.data_ = last_id_; |
532 } | 538 } |
533 | 539 |
534 | 540 |
535 void RelocIterator::AdvanceReadConstPoolData() { | 541 void RelocIterator::AdvanceReadPoolData() { |
536 int x = 0; | 542 int x = 0; |
537 for (int i = 0; i < kIntSize; i++) { | 543 for (int i = 0; i < kIntSize; i++) { |
538 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; | 544 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; |
539 } | 545 } |
540 rinfo_.data_ = x; | 546 rinfo_.data_ = x; |
541 } | 547 } |
542 | 548 |
543 | 549 |
544 void RelocIterator::AdvanceReadPosition() { | 550 void RelocIterator::AdvanceReadPosition() { |
545 int x = 0; | 551 int x = 0; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 Advance(kIntSize); | 673 Advance(kIntSize); |
668 } | 674 } |
669 } else { | 675 } else { |
670 ASSERT(locatable_tag == kCommentTag); | 676 ASSERT(locatable_tag == kCommentTag); |
671 if (SetMode(RelocInfo::COMMENT)) { | 677 if (SetMode(RelocInfo::COMMENT)) { |
672 AdvanceReadData(); | 678 AdvanceReadData(); |
673 return; | 679 return; |
674 } | 680 } |
675 Advance(kIntptrSize); | 681 Advance(kIntptrSize); |
676 } | 682 } |
677 } else if ((extra_tag == kConstPoolExtraTag) && | 683 } else if (extra_tag == kPoolExtraTag) { |
678 (GetTopTag() == kConstPoolTag)) { | 684 int pool_type = GetTopTag(); |
679 if (SetMode(RelocInfo::CONST_POOL)) { | 685 ASSERT(pool_type == kConstPoolTag || pool_type == kVeneerPoolTag); |
680 AdvanceReadConstPoolData(); | 686 RelocInfo::Mode rmode = (pool_type == kConstPoolTag) ? |
| 687 RelocInfo::CONST_POOL : RelocInfo::VENEER_POOL; |
| 688 if (SetMode(rmode)) { |
| 689 AdvanceReadPoolData(); |
681 return; | 690 return; |
682 } | 691 } |
683 Advance(kIntSize); | 692 Advance(kIntSize); |
684 } else { | 693 } else { |
685 AdvanceReadPC(); | 694 AdvanceReadPC(); |
686 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; | 695 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; |
687 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return; | 696 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return; |
688 } | 697 } |
689 } | 698 } |
690 } | 699 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 case RelocInfo::POSITION: | 798 case RelocInfo::POSITION: |
790 return "position"; | 799 return "position"; |
791 case RelocInfo::STATEMENT_POSITION: | 800 case RelocInfo::STATEMENT_POSITION: |
792 return "statement position"; | 801 return "statement position"; |
793 case RelocInfo::EXTERNAL_REFERENCE: | 802 case RelocInfo::EXTERNAL_REFERENCE: |
794 return "external reference"; | 803 return "external reference"; |
795 case RelocInfo::INTERNAL_REFERENCE: | 804 case RelocInfo::INTERNAL_REFERENCE: |
796 return "internal reference"; | 805 return "internal reference"; |
797 case RelocInfo::CONST_POOL: | 806 case RelocInfo::CONST_POOL: |
798 return "constant pool"; | 807 return "constant pool"; |
| 808 case RelocInfo::VENEER_POOL: |
| 809 return "veneer pool"; |
799 case RelocInfo::DEBUG_BREAK_SLOT: | 810 case RelocInfo::DEBUG_BREAK_SLOT: |
800 #ifndef ENABLE_DEBUGGER_SUPPORT | 811 #ifndef ENABLE_DEBUGGER_SUPPORT |
801 UNREACHABLE(); | 812 UNREACHABLE(); |
802 #endif | 813 #endif |
803 return "debug break slot"; | 814 return "debug break slot"; |
804 case RelocInfo::CODE_AGE_SEQUENCE: | 815 case RelocInfo::CODE_AGE_SEQUENCE: |
805 return "code_age_sequence"; | 816 return "code_age_sequence"; |
806 case RelocInfo::NUMBER_OF_MODES: | 817 case RelocInfo::NUMBER_OF_MODES: |
807 UNREACHABLE(); | 818 UNREACHABLE(); |
808 return "number_of_modes"; | 819 return "number_of_modes"; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 break; | 887 break; |
877 } | 888 } |
878 case RUNTIME_ENTRY: | 889 case RUNTIME_ENTRY: |
879 case JS_RETURN: | 890 case JS_RETURN: |
880 case COMMENT: | 891 case COMMENT: |
881 case POSITION: | 892 case POSITION: |
882 case STATEMENT_POSITION: | 893 case STATEMENT_POSITION: |
883 case EXTERNAL_REFERENCE: | 894 case EXTERNAL_REFERENCE: |
884 case INTERNAL_REFERENCE: | 895 case INTERNAL_REFERENCE: |
885 case CONST_POOL: | 896 case CONST_POOL: |
| 897 case VENEER_POOL: |
886 case DEBUG_BREAK_SLOT: | 898 case DEBUG_BREAK_SLOT: |
887 case NONE32: | 899 case NONE32: |
888 case NONE64: | 900 case NONE64: |
889 break; | 901 break; |
890 case NUMBER_OF_MODES: | 902 case NUMBER_OF_MODES: |
891 UNREACHABLE(); | 903 UNREACHABLE(); |
892 break; | 904 break; |
893 case CODE_AGE_SEQUENCE: | 905 case CODE_AGE_SEQUENCE: |
894 ASSERT(Code::IsYoungSequence(pc_) || code_age_stub()->IsCode()); | 906 ASSERT(Code::IsYoungSequence(pc_) || code_age_stub()->IsCode()); |
895 break; | 907 break; |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1599 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
1588 state_.written_position = state_.current_position; | 1600 state_.written_position = state_.current_position; |
1589 written = true; | 1601 written = true; |
1590 } | 1602 } |
1591 | 1603 |
1592 // Return whether something was written. | 1604 // Return whether something was written. |
1593 return written; | 1605 return written; |
1594 } | 1606 } |
1595 | 1607 |
1596 } } // namespace v8::internal | 1608 } } // namespace v8::internal |
OLD | NEW |