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 | 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 // setup buffer pointers | 314 // setup buffer pointers |
315 ASSERT(buffer_ != NULL); | 315 ASSERT(buffer_ != NULL); |
316 pc_ = buffer_; | 316 pc_ = buffer_; |
317 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); | 317 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); |
318 num_prinfo_ = 0; | 318 num_prinfo_ = 0; |
319 next_buffer_check_ = 0; | 319 next_buffer_check_ = 0; |
320 no_const_pool_before_ = 0; | 320 no_const_pool_before_ = 0; |
321 last_const_pool_end_ = 0; | 321 last_const_pool_end_ = 0; |
322 last_bound_pos_ = 0; | 322 last_bound_pos_ = 0; |
323 last_position_ = RelocInfo::kNoPosition; | 323 current_statement_position_ = RelocInfo::kNoPosition; |
324 last_position_is_statement_ = false; | 324 current_position_ = RelocInfo::kNoPosition; |
| 325 written_statement_position_ = current_statement_position_; |
| 326 written_position_ = current_position_; |
325 } | 327 } |
326 | 328 |
327 | 329 |
328 Assembler::~Assembler() { | 330 Assembler::~Assembler() { |
329 if (own_buffer_) { | 331 if (own_buffer_) { |
330 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) { | 332 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) { |
331 spare_buffer_ = buffer_; | 333 spare_buffer_ = buffer_; |
332 } else { | 334 } else { |
333 DeleteArray(buffer_); | 335 DeleteArray(buffer_); |
334 } | 336 } |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 if (FLAG_debug_code) { | 1301 if (FLAG_debug_code) { |
1300 CheckBuffer(); | 1302 CheckBuffer(); |
1301 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); | 1303 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); |
1302 } | 1304 } |
1303 } | 1305 } |
1304 | 1306 |
1305 | 1307 |
1306 void Assembler::RecordPosition(int pos) { | 1308 void Assembler::RecordPosition(int pos) { |
1307 if (pos == RelocInfo::kNoPosition) return; | 1309 if (pos == RelocInfo::kNoPosition) return; |
1308 ASSERT(pos >= 0); | 1310 ASSERT(pos >= 0); |
1309 if (pos == last_position_) return; | 1311 current_position_ = pos; |
1310 CheckBuffer(); | 1312 WriteRecordedPositions(); |
1311 RecordRelocInfo(RelocInfo::POSITION, pos); | |
1312 last_position_ = pos; | |
1313 last_position_is_statement_ = false; | |
1314 } | 1313 } |
1315 | 1314 |
1316 | 1315 |
1317 void Assembler::RecordStatementPosition(int pos) { | 1316 void Assembler::RecordStatementPosition(int pos) { |
1318 if (pos == last_position_) return; | 1317 if (pos == RelocInfo::kNoPosition) return; |
1319 CheckBuffer(); | 1318 ASSERT(pos >= 0); |
1320 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, pos); | 1319 current_statement_position_ = pos; |
1321 last_position_ = pos; | 1320 WriteRecordedPositions(); |
1322 last_position_is_statement_ = true; | 1321 } |
| 1322 |
| 1323 |
| 1324 void Assembler::WriteRecordedPositions() { |
| 1325 // Write the statement position if it is different from what was written last |
| 1326 // time. |
| 1327 if (current_statement_position_ != written_statement_position_) { |
| 1328 CheckBuffer(); |
| 1329 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, current_statement_position_); |
| 1330 written_statement_position_ = current_statement_position_; |
| 1331 } |
| 1332 |
| 1333 // Write the position if it is different from what was written last time and |
| 1334 // also diferent from the written statement position. |
| 1335 if (current_position_ != written_position_ && |
| 1336 current_position_ != written_statement_position_) { |
| 1337 CheckBuffer(); |
| 1338 RecordRelocInfo(RelocInfo::POSITION, current_position_); |
| 1339 written_position_ = current_position_; |
| 1340 } |
1323 } | 1341 } |
1324 | 1342 |
1325 | 1343 |
1326 void Assembler::GrowBuffer() { | 1344 void Assembler::GrowBuffer() { |
1327 if (!own_buffer_) FATAL("external code buffer is too small"); | 1345 if (!own_buffer_) FATAL("external code buffer is too small"); |
1328 | 1346 |
1329 // compute new buffer size | 1347 // compute new buffer size |
1330 CodeDesc desc; // the new buffer | 1348 CodeDesc desc; // the new buffer |
1331 if (buffer_size_ < 4*KB) { | 1349 if (buffer_size_ < 4*KB) { |
1332 desc.buffer_size = 4*KB; | 1350 desc.buffer_size = 4*KB; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 bind(&after_pool); | 1511 bind(&after_pool); |
1494 } | 1512 } |
1495 | 1513 |
1496 // Since a constant pool was just emitted, move the check offset forward by | 1514 // Since a constant pool was just emitted, move the check offset forward by |
1497 // the standard interval. | 1515 // the standard interval. |
1498 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 1516 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
1499 } | 1517 } |
1500 | 1518 |
1501 | 1519 |
1502 } } // namespace v8::internal | 1520 } } // namespace v8::internal |
OLD | NEW |