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

Side by Side Diff: src/assembler.cc

Issue 2072963003: Simplify AssemblerPositionsRecorder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment 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
« no previous file with comments | « src/assembler.h ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 } 1819 }
1820 1820
1821 1821
1822 std::ostream& operator<<(std::ostream& os, ExternalReference reference) { 1822 std::ostream& operator<<(std::ostream& os, ExternalReference reference) {
1823 os << static_cast<const void*>(reference.address()); 1823 os << static_cast<const void*>(reference.address());
1824 const Runtime::Function* fn = Runtime::FunctionForEntry(reference.address()); 1824 const Runtime::Function* fn = Runtime::FunctionForEntry(reference.address());
1825 if (fn) os << "<" << fn->name << ".entry>"; 1825 if (fn) os << "<" << fn->name << ".entry>";
1826 return os; 1826 return os;
1827 } 1827 }
1828 1828
1829 void AssemblerPositionsRecorder::RecordPosition(int pos) { 1829 bool AssemblerPositionsRecorder::RecordPosition(int pos) {
1830 DCHECK(pos != RelocInfo::kNoPosition); 1830 DCHECK(pos != RelocInfo::kNoPosition);
1831 DCHECK(pos >= 0); 1831 DCHECK(pos >= 0);
1832 state_.current_position = pos; 1832 current_position_ = pos;
1833 LOG_CODE_EVENT(assembler_->isolate(), 1833 LOG_CODE_EVENT(assembler_->isolate(),
1834 CodeLinePosInfoAddPositionEvent(jit_handler_data_, 1834 CodeLinePosInfoAddPositionEvent(jit_handler_data_,
1835 assembler_->pc_offset(), 1835 assembler_->pc_offset(),
1836 pos)); 1836 pos));
1837 return WriteRecordedPositions();
1837 } 1838 }
1838 1839
1839 void AssemblerPositionsRecorder::RecordStatementPosition(int pos) { 1840 bool AssemblerPositionsRecorder::RecordStatementPosition(int pos) {
1840 DCHECK(pos != RelocInfo::kNoPosition); 1841 DCHECK(pos != RelocInfo::kNoPosition);
1841 DCHECK(pos >= 0); 1842 DCHECK(pos >= 0);
1842 state_.current_statement_position = pos; 1843 current_statement_position_ = pos;
1843 LOG_CODE_EVENT(assembler_->isolate(), 1844 LOG_CODE_EVENT(assembler_->isolate(),
1844 CodeLinePosInfoAddStatementPositionEvent( 1845 CodeLinePosInfoAddStatementPositionEvent(
1845 jit_handler_data_, 1846 jit_handler_data_,
1846 assembler_->pc_offset(), 1847 assembler_->pc_offset(),
1847 pos)); 1848 pos));
1849 return RecordPosition(pos);
1848 } 1850 }
1849 1851
1850 bool AssemblerPositionsRecorder::WriteRecordedPositions() { 1852 bool AssemblerPositionsRecorder::WriteRecordedPositions() {
1851 bool written = false; 1853 bool written = false;
1852 1854
1853 // Write the statement position if it is different from what was written last 1855 // Write the statement position if it is different from what was written last
1854 // time. 1856 // time.
1855 if (state_.current_statement_position != state_.written_statement_position) { 1857 if (current_statement_position_ != written_statement_position_) {
1856 EnsureSpace ensure_space(assembler_); 1858 EnsureSpace ensure_space(assembler_);
1857 assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION, 1859 assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION,
1858 state_.current_statement_position); 1860 current_statement_position_);
1859 state_.written_position = state_.current_statement_position; 1861 written_position_ = current_statement_position_;
1860 state_.written_statement_position = state_.current_statement_position; 1862 written_statement_position_ = current_statement_position_;
1861 written = true; 1863 written = true;
1862 } 1864 }
1863 1865
1864 // Write the position if it is different from what was written last time and 1866 // Write the position if it is different from what was written last time and
1865 // also different from the statement position that was just written. 1867 // also different from the statement position that was just written.
1866 if (state_.current_position != state_.written_position) { 1868 if (current_position_ != written_position_) {
1867 EnsureSpace ensure_space(assembler_); 1869 EnsureSpace ensure_space(assembler_);
1868 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1870 assembler_->RecordRelocInfo(RelocInfo::POSITION, current_position_);
1869 state_.written_position = state_.current_position; 1871 written_position_ = current_position_;
1870 written = true; 1872 written = true;
1871 } 1873 }
1872 1874
1873 // Return whether something was written. 1875 // Return whether something was written.
1874 return written; 1876 return written;
1875 } 1877 }
1876 1878
1877 1879
1878 ConstantPoolBuilder::ConstantPoolBuilder(int ptr_reach_bits, 1880 ConstantPoolBuilder::ConstantPoolBuilder(int ptr_reach_bits,
1879 int double_reach_bits) { 1881 int double_reach_bits) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 2113
2112 2114
2113 void Assembler::DataAlign(int m) { 2115 void Assembler::DataAlign(int m) {
2114 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 2116 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
2115 while ((pc_offset() & (m - 1)) != 0) { 2117 while ((pc_offset() & (m - 1)) != 0) {
2116 db(0); 2118 db(0);
2117 } 2119 }
2118 } 2120 }
2119 } // namespace internal 2121 } // namespace internal
2120 } // namespace v8 2122 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698