Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 | 44 |
| 45 static const byte kCallOpcode = 0xE8; | 45 static const byte kCallOpcode = 0xE8; |
| 46 | 46 |
| 47 | 47 |
| 48 void Assembler::emitl(uint32_t x) { | 48 void Assembler::emitl(uint32_t x) { |
| 49 Memory::uint32_at(pc_) = x; | 49 Memory::uint32_at(pc_) = x; |
| 50 pc_ += sizeof(uint32_t); | 50 pc_ += sizeof(uint32_t); |
| 51 } | 51 } |
| 52 | 52 |
| 53 | 53 |
| 54 #ifdef V8_TARGET_ARCH_X32 | |
| 55 void Assembler::emitl(uint32_t x, RelocInfo::Mode rmode) { | |
| 56 Memory::uint32_at(pc_) = x; | |
| 57 if (!RelocInfo::IsNone(rmode)) { | |
| 58 RecordRelocInfo(rmode, x); | |
| 59 } | |
| 60 pc_ += sizeof(uint32_t); | |
| 61 } | |
| 62 #endif | |
| 63 | |
| 64 | |
| 54 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { | 65 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { |
|
danno
2013/07/17 13:33:21
does it make sense to turn this into emit(intptr_t
| |
| 55 Memory::uint64_at(pc_) = x; | 66 Memory::uint64_at(pc_) = x; |
| 67 #ifndef V8_TARGET_ARCH_X32 | |
| 56 if (!RelocInfo::IsNone(rmode)) { | 68 if (!RelocInfo::IsNone(rmode)) { |
| 57 RecordRelocInfo(rmode, x); | 69 RecordRelocInfo(rmode, x); |
| 58 } | 70 } |
| 71 #else | |
| 72 ASSERT(RelocInfo::IsNone(rmode)); | |
| 73 #endif | |
| 59 pc_ += sizeof(uint64_t); | 74 pc_ += sizeof(uint64_t); |
| 60 } | 75 } |
| 61 | 76 |
| 62 | 77 |
| 63 void Assembler::emitw(uint16_t x) { | 78 void Assembler::emitw(uint16_t x) { |
| 64 Memory::uint16_at(pc_) = x; | 79 Memory::uint16_at(pc_) = x; |
| 65 pc_ += sizeof(uint16_t); | 80 pc_ += sizeof(uint16_t); |
| 66 } | 81 } |
| 67 | 82 |
| 68 | 83 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 | 377 |
| 363 | 378 |
| 364 bool RelocInfo::IsPatchedReturnSequence() { | 379 bool RelocInfo::IsPatchedReturnSequence() { |
| 365 // The recognized call sequence is: | 380 // The recognized call sequence is: |
| 366 // movq(kScratchRegister, immediate64); call(kScratchRegister); | 381 // movq(kScratchRegister, immediate64); call(kScratchRegister); |
| 367 // It only needs to be distinguished from a return sequence | 382 // It only needs to be distinguished from a return sequence |
| 368 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 | 383 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 |
| 369 // The 11th byte is int3 (0xCC) in the return sequence and | 384 // The 11th byte is int3 (0xCC) in the return sequence and |
| 370 // REX.WB (0x48+register bit) for the call sequence. | 385 // REX.WB (0x48+register bit) for the call sequence. |
| 371 #ifdef ENABLE_DEBUGGER_SUPPORT | 386 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 387 #ifndef V8_TARGET_ARCH_X32 | |
| 372 return pc_[10] != 0xCC; | 388 return pc_[10] != 0xCC; |
|
danno
2013/07/17 13:33:21
Cant this be one version with pc_[2 + kRegisterSiz
| |
| 373 #else | 389 #else |
| 390 // The recognized call sequence is: | |
| 391 // movl(kScratchRegister, immediate32); call(kScratchRegister); | |
| 392 // It only needs to be distinguished from a return sequence | |
| 393 // movl(rsp, rbp); pop(rbp); ret(n); int3 *3 | |
| 394 // The 7th byte is int3 (0xCC) in the return sequence and | |
| 395 // call (0x41) for the call sequence. | |
| 396 return pc_[6] != 0xCC; | |
| 397 #endif | |
| 398 #else | |
| 374 return false; | 399 return false; |
| 375 #endif | 400 #endif |
| 376 } | 401 } |
| 377 | 402 |
| 378 | 403 |
| 379 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 404 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { |
| 380 return !Assembler::IsNop(pc()); | 405 return !Assembler::IsNop(pc()); |
| 381 } | 406 } |
| 382 | 407 |
| 383 | 408 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 ASSERT(len_ == 1 || len_ == 2); | 554 ASSERT(len_ == 1 || len_ == 2); |
| 530 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 555 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 531 *p = disp; | 556 *p = disp; |
| 532 len_ += sizeof(int32_t); | 557 len_ += sizeof(int32_t); |
| 533 } | 558 } |
| 534 | 559 |
| 535 | 560 |
| 536 } } // namespace v8::internal | 561 } } // namespace v8::internal |
| 537 | 562 |
| 538 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 563 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |