| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // | 260 // |
| 261 // Long record format: | 261 // Long record format: |
| 262 // 4-bit middle_tag: | 262 // 4-bit middle_tag: |
| 263 // 0000 - 1100 : Short record for RelocInfo::Mode middle_tag + 2 | 263 // 0000 - 1100 : Short record for RelocInfo::Mode middle_tag + 2 |
| 264 // (The middle_tag encodes rmode - RelocInfo::LAST_COMPACT_ENUM, | 264 // (The middle_tag encodes rmode - RelocInfo::LAST_COMPACT_ENUM, |
| 265 // and is between 0000 and 1100) | 265 // and is between 0000 and 1100) |
| 266 // The format is: | 266 // The format is: |
| 267 // 00 [4 bit middle_tag] 11 followed by | 267 // 00 [4 bit middle_tag] 11 followed by |
| 268 // 00 [6 bit pc delta] | 268 // 00 [6 bit pc delta] |
| 269 // | 269 // |
| 270 // 1101: constant or veneer pool. Used only on ARM and ARM64 for now. | 270 // 1101: arch1 or arch2 (architecture dependent) |
| 271 // The format is: [2-bit sub-type] 1101 11 | 271 // The format is: [2-bit sub-type] 1101 11 |
| 272 // signed int (size of the pool). | 272 // signed int (data). |
| 273 // The 2-bit sub-types are: | 273 // The 2-bit sub-types are: |
| 274 // 00: constant pool | 274 // 00: arch1 |
| 275 // 01: veneer pool | 275 // 01: arch2 |
| 276 // 1110: long_data_record | 276 // 1110: long_data_record |
| 277 // The format is: [2-bit data_type_tag] 1110 11 | 277 // The format is: [2-bit data_type_tag] 1110 11 |
| 278 // signed intptr_t, lowest byte written first | 278 // signed intptr_t, lowest byte written first |
| 279 // (except data_type code_target_with_id, which | 279 // (except data_type code_target_with_id, which |
| 280 // is followed by a signed int, not intptr_t.) | 280 // is followed by a signed int, not intptr_t.) |
| 281 // | 281 // |
| 282 // 1111: long_pc_jump | 282 // 1111: long_pc_jump |
| 283 // The format is: | 283 // The format is: |
| 284 // pc-jump: 00 1111 11, | 284 // pc-jump: 00 1111 11, |
| 285 // 00 [6 bits pc delta] | 285 // 00 [6 bits pc delta] |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 const int kCodeWithIdTag = 0; | 327 const int kCodeWithIdTag = 0; |
| 328 const int kNonstatementPositionTag = 1; | 328 const int kNonstatementPositionTag = 1; |
| 329 const int kStatementPositionTag = 2; | 329 const int kStatementPositionTag = 2; |
| 330 const int kCommentTag = 3; | 330 const int kCommentTag = 3; |
| 331 | 331 |
| 332 // Reuse the same value for deopt reason tag in short record format. | 332 // Reuse the same value for deopt reason tag in short record format. |
| 333 // It is possible because we use kCommentTag only for the long record format. | 333 // It is possible because we use kCommentTag only for the long record format. |
| 334 const int kDeoptReasonTag = 3; | 334 const int kDeoptReasonTag = 3; |
| 335 | 335 |
| 336 const int kPoolExtraTag = kPCJumpExtraTag - 2; | 336 const int kArchExtraTag = kPCJumpExtraTag - 2; |
| 337 const int kConstPoolTag = 0; | 337 const int kArch1Tag = 0; |
| 338 const int kVeneerPoolTag = 1; | 338 const int kArch2Tag = 1; |
| 339 | 339 |
| 340 | 340 |
| 341 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { | 341 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { |
| 342 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. | 342 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. |
| 343 // Otherwise write a variable length PC jump for the bits that do | 343 // Otherwise write a variable length PC jump for the bits that do |
| 344 // not fit in the kSmallPCDeltaBits bits. | 344 // not fit in the kSmallPCDeltaBits bits. |
| 345 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; | 345 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; |
| 346 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); | 346 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); |
| 347 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; | 347 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; |
| 348 DCHECK(pc_jump > 0); | 348 DCHECK(pc_jump > 0); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) { | 388 void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) { |
| 389 WriteExtraTag(kDataJumpExtraTag, top_tag); | 389 WriteExtraTag(kDataJumpExtraTag, top_tag); |
| 390 for (int i = 0; i < kIntSize; i++) { | 390 for (int i = 0; i < kIntSize; i++) { |
| 391 *--pos_ = static_cast<byte>(data_delta); | 391 *--pos_ = static_cast<byte>(data_delta); |
| 392 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 392 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
| 393 data_delta = data_delta >> kBitsPerByte; | 393 data_delta = data_delta >> kBitsPerByte; |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| 398 void RelocInfoWriter::WriteExtraTaggedPoolData(int data, int pool_type) { | 398 void RelocInfoWriter::WriteExtraTaggedArchData(int data, int type) { |
| 399 WriteExtraTag(kPoolExtraTag, pool_type); | 399 WriteExtraTag(kArchExtraTag, type); |
| 400 for (int i = 0; i < kIntSize; i++) { | 400 for (int i = 0; i < kIntSize; i++) { |
| 401 *--pos_ = static_cast<byte>(data); | 401 *--pos_ = static_cast<byte>(data); |
| 402 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 402 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
| 403 data = data >> kBitsPerByte; | 403 data = data >> kBitsPerByte; |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 | 407 |
| 408 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { | 408 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { |
| 409 WriteExtraTag(kDataJumpExtraTag, top_tag); | 409 WriteExtraTag(kDataJumpExtraTag, top_tag); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 next_position_candidate_pos_delta_ += pos_delta; | 497 next_position_candidate_pos_delta_ += pos_delta; |
| 498 } | 498 } |
| 499 next_position_candidate_flushed_ = false; | 499 next_position_candidate_flushed_ = false; |
| 500 } | 500 } |
| 501 last_position_ = static_cast<int>(rinfo->data()); | 501 last_position_ = static_cast<int>(rinfo->data()); |
| 502 } else if (RelocInfo::IsComment(rmode)) { | 502 } else if (RelocInfo::IsComment(rmode)) { |
| 503 // Comments are normally not generated, so we use the costly encoding. | 503 // Comments are normally not generated, so we use the costly encoding. |
| 504 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 504 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 505 WriteExtraTaggedData(rinfo->data(), kCommentTag); | 505 WriteExtraTaggedData(rinfo->data(), kCommentTag); |
| 506 DCHECK(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); | 506 DCHECK(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); |
| 507 } else if (RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)) { | 507 } else if (rmode == RelocInfo::ARCH1 || rmode == RelocInfo::ARCH2) { |
| 508 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 508 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 509 WriteExtraTaggedPoolData(static_cast<int>(rinfo->data()), | 509 WriteExtraTaggedArchData( |
| 510 RelocInfo::IsConstPool(rmode) ? kConstPoolTag | 510 static_cast<int>(rinfo->data()), |
| 511 : kVeneerPoolTag); | 511 rmode == RelocInfo::ARCH1 ? kArch1Tag : kArch2Tag); |
| 512 } else { | 512 } else { |
| 513 DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM); | 513 DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM); |
| 514 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; | 514 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; |
| 515 // For all other modes we simply use the mode as the extra tag. | 515 // For all other modes we simply use the mode as the extra tag. |
| 516 // None of these modes need a data component. | 516 // None of these modes need a data component. |
| 517 DCHECK(saved_mode < kPoolExtraTag); | 517 DCHECK(saved_mode < kArchExtraTag); |
| 518 WriteExtraTaggedPC(pc_delta, saved_mode); | 518 WriteExtraTaggedPC(pc_delta, saved_mode); |
| 519 } | 519 } |
| 520 last_pc_ = rinfo->pc(); | 520 last_pc_ = rinfo->pc(); |
| 521 last_mode_ = rmode; | 521 last_mode_ = rmode; |
| 522 #ifdef DEBUG | 522 #ifdef DEBUG |
| 523 DCHECK(begin_pos - pos_ <= kMaxSize); | 523 DCHECK(begin_pos - pos_ <= kMaxSize); |
| 524 #endif | 524 #endif |
| 525 } | 525 } |
| 526 | 526 |
| 527 | 527 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 553 void RelocIterator::AdvanceReadId() { | 553 void RelocIterator::AdvanceReadId() { |
| 554 int x = 0; | 554 int x = 0; |
| 555 for (int i = 0; i < kIntSize; i++) { | 555 for (int i = 0; i < kIntSize; i++) { |
| 556 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; | 556 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; |
| 557 } | 557 } |
| 558 last_id_ += x; | 558 last_id_ += x; |
| 559 rinfo_.data_ = last_id_; | 559 rinfo_.data_ = last_id_; |
| 560 } | 560 } |
| 561 | 561 |
| 562 | 562 |
| 563 void RelocIterator::AdvanceReadPoolData() { | 563 void RelocIterator::AdvanceReadArchData() { |
| 564 int x = 0; | 564 int x = 0; |
| 565 for (int i = 0; i < kIntSize; i++) { | 565 for (int i = 0; i < kIntSize; i++) { |
| 566 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; | 566 x |= static_cast<int>(*--pos_) << i * kBitsPerByte; |
| 567 } | 567 } |
| 568 rinfo_.data_ = x; | 568 rinfo_.data_ = x; |
| 569 } | 569 } |
| 570 | 570 |
| 571 | 571 |
| 572 void RelocIterator::AdvanceReadPosition() { | 572 void RelocIterator::AdvanceReadPosition() { |
| 573 int x = 0; | 573 int x = 0; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 Advance(kIntSize); | 702 Advance(kIntSize); |
| 703 } | 703 } |
| 704 } else { | 704 } else { |
| 705 DCHECK(locatable_tag == kCommentTag); | 705 DCHECK(locatable_tag == kCommentTag); |
| 706 if (SetMode(RelocInfo::COMMENT)) { | 706 if (SetMode(RelocInfo::COMMENT)) { |
| 707 AdvanceReadData(); | 707 AdvanceReadData(); |
| 708 return; | 708 return; |
| 709 } | 709 } |
| 710 Advance(kIntptrSize); | 710 Advance(kIntptrSize); |
| 711 } | 711 } |
| 712 } else if (extra_tag == kPoolExtraTag) { | 712 } else if (extra_tag == kArchExtraTag) { |
| 713 int pool_type = GetTopTag(); | 713 int type = GetTopTag(); |
| 714 DCHECK(pool_type == kConstPoolTag || pool_type == kVeneerPoolTag); | 714 DCHECK(type == kArch1Tag || type == kArch2Tag); |
| 715 RelocInfo::Mode rmode = (pool_type == kConstPoolTag) ? | 715 RelocInfo::Mode rmode = |
| 716 RelocInfo::CONST_POOL : RelocInfo::VENEER_POOL; | 716 (type == kArch1Tag) ? RelocInfo::ARCH1 : RelocInfo::ARCH2; |
| 717 if (SetMode(rmode)) { | 717 if (SetMode(rmode)) { |
| 718 AdvanceReadPoolData(); | 718 AdvanceReadArchData(); |
| 719 return; | 719 return; |
| 720 } | 720 } |
| 721 Advance(kIntSize); | 721 Advance(kIntSize); |
| 722 } else { | 722 } else { |
| 723 AdvanceReadPC(); | 723 AdvanceReadPC(); |
| 724 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; | 724 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; |
| 725 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return; | 725 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return; |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 } | 728 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 case RelocInfo::POSITION: | 827 case RelocInfo::POSITION: |
| 828 return "position"; | 828 return "position"; |
| 829 case RelocInfo::STATEMENT_POSITION: | 829 case RelocInfo::STATEMENT_POSITION: |
| 830 return "statement position"; | 830 return "statement position"; |
| 831 case RelocInfo::EXTERNAL_REFERENCE: | 831 case RelocInfo::EXTERNAL_REFERENCE: |
| 832 return "external reference"; | 832 return "external reference"; |
| 833 case RelocInfo::INTERNAL_REFERENCE: | 833 case RelocInfo::INTERNAL_REFERENCE: |
| 834 return "internal reference"; | 834 return "internal reference"; |
| 835 case RelocInfo::DEOPT_REASON: | 835 case RelocInfo::DEOPT_REASON: |
| 836 return "deopt reason"; | 836 return "deopt reason"; |
| 837 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 |
| 837 case RelocInfo::CONST_POOL: | 838 case RelocInfo::CONST_POOL: |
| 838 return "constant pool"; | 839 return "constant pool"; |
| 839 case RelocInfo::VENEER_POOL: | 840 case RelocInfo::VENEER_POOL: |
| 840 return "veneer pool"; | 841 return "veneer pool"; |
| 842 #elif V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
| 843 case RelocInfo::INTERNAL_REFERENCE_ENCODED: |
| 844 return "internal reference (encoded)"; |
| 845 case RelocInfo::ARCH2: |
| 846 UNREACHABLE(); |
| 847 return "arch2"; |
| 848 #else |
| 849 case RelocInfo::ARCH1: |
| 850 UNREACHABLE(); |
| 851 return "arch1"; |
| 852 case RelocInfo::ARCH2: |
| 853 UNREACHABLE(); |
| 854 return "arch2"; |
| 855 #endif |
| 841 case RelocInfo::DEBUG_BREAK_SLOT: | 856 case RelocInfo::DEBUG_BREAK_SLOT: |
| 842 return "debug break slot"; | 857 return "debug break slot"; |
| 843 case RelocInfo::CODE_AGE_SEQUENCE: | 858 case RelocInfo::CODE_AGE_SEQUENCE: |
| 844 return "code_age_sequence"; | 859 return "code_age_sequence"; |
| 845 case RelocInfo::NUMBER_OF_MODES: | 860 case RelocInfo::NUMBER_OF_MODES: |
| 846 UNREACHABLE(); | 861 UNREACHABLE(); |
| 847 return "number_of_modes"; | 862 return "number_of_modes"; |
| 848 } | 863 } |
| 849 return "unknown relocation type"; | 864 return "unknown relocation type"; |
| 850 } | 865 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 break; | 928 break; |
| 914 } | 929 } |
| 915 case RUNTIME_ENTRY: | 930 case RUNTIME_ENTRY: |
| 916 case JS_RETURN: | 931 case JS_RETURN: |
| 917 case COMMENT: | 932 case COMMENT: |
| 918 case POSITION: | 933 case POSITION: |
| 919 case STATEMENT_POSITION: | 934 case STATEMENT_POSITION: |
| 920 case EXTERNAL_REFERENCE: | 935 case EXTERNAL_REFERENCE: |
| 921 case INTERNAL_REFERENCE: | 936 case INTERNAL_REFERENCE: |
| 922 case DEOPT_REASON: | 937 case DEOPT_REASON: |
| 923 case CONST_POOL: | 938 case ARCH1: |
| 924 case VENEER_POOL: | 939 case ARCH2: |
| 925 case DEBUG_BREAK_SLOT: | 940 case DEBUG_BREAK_SLOT: |
| 926 case NONE32: | 941 case NONE32: |
| 927 case NONE64: | 942 case NONE64: |
| 928 break; | 943 break; |
| 929 case NUMBER_OF_MODES: | 944 case NUMBER_OF_MODES: |
| 930 UNREACHABLE(); | 945 UNREACHABLE(); |
| 931 break; | 946 break; |
| 932 case CODE_AGE_SEQUENCE: | 947 case CODE_AGE_SEQUENCE: |
| 933 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); | 948 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); |
| 934 break; | 949 break; |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 RecordRelocInfo(RelocInfo::JS_RETURN); | 1698 RecordRelocInfo(RelocInfo::JS_RETURN); |
| 1684 } | 1699 } |
| 1685 | 1700 |
| 1686 | 1701 |
| 1687 void Assembler::RecordDebugBreakSlot() { | 1702 void Assembler::RecordDebugBreakSlot() { |
| 1688 positions_recorder()->WriteRecordedPositions(); | 1703 positions_recorder()->WriteRecordedPositions(); |
| 1689 EnsureSpace ensure_space(this); | 1704 EnsureSpace ensure_space(this); |
| 1690 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); | 1705 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); |
| 1691 } | 1706 } |
| 1692 } } // namespace v8::internal | 1707 } } // namespace v8::internal |
| OLD | NEW |