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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 | 168 |
169 void RelocInfoWriter::WriteTaggedPC(uint32_t pc_delta, int tag) { | 169 void RelocInfoWriter::WriteTaggedPC(uint32_t pc_delta, int tag) { |
170 // Write a byte of tagged pc-delta, possibly preceded by var. length pc-jump. | 170 // Write a byte of tagged pc-delta, possibly preceded by var. length pc-jump. |
171 pc_delta = WriteVariableLengthPCJump(pc_delta); | 171 pc_delta = WriteVariableLengthPCJump(pc_delta); |
172 *--pos_ = pc_delta << kTagBits | tag; | 172 *--pos_ = pc_delta << kTagBits | tag; |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 void RelocInfoWriter::WriteTaggedData(intptr_t data_delta, int tag) { | 176 void RelocInfoWriter::WriteTaggedData(intptr_t data_delta, int tag) { |
177 *--pos_ = data_delta << kPositionTypeTagBits | tag; | 177 *--pos_ = static_cast<byte>(data_delta << kPositionTypeTagBits | tag); |
178 } | 178 } |
179 | 179 |
180 | 180 |
181 void RelocInfoWriter::WriteExtraTag(int extra_tag, int top_tag) { | 181 void RelocInfoWriter::WriteExtraTag(int extra_tag, int top_tag) { |
182 *--pos_ = top_tag << (kTagBits + kExtraTagBits) | | 182 *--pos_ = static_cast<int>(top_tag << (kTagBits + kExtraTagBits) | |
183 extra_tag << kTagBits | | 183 extra_tag << kTagBits | |
184 kDefaultTag; | 184 kDefaultTag); |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 void RelocInfoWriter::WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag) { | 188 void RelocInfoWriter::WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag) { |
189 // Write two-byte tagged pc-delta, possibly preceded by var. length pc-jump. | 189 // Write two-byte tagged pc-delta, possibly preceded by var. length pc-jump. |
190 pc_delta = WriteVariableLengthPCJump(pc_delta); | 190 pc_delta = WriteVariableLengthPCJump(pc_delta); |
191 WriteExtraTag(extra_tag, 0); | 191 WriteExtraTag(extra_tag, 0); |
192 *--pos_ = pc_delta; | 192 *--pos_ = pc_delta; |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { | 196 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { |
197 WriteExtraTag(kDataJumpTag, top_tag); | 197 WriteExtraTag(kDataJumpTag, top_tag); |
198 for (int i = 0; i < kIntptrSize; i++) { | 198 for (int i = 0; i < kIntptrSize; i++) { |
199 *--pos_ = data_delta; | 199 *--pos_ = static_cast<byte>(data_delta); |
200 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 200 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
201 data_delta = data_delta >> kBitsPerByte; | 201 data_delta = data_delta >> kBitsPerByte; |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 void RelocInfoWriter::Write(const RelocInfo* rinfo) { | 206 void RelocInfoWriter::Write(const RelocInfo* rinfo) { |
207 #ifdef DEBUG | 207 #ifdef DEBUG |
208 byte* begin_pos = pos_; | 208 byte* begin_pos = pos_; |
209 #endif | 209 #endif |
210 Counters::reloc_info_count.Increment(); | 210 Counters::reloc_info_count.Increment(); |
211 ASSERT(rinfo->pc() - last_pc_ >= 0); | 211 ASSERT(rinfo->pc() - last_pc_ >= 0); |
212 ASSERT(RelocInfo::NUMBER_OF_MODES < kMaxRelocModes); | 212 ASSERT(RelocInfo::NUMBER_OF_MODES < kMaxRelocModes); |
213 // Use unsigned delta-encoding for pc. | 213 // Use unsigned delta-encoding for pc. |
214 uint32_t pc_delta = rinfo->pc() - last_pc_; | 214 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
215 RelocInfo::Mode rmode = rinfo->rmode(); | 215 RelocInfo::Mode rmode = rinfo->rmode(); |
216 | 216 |
217 // The two most common modes are given small tags, and usually fit in a byte. | 217 // The two most common modes are given small tags, and usually fit in a byte. |
218 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 218 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
219 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); | 219 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); |
220 } else if (rmode == RelocInfo::CODE_TARGET) { | 220 } else if (rmode == RelocInfo::CODE_TARGET) { |
221 WriteTaggedPC(pc_delta, kCodeTargetTag); | 221 WriteTaggedPC(pc_delta, kCodeTargetTag); |
222 } else if (RelocInfo::IsPosition(rmode)) { | 222 } else if (RelocInfo::IsPosition(rmode)) { |
223 // Use signed delta-encoding for data. | 223 // Use signed delta-encoding for data. |
224 intptr_t data_delta = rinfo->data() - last_data_; | 224 intptr_t data_delta = rinfo->data() - last_data_; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); | 740 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); |
741 } | 741 } |
742 | 742 |
743 | 743 |
744 ExternalReference ExternalReference::debug_step_in_fp_address() { | 744 ExternalReference ExternalReference::debug_step_in_fp_address() { |
745 return ExternalReference(Debug::step_in_fp_addr()); | 745 return ExternalReference(Debug::step_in_fp_addr()); |
746 } | 746 } |
747 #endif | 747 #endif |
748 | 748 |
749 } } // namespace v8::internal | 749 } } // namespace v8::internal |
OLD | NEW |