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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 static unsigned supported_; | 502 static unsigned supported_; |
503 static unsigned enabled_; | 503 static unsigned enabled_; |
504 static unsigned found_by_runtime_probing_; | 504 static unsigned found_by_runtime_probing_; |
505 }; | 505 }; |
506 | 506 |
507 | 507 |
508 typedef int32_t Instr; | 508 typedef int32_t Instr; |
509 | 509 |
510 | 510 |
511 extern const Instr kMovLrPc; | 511 extern const Instr kMovLrPc; |
| 512 extern const Instr kLdrPCMask; |
512 extern const Instr kLdrPCPattern; | 513 extern const Instr kLdrPCPattern; |
| 514 extern const Instr kBlxRegMask; |
| 515 extern const Instr kBlxRegPattern; |
513 | 516 |
514 | 517 |
515 class Assembler : public Malloced { | 518 class Assembler : public Malloced { |
516 public: | 519 public: |
517 // Create an assembler. Instructions and relocation information are emitted | 520 // Create an assembler. Instructions and relocation information are emitted |
518 // into a buffer, with the instructions starting from the beginning and the | 521 // into a buffer, with the instructions starting from the beginning and the |
519 // relocation information starting from the end of the buffer. See CodeDesc | 522 // relocation information starting from the end of the buffer. See CodeDesc |
520 // for a detailed comment on the layout (globals.h). | 523 // for a detailed comment on the layout (globals.h). |
521 // | 524 // |
522 // If the provided buffer is NULL, the assembler allocates and grows its own | 525 // If the provided buffer is NULL, the assembler allocates and grows its own |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 // Here we are patching the address in the constant pool, not the actual call | 586 // Here we are patching the address in the constant pool, not the actual call |
584 // instruction. The address in the constant pool is the same size as a | 587 // instruction. The address in the constant pool is the same size as a |
585 // pointer. | 588 // pointer. |
586 static const int kCallTargetSize = kPointerSize; | 589 static const int kCallTargetSize = kPointerSize; |
587 static const int kExternalTargetSize = kPointerSize; | 590 static const int kExternalTargetSize = kPointerSize; |
588 | 591 |
589 // Size of an instruction. | 592 // Size of an instruction. |
590 static const int kInstrSize = sizeof(Instr); | 593 static const int kInstrSize = sizeof(Instr); |
591 | 594 |
592 // Distance between the instruction referring to the address of the call | 595 // Distance between the instruction referring to the address of the call |
593 // target (ldr pc, [target addr in const pool]) and the return address | 596 // target and the return address. |
| 597 #ifdef USE_BLX |
| 598 // Call sequence is: |
| 599 // ldr ip, [pc, #...] @ call address |
| 600 // blx ip |
| 601 // @ return address |
| 602 static const int kCallTargetAddressOffset = 2 * kInstrSize; |
| 603 #else |
| 604 // Call sequence is: |
| 605 // mov lr, pc |
| 606 // ldr pc, [pc, #...] @ call address |
| 607 // @ return address |
594 static const int kCallTargetAddressOffset = kInstrSize; | 608 static const int kCallTargetAddressOffset = kInstrSize; |
| 609 #endif |
595 | 610 |
596 // Distance between start of patched return sequence and the emitted address | 611 // Distance between start of patched return sequence and the emitted address |
597 // to jump to. | 612 // to jump to. |
598 static const int kPatchReturnSequenceAddressOffset = kInstrSize; | 613 #ifdef USE_BLX |
| 614 // Return sequence is: |
| 615 // ldr ip, [pc, #0] @ emited address and start |
| 616 // blx ip |
| 617 static const int kPatchReturnSequenceAddressOffset = 0 * kInstrSize; |
| 618 #else |
| 619 // Return sequence is: |
| 620 // mov lr, pc @ start of sequence |
| 621 // ldr pc, [pc, #-4] @ emited address |
| 622 static const int kPatchReturnSequenceAddressOffset = kInstrSize; |
| 623 #endif |
599 | 624 |
600 // Difference between address of current opcode and value read from pc | 625 // Difference between address of current opcode and value read from pc |
601 // register. | 626 // register. |
602 static const int kPcLoadDelta = 8; | 627 static const int kPcLoadDelta = 8; |
603 | 628 |
604 static const int kJSReturnSequenceLength = 4; | 629 static const int kJSReturnSequenceLength = 4; |
605 | 630 |
606 // --------------------------------------------------------------------------- | 631 // --------------------------------------------------------------------------- |
607 // Code generation | 632 // Code generation |
608 | 633 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1052 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
1028 | 1053 |
1029 friend class RegExpMacroAssemblerARM; | 1054 friend class RegExpMacroAssemblerARM; |
1030 friend class RelocInfo; | 1055 friend class RelocInfo; |
1031 friend class CodePatcher; | 1056 friend class CodePatcher; |
1032 }; | 1057 }; |
1033 | 1058 |
1034 } } // namespace v8::internal | 1059 } } // namespace v8::internal |
1035 | 1060 |
1036 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1061 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |