| 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 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 | 2033 |
| 2034 | 2034 |
| 2035 // Debugging. | 2035 // Debugging. |
| 2036 void Assembler::RecordJSReturn() { | 2036 void Assembler::RecordJSReturn() { |
| 2037 WriteRecordedPositions(); | 2037 WriteRecordedPositions(); |
| 2038 CheckBuffer(); | 2038 CheckBuffer(); |
| 2039 RecordRelocInfo(RelocInfo::JS_RETURN); | 2039 RecordRelocInfo(RelocInfo::JS_RETURN); |
| 2040 } | 2040 } |
| 2041 | 2041 |
| 2042 | 2042 |
| 2043 void Assembler::RecordDebugBreakSlot() { |
| 2044 WriteRecordedPositions(); |
| 2045 CheckBuffer(); |
| 2046 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); |
| 2047 } |
| 2048 |
| 2049 |
| 2043 void Assembler::RecordComment(const char* msg) { | 2050 void Assembler::RecordComment(const char* msg) { |
| 2044 if (FLAG_debug_code) { | 2051 if (FLAG_debug_code) { |
| 2045 CheckBuffer(); | 2052 CheckBuffer(); |
| 2046 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); | 2053 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); |
| 2047 } | 2054 } |
| 2048 } | 2055 } |
| 2049 | 2056 |
| 2050 | 2057 |
| 2051 void Assembler::RecordPosition(int pos) { | 2058 void Assembler::RecordPosition(int pos) { |
| 2052 if (pos == RelocInfo::kNoPosition) return; | 2059 if (pos == RelocInfo::kNoPosition) return; |
| 2053 ASSERT(pos >= 0); | 2060 ASSERT(pos >= 0); |
| 2054 current_position_ = pos; | 2061 current_position_ = pos; |
| 2055 } | 2062 } |
| 2056 | 2063 |
| 2057 | 2064 |
| 2058 void Assembler::RecordStatementPosition(int pos) { | 2065 void Assembler::RecordStatementPosition(int pos) { |
| 2059 if (pos == RelocInfo::kNoPosition) return; | 2066 if (pos == RelocInfo::kNoPosition) return; |
| 2060 ASSERT(pos >= 0); | 2067 ASSERT(pos >= 0); |
| 2061 current_statement_position_ = pos; | 2068 current_statement_position_ = pos; |
| 2062 } | 2069 } |
| 2063 | 2070 |
| 2064 | 2071 |
| 2065 void Assembler::WriteRecordedPositions() { | 2072 bool Assembler::WriteRecordedPositions() { |
| 2073 bool written = false; |
| 2074 |
| 2066 // Write the statement position if it is different from what was written last | 2075 // Write the statement position if it is different from what was written last |
| 2067 // time. | 2076 // time. |
| 2068 if (current_statement_position_ != written_statement_position_) { | 2077 if (current_statement_position_ != written_statement_position_) { |
| 2069 CheckBuffer(); | 2078 CheckBuffer(); |
| 2070 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, current_statement_position_); | 2079 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, current_statement_position_); |
| 2071 written_statement_position_ = current_statement_position_; | 2080 written_statement_position_ = current_statement_position_; |
| 2081 written = true; |
| 2072 } | 2082 } |
| 2073 | 2083 |
| 2074 // Write the position if it is different from what was written last time and | 2084 // Write the position if it is different from what was written last time and |
| 2075 // also different from the written statement position. | 2085 // also different from the written statement position. |
| 2076 if (current_position_ != written_position_ && | 2086 if (current_position_ != written_position_ && |
| 2077 current_position_ != written_statement_position_) { | 2087 current_position_ != written_statement_position_) { |
| 2078 CheckBuffer(); | 2088 CheckBuffer(); |
| 2079 RecordRelocInfo(RelocInfo::POSITION, current_position_); | 2089 RecordRelocInfo(RelocInfo::POSITION, current_position_); |
| 2080 written_position_ = current_position_; | 2090 written_position_ = current_position_; |
| 2091 written = true; |
| 2081 } | 2092 } |
| 2093 |
| 2094 // Return whether something was written. |
| 2095 return written; |
| 2082 } | 2096 } |
| 2083 | 2097 |
| 2084 | 2098 |
| 2085 void Assembler::GrowBuffer() { | 2099 void Assembler::GrowBuffer() { |
| 2086 if (!own_buffer_) FATAL("external code buffer is too small"); | 2100 if (!own_buffer_) FATAL("external code buffer is too small"); |
| 2087 | 2101 |
| 2088 // Compute new buffer size. | 2102 // Compute new buffer size. |
| 2089 CodeDesc desc; // the new buffer | 2103 CodeDesc desc; // the new buffer |
| 2090 if (buffer_size_ < 4*KB) { | 2104 if (buffer_size_ < 4*KB) { |
| 2091 desc.buffer_size = 4*KB; | 2105 desc.buffer_size = 4*KB; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 rinfo.rmode() != RelocInfo::POSITION); | 2142 rinfo.rmode() != RelocInfo::POSITION); |
| 2129 if (rinfo.rmode() != RelocInfo::JS_RETURN) { | 2143 if (rinfo.rmode() != RelocInfo::JS_RETURN) { |
| 2130 rinfo.set_pc(rinfo.pc() + pc_delta); | 2144 rinfo.set_pc(rinfo.pc() + pc_delta); |
| 2131 } | 2145 } |
| 2132 } | 2146 } |
| 2133 } | 2147 } |
| 2134 | 2148 |
| 2135 | 2149 |
| 2136 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 2150 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
| 2137 RelocInfo rinfo(pc_, rmode, data); // we do not try to reuse pool constants | 2151 RelocInfo rinfo(pc_, rmode, data); // we do not try to reuse pool constants |
| 2138 if (rmode >= RelocInfo::JS_RETURN && rmode <= RelocInfo::STATEMENT_POSITION) { | 2152 if (rmode >= RelocInfo::JS_RETURN && rmode <= RelocInfo::DEBUG_BREAK_SLOT) { |
| 2139 // Adjust code for new modes. | 2153 // Adjust code for new modes. |
| 2140 ASSERT(RelocInfo::IsJSReturn(rmode) | 2154 ASSERT(RelocInfo::IsDebugBreakSlot(rmode) |
| 2155 || RelocInfo::IsJSReturn(rmode) |
| 2141 || RelocInfo::IsComment(rmode) | 2156 || RelocInfo::IsComment(rmode) |
| 2142 || RelocInfo::IsPosition(rmode)); | 2157 || RelocInfo::IsPosition(rmode)); |
| 2143 // These modes do not need an entry in the constant pool. | 2158 // These modes do not need an entry in the constant pool. |
| 2144 } else { | 2159 } else { |
| 2145 ASSERT(num_prinfo_ < kMaxNumPRInfo); | 2160 ASSERT(num_prinfo_ < kMaxNumPRInfo); |
| 2146 prinfo_[num_prinfo_++] = rinfo; | 2161 prinfo_[num_prinfo_++] = rinfo; |
| 2147 // Make sure the constant pool is not emitted in place of the next | 2162 // Make sure the constant pool is not emitted in place of the next |
| 2148 // instruction for which we just recorded relocation info. | 2163 // instruction for which we just recorded relocation info. |
| 2149 BlockConstPoolBefore(pc_offset() + kInstrSize); | 2164 BlockConstPoolBefore(pc_offset() + kInstrSize); |
| 2150 } | 2165 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 | 2285 |
| 2271 // Since a constant pool was just emitted, move the check offset forward by | 2286 // Since a constant pool was just emitted, move the check offset forward by |
| 2272 // the standard interval. | 2287 // the standard interval. |
| 2273 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 2288 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
| 2274 } | 2289 } |
| 2275 | 2290 |
| 2276 | 2291 |
| 2277 } } // namespace v8::internal | 2292 } } // namespace v8::internal |
| 2278 | 2293 |
| 2279 #endif // V8_TARGET_ARCH_ARM | 2294 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |