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

Side by Side Diff: src/assembler-ia32.cc

Issue 2957: Defer the writing of the source position data to the relocation information... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/assembler-ia32.h ('k') | src/codegen.h » ('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 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 // setup buffer pointers 312 // setup buffer pointers
313 ASSERT(buffer_ != NULL); 313 ASSERT(buffer_ != NULL);
314 pc_ = buffer_; 314 pc_ = buffer_;
315 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); 315 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
316 316
317 last_pc_ = NULL; 317 last_pc_ = NULL;
318 last_bound_pos_ = 0; 318 last_bound_pos_ = 0;
319 last_position_ = kNoPosition; 319 last_position_ = kNoPosition;
320 last_position_is_statement_ = false; 320 last_statement_position_ = kNoPosition;
321 } 321 }
322 322
323 323
324 Assembler::~Assembler() { 324 Assembler::~Assembler() {
325 if (own_buffer_) { 325 if (own_buffer_) {
326 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) { 326 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) {
327 spare_buffer_ = buffer_; 327 spare_buffer_ = buffer_;
328 } else { 328 } else {
329 DeleteArray(buffer_); 329 DeleteArray(buffer_);
330 } 330 }
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 1299
1300 void Assembler::call(const Operand& adr) { 1300 void Assembler::call(const Operand& adr) {
1301 EnsureSpace ensure_space(this); 1301 EnsureSpace ensure_space(this);
1302 last_pc_ = pc_; 1302 last_pc_ = pc_;
1303 EMIT(0xFF); 1303 EMIT(0xFF);
1304 emit_operand(edx, adr); 1304 emit_operand(edx, adr);
1305 } 1305 }
1306 1306
1307 1307
1308 void Assembler::call(Handle<Code> code, RelocMode rmode) { 1308 void Assembler::call(Handle<Code> code, RelocMode rmode) {
1309 WriteRecordedPositions();
1309 EnsureSpace ensure_space(this); 1310 EnsureSpace ensure_space(this);
1310 last_pc_ = pc_; 1311 last_pc_ = pc_;
1311 ASSERT(is_code_target(rmode)); 1312 ASSERT(is_code_target(rmode));
1312 EMIT(0xE8); 1313 EMIT(0xE8);
1313 emit(reinterpret_cast<intptr_t>(code.location()), rmode); 1314 emit(reinterpret_cast<intptr_t>(code.location()), rmode);
1314 } 1315 }
1315 1316
1316 1317
1317 void Assembler::jmp(Label* L) { 1318 void Assembler::jmp(Label* L) {
1318 EnsureSpace ensure_space(this); 1319 EnsureSpace ensure_space(this);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 EMIT(0xC0 | dst.code() << 3 | src.code()); 1838 EMIT(0xC0 | dst.code() << 3 | src.code());
1838 } 1839 }
1839 1840
1840 1841
1841 void Assembler::Print() { 1842 void Assembler::Print() {
1842 Disassembler::Decode(stdout, buffer_, pc_); 1843 Disassembler::Decode(stdout, buffer_, pc_);
1843 } 1844 }
1844 1845
1845 1846
1846 void Assembler::RecordJSReturn() { 1847 void Assembler::RecordJSReturn() {
1848 WriteRecordedPositions();
1847 EnsureSpace ensure_space(this); 1849 EnsureSpace ensure_space(this);
1848 RecordRelocInfo(js_return); 1850 RecordRelocInfo(js_return);
1849 } 1851 }
1850 1852
1851 1853
1852 void Assembler::RecordComment(const char* msg) { 1854 void Assembler::RecordComment(const char* msg) {
1853 if (FLAG_debug_code) { 1855 if (FLAG_debug_code) {
1854 EnsureSpace ensure_space(this); 1856 EnsureSpace ensure_space(this);
1855 RecordRelocInfo(comment, reinterpret_cast<intptr_t>(msg)); 1857 RecordRelocInfo(comment, reinterpret_cast<intptr_t>(msg));
1856 } 1858 }
1857 } 1859 }
1858 1860
1859 1861
1860 void Assembler::RecordPosition(int pos) { 1862 void Assembler::RecordPosition(int pos) {
1861 if (pos == kNoPosition) return; 1863 if (pos == kNoPosition) return;
1862 ASSERT(position >= 0); 1864 ASSERT(pos >= 0);
1863 if (pos == last_position_) return;
1864 EnsureSpace ensure_space(this);
1865 RecordRelocInfo(position, pos);
1866 last_position_ = pos; 1865 last_position_ = pos;
1867 last_position_is_statement_ = false;
1868 } 1866 }
1869 1867
1870 1868
1871 void Assembler::RecordStatementPosition(int pos) { 1869 void Assembler::RecordStatementPosition(int pos) {
1872 if (pos == kNoPosition) return; 1870 if (pos == kNoPosition) return;
1873 ASSERT(position >= 0); 1871 ASSERT(pos >= 0);
1874 if (pos == last_position_) return; 1872 last_statement_position_ = pos;
1875 EnsureSpace ensure_space(this); 1873 }
1876 RecordRelocInfo(statement_position, pos); 1874
1877 last_position_ = pos; 1875
1878 last_position_is_statement_ = true; 1876 void Assembler::WriteRecordedPositions() {
1877 if (last_statement_position_ != kNoPosition) {
1878 EnsureSpace ensure_space(this);
1879 RecordRelocInfo(statement_position, last_statement_position_);
1880 }
1881 if ((last_position_ != kNoPosition) &&
1882 (last_position_ != last_statement_position_)) {
1883 EnsureSpace ensure_space(this);
1884 RecordRelocInfo(position, last_position_);
1885 }
1886 last_statement_position_ = kNoPosition;
1887 last_position_ = kNoPosition;
1879 } 1888 }
1880 1889
1881 1890
1882 void Assembler::GrowBuffer() { 1891 void Assembler::GrowBuffer() {
1883 ASSERT(overflow()); // should not call this otherwise 1892 ASSERT(overflow()); // should not call this otherwise
1884 if (!own_buffer_) FATAL("external code buffer is too small"); 1893 if (!own_buffer_) FATAL("external code buffer is too small");
1885 1894
1886 // compute new buffer size 1895 // compute new buffer size
1887 CodeDesc desc; // the new buffer 1896 CodeDesc desc; // the new buffer
1888 if (buffer_size_ < 4*KB) { 1897 if (buffer_size_ < 4*KB) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 !Serializer::enabled() && 2019 !Serializer::enabled() &&
2011 !FLAG_debug_code) { 2020 !FLAG_debug_code) {
2012 return; 2021 return;
2013 } 2022 }
2014 RelocInfo rinfo(pc_, rmode, data); 2023 RelocInfo rinfo(pc_, rmode, data);
2015 reloc_info_writer.Write(&rinfo); 2024 reloc_info_writer.Write(&rinfo);
2016 } 2025 }
2017 2026
2018 2027
2019 } } // namespace v8::internal 2028 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler-ia32.h ('k') | src/codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698