Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: src/assembler.cc

Issue 2072963003: Simplify AssemblerPositionsRecorder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 } 1761 }
1762 1762
1763 1763
1764 std::ostream& operator<<(std::ostream& os, ExternalReference reference) { 1764 std::ostream& operator<<(std::ostream& os, ExternalReference reference) {
1765 os << static_cast<const void*>(reference.address()); 1765 os << static_cast<const void*>(reference.address());
1766 const Runtime::Function* fn = Runtime::FunctionForEntry(reference.address()); 1766 const Runtime::Function* fn = Runtime::FunctionForEntry(reference.address());
1767 if (fn) os << "<" << fn->name << ".entry>"; 1767 if (fn) os << "<" << fn->name << ".entry>";
1768 return os; 1768 return os;
1769 } 1769 }
1770 1770
1771 void AssemblerPositionsRecorder::RecordPosition(int pos) { 1771 bool AssemblerPositionsRecorder::RecordPosition(int pos) {
1772 DCHECK(pos != RelocInfo::kNoPosition); 1772 DCHECK(pos != RelocInfo::kNoPosition);
1773 DCHECK(pos >= 0); 1773 DCHECK(pos >= 0);
1774 state_.current_position = pos; 1774 current_position_ = pos;
1775 LOG_CODE_EVENT(assembler_->isolate(), 1775 LOG_CODE_EVENT(assembler_->isolate(),
1776 CodeLinePosInfoAddPositionEvent(jit_handler_data_, 1776 CodeLinePosInfoAddPositionEvent(jit_handler_data_,
1777 assembler_->pc_offset(), 1777 assembler_->pc_offset(),
1778 pos)); 1778 pos));
1779 return WriteRecordedPositions();
1779 } 1780 }
1780 1781
1781 void AssemblerPositionsRecorder::RecordStatementPosition(int pos) { 1782 bool AssemblerPositionsRecorder::RecordStatementPosition(int pos) {
1782 DCHECK(pos != RelocInfo::kNoPosition); 1783 DCHECK(pos != RelocInfo::kNoPosition);
1783 DCHECK(pos >= 0); 1784 DCHECK(pos >= 0);
1784 state_.current_statement_position = pos; 1785 current_statement_position_ = pos;
1786 current_position_ = pos;
1785 LOG_CODE_EVENT(assembler_->isolate(), 1787 LOG_CODE_EVENT(assembler_->isolate(),
1786 CodeLinePosInfoAddStatementPositionEvent( 1788 CodeLinePosInfoAddStatementPositionEvent(
1787 jit_handler_data_, 1789 jit_handler_data_,
1788 assembler_->pc_offset(), 1790 assembler_->pc_offset(),
1789 pos)); 1791 pos));
1792 LOG_CODE_EVENT(assembler_->isolate(),
1793 CodeLinePosInfoAddPositionEvent(jit_handler_data_,
1794 assembler_->pc_offset(), pos));
1795 return WriteRecordedPositions();
jgruber 2016/06/17 17:38:52 Nit: We could possibly 'return RecordPosition(pos)
1790 } 1796 }
1791 1797
1792 bool AssemblerPositionsRecorder::WriteRecordedPositions() { 1798 bool AssemblerPositionsRecorder::WriteRecordedPositions() {
1793 bool written = false; 1799 bool written = false;
1794 1800
1795 // Write the statement position if it is different from what was written last 1801 // Write the statement position if it is different from what was written last
1796 // time. 1802 // time.
1797 if (state_.current_statement_position != state_.written_statement_position) { 1803 if (current_statement_position_ != written_statement_position_) {
1798 EnsureSpace ensure_space(assembler_); 1804 EnsureSpace ensure_space(assembler_);
1799 assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION, 1805 assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION,
1800 state_.current_statement_position); 1806 current_statement_position_);
1801 state_.written_position = state_.current_statement_position; 1807 written_position_ = current_statement_position_;
1802 state_.written_statement_position = state_.current_statement_position; 1808 written_statement_position_ = current_statement_position_;
1803 written = true; 1809 written = true;
1804 } 1810 }
1805 1811
1806 // Write the position if it is different from what was written last time and 1812 // Write the position if it is different from what was written last time and
1807 // also different from the statement position that was just written. 1813 // also different from the statement position that was just written.
1808 if (state_.current_position != state_.written_position) { 1814 if (current_position_ != written_position_) {
1809 EnsureSpace ensure_space(assembler_); 1815 EnsureSpace ensure_space(assembler_);
1810 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1816 assembler_->RecordRelocInfo(RelocInfo::POSITION, current_position_);
1811 state_.written_position = state_.current_position; 1817 written_position_ = current_position_;
1812 written = true; 1818 written = true;
1813 } 1819 }
1814 1820
1815 // Return whether something was written. 1821 // Return whether something was written.
1816 return written; 1822 return written;
1817 } 1823 }
1818 1824
1819 1825
1820 ConstantPoolBuilder::ConstantPoolBuilder(int ptr_reach_bits, 1826 ConstantPoolBuilder::ConstantPoolBuilder(int ptr_reach_bits,
1821 int double_reach_bits) { 1827 int double_reach_bits) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 2059
2054 2060
2055 void Assembler::DataAlign(int m) { 2061 void Assembler::DataAlign(int m) {
2056 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 2062 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
2057 while ((pc_offset() & (m - 1)) != 0) { 2063 while ((pc_offset() & (m - 1)) != 0) {
2058 db(0); 2064 db(0);
2059 } 2065 }
2060 } 2066 }
2061 } // namespace internal 2067 } // namespace internal
2062 } // namespace v8 2068 } // namespace v8
OLDNEW
« src/assembler.h ('K') | « src/assembler.h ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698