OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ | 28 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ |
29 #define V8_X64_ASSEMBLER_X64_INL_H_ | 29 #define V8_X64_ASSEMBLER_X64_INL_H_ |
30 | 30 |
31 #include "cpu.h" | 31 #include "cpu.h" |
| 32 #include "debug.h" |
32 #include "memory.h" | 33 #include "memory.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 inline Condition NegateCondition(Condition cc) { | 38 inline Condition NegateCondition(Condition cc) { |
38 return static_cast<Condition>(cc ^ 1); | 39 return static_cast<Condition>(cc ^ 1); |
39 } | 40 } |
40 | 41 |
41 | 42 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 223 } |
223 } | 224 } |
224 | 225 |
225 | 226 |
226 Address RelocInfo::target_address_address() { | 227 Address RelocInfo::target_address_address() { |
227 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 228 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
228 return reinterpret_cast<Address>(pc_); | 229 return reinterpret_cast<Address>(pc_); |
229 } | 230 } |
230 | 231 |
231 | 232 |
| 233 int RelocInfo::target_address_size() { |
| 234 if (IsCodedSpecially()) { |
| 235 return Assembler::kCallTargetSize; |
| 236 } else { |
| 237 return Assembler::kExternalTargetSize; |
| 238 } |
| 239 } |
| 240 |
| 241 |
232 void RelocInfo::set_target_address(Address target) { | 242 void RelocInfo::set_target_address(Address target) { |
233 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 243 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
234 if (IsCodeTarget(rmode_)) { | 244 if (IsCodeTarget(rmode_)) { |
235 Assembler::set_target_address_at(pc_, target); | 245 Assembler::set_target_address_at(pc_, target); |
236 } else { | 246 } else { |
237 Memory::Address_at(pc_) = target; | 247 Memory::Address_at(pc_) = target; |
238 } | 248 } |
239 } | 249 } |
240 | 250 |
241 | 251 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 *call_object_address() = target; | 323 *call_object_address() = target; |
314 } | 324 } |
315 | 325 |
316 | 326 |
317 Object** RelocInfo::call_object_address() { | 327 Object** RelocInfo::call_object_address() { |
318 ASSERT(IsPatchedReturnSequence()); | 328 ASSERT(IsPatchedReturnSequence()); |
319 return reinterpret_cast<Object**>( | 329 return reinterpret_cast<Object**>( |
320 pc_ + Assembler::kPatchReturnSequenceAddressOffset); | 330 pc_ + Assembler::kPatchReturnSequenceAddressOffset); |
321 } | 331 } |
322 | 332 |
| 333 |
| 334 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 335 RelocInfo::Mode mode = rmode(); |
| 336 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 337 visitor->VisitPointer(target_object_address()); |
| 338 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 339 visitor->VisitCodeTarget(this); |
| 340 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 341 visitor->VisitExternalReference(target_reference_address()); |
| 342 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 343 } else if (Debug::has_break_points() && |
| 344 RelocInfo::IsJSReturn(mode) && |
| 345 IsPatchedReturnSequence()) { |
| 346 visitor->VisitDebugTarget(this); |
| 347 #endif |
| 348 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 349 visitor->VisitRuntimeEntry(this); |
| 350 } |
| 351 } |
| 352 |
| 353 |
323 // ----------------------------------------------------------------------------- | 354 // ----------------------------------------------------------------------------- |
324 // Implementation of Operand | 355 // Implementation of Operand |
325 | 356 |
326 void Operand::set_modrm(int mod, Register rm_reg) { | 357 void Operand::set_modrm(int mod, Register rm_reg) { |
327 ASSERT(is_uint2(mod)); | 358 ASSERT(is_uint2(mod)); |
328 buf_[0] = mod << 6 | rm_reg.low_bits(); | 359 buf_[0] = mod << 6 | rm_reg.low_bits(); |
329 // Set REX.B to the high bit of rm.code(). | 360 // Set REX.B to the high bit of rm.code(). |
330 rex_ |= rm_reg.high_bit(); | 361 rex_ |= rm_reg.high_bit(); |
331 } | 362 } |
332 | 363 |
(...skipping 21 matching lines...) Expand all Loading... |
354 ASSERT(len_ == 1 || len_ == 2); | 385 ASSERT(len_ == 1 || len_ == 2); |
355 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 386 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
356 *p = disp; | 387 *p = disp; |
357 len_ += sizeof(int32_t); | 388 len_ += sizeof(int32_t); |
358 } | 389 } |
359 | 390 |
360 | 391 |
361 } } // namespace v8::internal | 392 } } // namespace v8::internal |
362 | 393 |
363 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 394 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |