Chromium Code Reviews| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); | 458 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
| 459 | 459 |
| 460 // The two most common modes are given small tags, and usually fit in a byte. | 460 // The two most common modes are given small tags, and usually fit in a byte. |
| 461 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 461 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
| 462 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); | 462 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); |
| 463 } else if (rmode == RelocInfo::CODE_TARGET) { | 463 } else if (rmode == RelocInfo::CODE_TARGET) { |
| 464 WriteTaggedPC(pc_delta, kCodeTargetTag); | 464 WriteTaggedPC(pc_delta, kCodeTargetTag); |
| 465 DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize); | 465 DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize); |
| 466 } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 466 } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
| 467 // Use signed delta-encoding for id. | 467 // Use signed delta-encoding for id. |
| 468 DCHECK(static_cast<int>(rinfo->data()) == rinfo->data()); | 468 DCHECK_EQ(static_cast<int>(rinfo->data()), rinfo->data()); |
| 469 int id_delta = static_cast<int>(rinfo->data()) - last_id_; | 469 int id_delta = static_cast<int>(rinfo->data()) - last_id_; |
| 470 // Check if delta is small enough to fit in a tagged byte. | 470 // Check if delta is small enough to fit in a tagged byte. |
| 471 if (is_intn(id_delta, kSmallDataBits)) { | 471 if (is_intn(id_delta, kSmallDataBits)) { |
| 472 WriteTaggedPC(pc_delta, kLocatableTag); | 472 WriteTaggedPC(pc_delta, kLocatableTag); |
| 473 WriteTaggedData(id_delta, kCodeWithIdTag); | 473 WriteTaggedData(id_delta, kCodeWithIdTag); |
| 474 } else { | 474 } else { |
| 475 // Otherwise, use costly encoding. | 475 // Otherwise, use costly encoding. |
| 476 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 476 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 477 WriteExtraTaggedIntData(id_delta, kCodeWithIdTag); | 477 WriteExtraTaggedIntData(id_delta, kCodeWithIdTag); |
| 478 } | 478 } |
| 479 last_id_ = static_cast<int>(rinfo->data()); | 479 last_id_ = static_cast<int>(rinfo->data()); |
| 480 } else if (rmode == RelocInfo::DEOPT_REASON) { | 480 } else if (rmode == RelocInfo::DEOPT_REASON) { |
| 481 DCHECK(rinfo->data() < (1 << kSmallDataBits)); | 481 DCHECK(rinfo->data() < (1 << kSmallDataBits)); |
| 482 WriteTaggedPC(pc_delta, kLocatableTag); | 482 WriteTaggedPC(pc_delta, kLocatableTag); |
| 483 WriteTaggedData(rinfo->data(), kDeoptReasonTag); | 483 WriteTaggedData(rinfo->data(), kDeoptReasonTag); |
| 484 } else if (RelocInfo::IsPosition(rmode)) { | 484 } else if (RelocInfo::IsPosition(rmode)) { |
| 485 // Use signed delta-encoding for position. | 485 // Use signed delta-encoding for position. |
| 486 DCHECK(static_cast<int>(rinfo->data()) == rinfo->data()); | 486 DCHECK_EQ(static_cast<int>(rinfo->data()), rinfo->data()); |
| 487 int pos_delta = static_cast<int>(rinfo->data()) - last_position_; | 487 int pos_delta = static_cast<int>(rinfo->data()) - last_position_; |
| 488 if (rmode == RelocInfo::STATEMENT_POSITION) { | 488 if (rmode == RelocInfo::STATEMENT_POSITION) { |
| 489 WritePosition(pc_delta, pos_delta, rmode); | 489 WritePosition(pc_delta, pos_delta, rmode); |
| 490 } else { | 490 } else { |
| 491 DCHECK(rmode == RelocInfo::POSITION); | 491 DCHECK_EQ(rmode, RelocInfo::POSITION); |
| 492 if (pc_delta != 0 || last_mode_ != RelocInfo::POSITION) { | 492 if (pc_delta != 0 || last_mode_ != RelocInfo::POSITION) { |
| 493 FlushPosition(); | 493 FlushPosition(); |
| 494 next_position_candidate_pc_delta_ = pc_delta; | 494 next_position_candidate_pc_delta_ = pc_delta; |
| 495 next_position_candidate_pos_delta_ = pos_delta; | 495 next_position_candidate_pos_delta_ = pos_delta; |
| 496 } else { | 496 } else { |
| 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()); |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 // Return whether something was written. | 1651 // Return whether something was written. |
| 1652 return written; | 1652 return written; |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 | 1655 |
| 1656 // Platform specific but identical code for all the platforms. | 1656 // Platform specific but identical code for all the platforms. |
| 1657 | 1657 |
| 1658 | 1658 |
| 1659 void Assembler::RecordDeoptReason(const int reason, const int raw_position) { | 1659 void Assembler::RecordDeoptReason(const int reason, |
| 1660 const SourcePosition position) { | |
| 1660 if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) { | 1661 if (FLAG_trace_deopt || isolate()->cpu_profiler()->is_profiling()) { |
| 1661 EnsureSpace ensure_space(this); | 1662 EnsureSpace ensure_space(this); |
| 1663 int raw_position = position.IsUnknown() ? 0 : position.raw(); | |
|
yurys
2015/02/27 10:35:24
Can we change SourcePosition so that raw() value o
loislo
2015/02/27 12:04:28
We use RelocInfo::kNoPosition in many other places
| |
| 1662 RecordRelocInfo(RelocInfo::POSITION, raw_position); | 1664 RecordRelocInfo(RelocInfo::POSITION, raw_position); |
| 1663 RecordRelocInfo(RelocInfo::DEOPT_REASON, reason); | 1665 RecordRelocInfo(RelocInfo::DEOPT_REASON, reason); |
| 1664 } | 1666 } |
| 1665 } | 1667 } |
| 1666 | 1668 |
| 1667 | 1669 |
| 1668 void Assembler::RecordComment(const char* msg) { | 1670 void Assembler::RecordComment(const char* msg) { |
| 1669 if (FLAG_code_comments) { | 1671 if (FLAG_code_comments) { |
| 1670 EnsureSpace ensure_space(this); | 1672 EnsureSpace ensure_space(this); |
| 1671 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); | 1673 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); |
| 1672 } | 1674 } |
| 1673 } | 1675 } |
| 1674 | 1676 |
| 1675 | 1677 |
| 1676 void Assembler::RecordJSReturn() { | 1678 void Assembler::RecordJSReturn() { |
| 1677 positions_recorder()->WriteRecordedPositions(); | 1679 positions_recorder()->WriteRecordedPositions(); |
| 1678 EnsureSpace ensure_space(this); | 1680 EnsureSpace ensure_space(this); |
| 1679 RecordRelocInfo(RelocInfo::JS_RETURN); | 1681 RecordRelocInfo(RelocInfo::JS_RETURN); |
| 1680 } | 1682 } |
| 1681 | 1683 |
| 1682 | 1684 |
| 1683 void Assembler::RecordDebugBreakSlot() { | 1685 void Assembler::RecordDebugBreakSlot() { |
| 1684 positions_recorder()->WriteRecordedPositions(); | 1686 positions_recorder()->WriteRecordedPositions(); |
| 1685 EnsureSpace ensure_space(this); | 1687 EnsureSpace ensure_space(this); |
| 1686 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); | 1688 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); |
| 1687 } | 1689 } |
| 1688 } } // namespace v8::internal | 1690 } } // namespace v8::internal |
| OLD | NEW |