| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // 00 [6 bits pc delta] | 285 // 00 [6 bits pc delta] |
| 286 // or | 286 // or |
| 287 // pc-jump (variable length): | 287 // pc-jump (variable length): |
| 288 // 01 1111 11, | 288 // 01 1111 11, |
| 289 // [7 bits data] 0 | 289 // [7 bits data] 0 |
| 290 // ... | 290 // ... |
| 291 // [7 bits data] 1 | 291 // [7 bits data] 1 |
| 292 // (Bits 6..31 of pc delta, with leading zeroes | 292 // (Bits 6..31 of pc delta, with leading zeroes |
| 293 // dropped, and last non-zero chunk tagged with 1.) | 293 // dropped, and last non-zero chunk tagged with 1.) |
| 294 | 294 |
| 295 | |
| 296 #ifdef DEBUG | |
| 297 const int kMaxStandardNonCompactModes = 14; | |
| 298 #endif | |
| 299 | |
| 300 const int kTagBits = 2; | 295 const int kTagBits = 2; |
| 301 const int kTagMask = (1 << kTagBits) - 1; | 296 const int kTagMask = (1 << kTagBits) - 1; |
| 302 const int kExtraTagBits = 4; | 297 const int kExtraTagBits = 4; |
| 303 const int kLocatableTypeTagBits = 2; | 298 const int kLocatableTypeTagBits = 2; |
| 304 const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits; | 299 const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits; |
| 305 | 300 |
| 306 const int kEmbeddedObjectTag = 0; | 301 const int kEmbeddedObjectTag = 0; |
| 307 const int kCodeTargetTag = 1; | 302 const int kCodeTargetTag = 1; |
| 308 const int kLocatableTag = 2; | 303 const int kLocatableTag = 2; |
| 309 const int kDefaultTag = 3; | 304 const int kDefaultTag = 3; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 void RelocInfoWriter::Write(const RelocInfo* rinfo) { | 440 void RelocInfoWriter::Write(const RelocInfo* rinfo) { |
| 446 RelocInfo::Mode rmode = rinfo->rmode(); | 441 RelocInfo::Mode rmode = rinfo->rmode(); |
| 447 if (rmode != RelocInfo::POSITION) { | 442 if (rmode != RelocInfo::POSITION) { |
| 448 FlushPosition(); | 443 FlushPosition(); |
| 449 } | 444 } |
| 450 #ifdef DEBUG | 445 #ifdef DEBUG |
| 451 byte* begin_pos = pos_; | 446 byte* begin_pos = pos_; |
| 452 #endif | 447 #endif |
| 453 DCHECK(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES); | 448 DCHECK(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES); |
| 454 DCHECK(rinfo->pc() - last_pc_ >= 0); | 449 DCHECK(rinfo->pc() - last_pc_ >= 0); |
| 455 DCHECK(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM | |
| 456 <= kMaxStandardNonCompactModes); | |
| 457 // Use unsigned delta-encoding for pc. | 450 // Use unsigned delta-encoding for pc. |
| 458 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); | 451 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
| 459 | 452 |
| 460 // The two most common modes are given small tags, and usually fit in a byte. | 453 // The two most common modes are given small tags, and usually fit in a byte. |
| 461 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 454 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
| 462 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); | 455 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); |
| 463 } else if (rmode == RelocInfo::CODE_TARGET) { | 456 } else if (rmode == RelocInfo::CODE_TARGET) { |
| 464 WriteTaggedPC(pc_delta, kCodeTargetTag); | 457 WriteTaggedPC(pc_delta, kCodeTargetTag); |
| 465 DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize); | 458 DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize); |
| 466 } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 459 } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 497 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 505 WriteExtraTaggedData(rinfo->data(), kCommentTag); | 498 WriteExtraTaggedData(rinfo->data(), kCommentTag); |
| 506 DCHECK(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); | 499 DCHECK(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); |
| 507 } else if (RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)) { | 500 } else if (RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)) { |
| 508 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 501 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 509 WriteExtraTaggedPoolData(static_cast<int>(rinfo->data()), | 502 WriteExtraTaggedPoolData(static_cast<int>(rinfo->data()), |
| 510 RelocInfo::IsConstPool(rmode) ? kConstPoolTag | 503 RelocInfo::IsConstPool(rmode) ? kConstPoolTag |
| 511 : kVeneerPoolTag); | 504 : kVeneerPoolTag); |
| 512 } else { | 505 } else { |
| 513 DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM); | 506 DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM); |
| 507 DCHECK(rmode <= RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM); |
| 508 STATIC_ASSERT(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - |
| 509 RelocInfo::LAST_COMPACT_ENUM <= |
| 510 kPoolExtraTag); |
| 514 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM - 1; | 511 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM - 1; |
| 515 // For all other modes we simply use the mode as the extra tag. | 512 // For all other modes we simply use the mode as the extra tag. |
| 516 // None of these modes need a data component. | 513 // None of these modes need a data component. |
| 517 DCHECK(saved_mode < kPoolExtraTag); | 514 DCHECK(0 <= saved_mode && saved_mode < kPoolExtraTag); |
| 518 WriteExtraTaggedPC(pc_delta, saved_mode); | 515 WriteExtraTaggedPC(pc_delta, saved_mode); |
| 519 } | 516 } |
| 520 last_pc_ = rinfo->pc(); | 517 last_pc_ = rinfo->pc(); |
| 521 last_mode_ = rmode; | 518 last_mode_ = rmode; |
| 522 #ifdef DEBUG | 519 #ifdef DEBUG |
| 523 DCHECK(begin_pos - pos_ <= kMaxSize); | 520 DCHECK(begin_pos - pos_ <= kMaxSize); |
| 524 #endif | 521 #endif |
| 525 } | 522 } |
| 526 | 523 |
| 527 | 524 |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 RecordRelocInfo(RelocInfo::JS_RETURN); | 1671 RecordRelocInfo(RelocInfo::JS_RETURN); |
| 1675 } | 1672 } |
| 1676 | 1673 |
| 1677 | 1674 |
| 1678 void Assembler::RecordDebugBreakSlot() { | 1675 void Assembler::RecordDebugBreakSlot() { |
| 1679 positions_recorder()->WriteRecordedPositions(); | 1676 positions_recorder()->WriteRecordedPositions(); |
| 1680 EnsureSpace ensure_space(this); | 1677 EnsureSpace ensure_space(this); |
| 1681 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); | 1678 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); |
| 1682 } | 1679 } |
| 1683 } } // namespace v8::internal | 1680 } } // namespace v8::internal |
| OLD | NEW |