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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 buffer_size_ = buffer_size; | 299 buffer_size_ = buffer_size; |
300 own_buffer_ = false; | 300 own_buffer_ = false; |
301 } | 301 } |
302 | 302 |
303 // Setup buffer pointers. | 303 // Setup buffer pointers. |
304 ASSERT(buffer_ != NULL); | 304 ASSERT(buffer_ != NULL); |
305 pc_ = buffer_; | 305 pc_ = buffer_; |
306 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); | 306 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); |
307 num_prinfo_ = 0; | 307 num_prinfo_ = 0; |
308 next_buffer_check_ = 0; | 308 next_buffer_check_ = 0; |
| 309 const_pool_blocked_nesting_ = 0; |
309 no_const_pool_before_ = 0; | 310 no_const_pool_before_ = 0; |
310 last_const_pool_end_ = 0; | 311 last_const_pool_end_ = 0; |
311 last_bound_pos_ = 0; | 312 last_bound_pos_ = 0; |
312 current_statement_position_ = RelocInfo::kNoPosition; | 313 current_statement_position_ = RelocInfo::kNoPosition; |
313 current_position_ = RelocInfo::kNoPosition; | 314 current_position_ = RelocInfo::kNoPosition; |
314 written_statement_position_ = current_statement_position_; | 315 written_statement_position_ = current_statement_position_; |
315 written_position_ = current_position_; | 316 written_position_ = current_position_; |
316 } | 317 } |
317 | 318 |
318 | 319 |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 } | 1720 } |
1720 | 1721 |
1721 | 1722 |
1722 bool Assembler::ImmediateFitsAddrMode1Instruction(int32_t imm32) { | 1723 bool Assembler::ImmediateFitsAddrMode1Instruction(int32_t imm32) { |
1723 uint32_t dummy1; | 1724 uint32_t dummy1; |
1724 uint32_t dummy2; | 1725 uint32_t dummy2; |
1725 return fits_shifter(imm32, &dummy1, &dummy2, NULL); | 1726 return fits_shifter(imm32, &dummy1, &dummy2, NULL); |
1726 } | 1727 } |
1727 | 1728 |
1728 | 1729 |
1729 void Assembler::BlockConstPoolFor(int instructions) { | |
1730 BlockConstPoolBefore(pc_offset() + instructions * kInstrSize); | |
1731 } | |
1732 | |
1733 | |
1734 // Debugging. | 1730 // Debugging. |
1735 void Assembler::RecordJSReturn() { | 1731 void Assembler::RecordJSReturn() { |
1736 WriteRecordedPositions(); | 1732 WriteRecordedPositions(); |
1737 CheckBuffer(); | 1733 CheckBuffer(); |
1738 RecordRelocInfo(RelocInfo::JS_RETURN); | 1734 RecordRelocInfo(RelocInfo::JS_RETURN); |
1739 } | 1735 } |
1740 | 1736 |
1741 | 1737 |
1742 void Assembler::RecordComment(const char* msg) { | 1738 void Assembler::RecordComment(const char* msg) { |
1743 if (FLAG_debug_code) { | 1739 if (FLAG_debug_code) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 // Thus we are safe as long as we generate less than 7 constant | 1883 // Thus we are safe as long as we generate less than 7 constant |
1888 // entries per instruction. | 1884 // entries per instruction. |
1889 (num_prinfo_ < (kMaxNumPRInfo - (7 * kCheckConstIntervalInst)))) { | 1885 (num_prinfo_ < (kMaxNumPRInfo - (7 * kCheckConstIntervalInst)))) { |
1890 return; | 1886 return; |
1891 } | 1887 } |
1892 | 1888 |
1893 // If we did not return by now, we need to emit the constant pool soon. | 1889 // If we did not return by now, we need to emit the constant pool soon. |
1894 | 1890 |
1895 // However, some small sequences of instructions must not be broken up by the | 1891 // However, some small sequences of instructions must not be broken up by the |
1896 // insertion of a constant pool; such sequences are protected by setting | 1892 // insertion of a constant pool; such sequences are protected by setting |
1897 // no_const_pool_before_, which is checked here. Also, recursive calls to | 1893 // either const_pool_blocked_nesting_ or no_const_pool_before_, which are |
1898 // CheckConstPool are blocked by no_const_pool_before_. | 1894 // both checked here. Also, recursive calls to CheckConstPool are blocked by |
1899 if (pc_offset() < no_const_pool_before_) { | 1895 // no_const_pool_before_. |
| 1896 if (const_pool_blocked_nesting_ > 0 || pc_offset() < no_const_pool_before_) { |
1900 // Emission is currently blocked; make sure we try again as soon as | 1897 // Emission is currently blocked; make sure we try again as soon as |
1901 // possible. | 1898 // possible. |
1902 next_buffer_check_ = no_const_pool_before_; | 1899 if (const_pool_blocked_nesting_ > 0) { |
| 1900 next_buffer_check_ = pc_offset() + kInstrSize; |
| 1901 } else { |
| 1902 next_buffer_check_ = no_const_pool_before_; |
| 1903 } |
1903 | 1904 |
1904 // Something is wrong if emission is forced and blocked at the same time. | 1905 // Something is wrong if emission is forced and blocked at the same time. |
1905 ASSERT(!force_emit); | 1906 ASSERT(!force_emit); |
1906 return; | 1907 return; |
1907 } | 1908 } |
1908 | 1909 |
1909 int jump_instr = require_jump ? kInstrSize : 0; | 1910 int jump_instr = require_jump ? kInstrSize : 0; |
1910 | 1911 |
1911 // Check that the code buffer is large enough before emitting the constant | 1912 // Check that the code buffer is large enough before emitting the constant |
1912 // pool and relocation information (include the jump over the pool and the | 1913 // pool and relocation information (include the jump over the pool and the |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 bind(&after_pool); | 1963 bind(&after_pool); |
1963 } | 1964 } |
1964 | 1965 |
1965 // Since a constant pool was just emitted, move the check offset forward by | 1966 // Since a constant pool was just emitted, move the check offset forward by |
1966 // the standard interval. | 1967 // the standard interval. |
1967 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 1968 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
1968 } | 1969 } |
1969 | 1970 |
1970 | 1971 |
1971 } } // namespace v8::internal | 1972 } } // namespace v8::internal |
OLD | NEW |