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

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

Issue 14170: Refactored the recording of source position in the generated code. The code g... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years 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.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 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 if (kDebug && own_buffer_) { 309 if (kDebug && own_buffer_) {
310 memset(buffer_, 0xCC, buffer_size); // int3 310 memset(buffer_, 0xCC, buffer_size); // int3
311 } 311 }
312 312
313 // setup buffer pointers 313 // setup buffer pointers
314 ASSERT(buffer_ != NULL); 314 ASSERT(buffer_ != NULL);
315 pc_ = buffer_; 315 pc_ = buffer_;
316 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); 316 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
317 317
318 last_pc_ = NULL; 318 last_pc_ = NULL;
319 last_position_ = RelocInfo::kNoPosition; 319 current_statement_position_ = RelocInfo::kNoPosition;
320 last_statement_position_ = RelocInfo::kNoPosition; 320 current_position_ = RelocInfo::kNoPosition;
321 written_statement_position_ = current_statement_position_;
322 written_position_ = current_position_;
321 } 323 }
322 324
323 325
324 Assembler::~Assembler() { 326 Assembler::~Assembler() {
325 if (own_buffer_) { 327 if (own_buffer_) {
326 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) { 328 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) {
327 spare_buffer_ = buffer_; 329 spare_buffer_ = buffer_;
328 } else { 330 } else {
329 DeleteArray(buffer_); 331 DeleteArray(buffer_);
330 } 332 }
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 1983
1982 void Assembler::RecordComment(const char* msg) { 1984 void Assembler::RecordComment(const char* msg) {
1983 if (FLAG_debug_code) { 1985 if (FLAG_debug_code) {
1984 EnsureSpace ensure_space(this); 1986 EnsureSpace ensure_space(this);
1985 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); 1987 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
1986 } 1988 }
1987 } 1989 }
1988 1990
1989 1991
1990 void Assembler::RecordPosition(int pos) { 1992 void Assembler::RecordPosition(int pos) {
1991 if (pos == RelocInfo::kNoPosition) return; 1993 ASSERT(pos != RelocInfo::kNoPosition);
1992 ASSERT(pos >= 0); 1994 ASSERT(pos >= 0);
1993 last_position_ = pos; 1995 current_position_ = pos;
1994 } 1996 }
1995 1997
1996 1998
1997 void Assembler::RecordStatementPosition(int pos) { 1999 void Assembler::RecordStatementPosition(int pos) {
1998 if (pos == RelocInfo::kNoPosition) return; 2000 ASSERT(pos != RelocInfo::kNoPosition);
1999 ASSERT(pos >= 0); 2001 ASSERT(pos >= 0);
2000 last_statement_position_ = pos; 2002 current_statement_position_ = pos;
2001 } 2003 }
2002 2004
2003 2005
2004 void Assembler::WriteRecordedPositions() { 2006 void Assembler::WriteRecordedPositions() {
2005 if (last_statement_position_ != RelocInfo::kNoPosition) { 2007 // Write the statement position if it is different from what was written last
2008 // time.
2009 if (current_statement_position_ != written_statement_position_) {
2006 EnsureSpace ensure_space(this); 2010 EnsureSpace ensure_space(this);
2007 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, last_statement_position_); 2011 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, current_statement_position_);
2012 written_statement_position_ = current_statement_position_;
2008 } 2013 }
2009 if ((last_position_ != RelocInfo::kNoPosition) && 2014
2010 (last_position_ != last_statement_position_)) { 2015 // Write the position if it is different from what was written last time and
2016 // also diferent from the written statement position.
2017 if (current_position_ != written_position_ &&
2018 current_position_ != written_statement_position_) {
2011 EnsureSpace ensure_space(this); 2019 EnsureSpace ensure_space(this);
2012 RecordRelocInfo(RelocInfo::POSITION, last_position_); 2020 RecordRelocInfo(RelocInfo::POSITION, current_position_);
2021 written_position_ = current_position_;
2013 } 2022 }
2014 last_statement_position_ = RelocInfo::kNoPosition;
2015 last_position_ = RelocInfo::kNoPosition;
2016 } 2023 }
2017 2024
2018 2025
2019 void Assembler::GrowBuffer() { 2026 void Assembler::GrowBuffer() {
2020 ASSERT(overflow()); // should not call this otherwise 2027 ASSERT(overflow()); // should not call this otherwise
2021 if (!own_buffer_) FATAL("external code buffer is too small"); 2028 if (!own_buffer_) FATAL("external code buffer is too small");
2022 2029
2023 // compute new buffer size 2030 // compute new buffer size
2024 CodeDesc desc; // the new buffer 2031 CodeDesc desc; // the new buffer
2025 if (buffer_size_ < 4*KB) { 2032 if (buffer_size_ < 4*KB) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 ASSERT(bound_label.is_bound()); 2163 ASSERT(bound_label.is_bound());
2157 ASSERT(0 <= position); 2164 ASSERT(0 <= position);
2158 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); 2165 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset());
2159 ASSERT(long_at(position) == 0); // only initialize once! 2166 ASSERT(long_at(position) == 0); // only initialize once!
2160 2167
2161 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); 2168 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos()));
2162 long_at_put(position, label_loc); 2169 long_at_put(position, label_loc);
2163 } 2170 }
2164 2171
2165 } } // namespace v8::internal 2172 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler-ia32.h ('k') | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698