| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe | 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe |
| 6 // Please update the (git) revision if we merge changes from Dart. | 6 // Please update the (git) revision if we merge changes from Dart. |
| 7 // https://code.google.com/p/dart/wiki/GettingTheSource | 7 // https://code.google.com/p/dart/wiki/GettingTheSource |
| 8 | 8 |
| 9 #ifndef VM_ASSEMBLER_ARM_H_ | 9 #ifndef VM_ASSEMBLER_ARM_H_ |
| 10 #define VM_ASSEMBLER_ARM_H_ | 10 #define VM_ASSEMBLER_ARM_H_ |
| 11 | 11 |
| 12 #ifndef VM_ASSEMBLER_H_ | 12 #ifndef VM_ASSEMBLER_H_ |
| 13 #error Do not include assembler_arm.h directly; use assembler.h instead. | 13 #error Do not include assembler_arm.h directly; use assembler.h instead. |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 #include "platform/assert.h" | 16 #include "platform/assert.h" |
| 17 #include "platform/utils.h" | 17 #include "platform/utils.h" |
| 18 #include "vm/constants_arm.h" | 18 #include "vm/constants_arm.h" |
| 19 #include "vm/cpu.h" | 19 #include "vm/cpu.h" |
| 20 #include "vm/hash_map.h" | 20 #include "vm/hash_map.h" |
| 21 #include "vm/object.h" | 21 #include "vm/object.h" |
| 22 #include "vm/simulator.h" | 22 #include "vm/simulator.h" |
| 23 | 23 |
| 24 namespace dart { | 24 namespace dart { |
| 25 | 25 |
| 26 // Forward declarations. | 26 // Forward declarations. |
| 27 class RuntimeEntry; | 27 class RuntimeEntry; |
| 28 class StubEntry; | 28 class StubEntry; |
| 29 | 29 |
| 30 | 30 #if 0 |
| 31 // Moved to: ARM32::AssemblerARM32. |
| 31 // Instruction encoding bits. | 32 // Instruction encoding bits. |
| 32 enum { | 33 enum { |
| 33 H = 1 << 5, // halfword (or byte) | 34 H = 1 << 5, // halfword (or byte) |
| 34 L = 1 << 20, // load (or store) | 35 L = 1 << 20, // load (or store) |
| 35 S = 1 << 20, // set condition code (or leave unchanged) | 36 S = 1 << 20, // set condition code (or leave unchanged) |
| 36 W = 1 << 21, // writeback base register (or leave unchanged) | 37 W = 1 << 21, // writeback base register (or leave unchanged) |
| 37 A = 1 << 21, // accumulate in multiply instruction (or not) | 38 A = 1 << 21, // accumulate in multiply instruction (or not) |
| 38 B = 1 << 22, // unsigned byte (or word) | 39 B = 1 << 22, // unsigned byte (or word) |
| 39 D = 1 << 22, // high/lo bit of start of s/d register range | 40 D = 1 << 22, // high/lo bit of start of s/d register range |
| 40 N = 1 << 22, // long (or short) | 41 N = 1 << 22, // long (or short) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 61 B19 = 1 << 19, | 62 B19 = 1 << 19, |
| 62 B20 = 1 << 20, | 63 B20 = 1 << 20, |
| 63 B21 = 1 << 21, | 64 B21 = 1 << 21, |
| 64 B22 = 1 << 22, | 65 B22 = 1 << 22, |
| 65 B23 = 1 << 23, | 66 B23 = 1 << 23, |
| 66 B24 = 1 << 24, | 67 B24 = 1 << 24, |
| 67 B25 = 1 << 25, | 68 B25 = 1 << 25, |
| 68 B26 = 1 << 26, | 69 B26 = 1 << 26, |
| 69 B27 = 1 << 27, | 70 B27 = 1 << 27, |
| 70 }; | 71 }; |
| 71 | 72 #endif |
| 72 | 73 |
| 73 class Label : public ValueObject { | 74 class Label : public ValueObject { |
| 74 public: | 75 public: |
| 75 Label() : position_(0) { } | 76 Label() : position_(0) { } |
| 76 | 77 |
| 77 ~Label() { | 78 ~Label() { |
| 78 // Assert if label is being destroyed with unresolved branches pending. | 79 // Assert if label is being destroyed with unresolved branches pending. |
| 79 ASSERT(!IsLinked()); | 80 ASSERT(!IsLinked()); |
| 80 } | 81 } |
| 81 | 82 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 void stm(BlockAddressMode am, Register base, | 526 void stm(BlockAddressMode am, Register base, |
| 526 RegList regs, Condition cond = AL); | 527 RegList regs, Condition cond = AL); |
| 527 | 528 |
| 528 void ldrex(Register rd, Register rn, Condition cond = AL); | 529 void ldrex(Register rd, Register rn, Condition cond = AL); |
| 529 void strex(Register rd, Register rt, Register rn, Condition cond = AL); | 530 void strex(Register rd, Register rt, Register rn, Condition cond = AL); |
| 530 | 531 |
| 531 // Miscellaneous instructions. | 532 // Miscellaneous instructions. |
| 532 void clrex(); | 533 void clrex(); |
| 533 void nop(Condition cond = AL); | 534 void nop(Condition cond = AL); |
| 534 | 535 |
| 536 #if 0 |
| 537 // Moved to: ARM32::AssemblerARM32. |
| 535 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. | 538 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. |
| 536 void bkpt(uint16_t imm16); | 539 void bkpt(uint16_t imm16); |
| 537 | 540 |
| 538 static int32_t BkptEncoding(uint16_t imm16) { | 541 static int32_t BkptEncoding(uint16_t imm16) { |
| 539 // bkpt requires that the cond field is AL. | 542 // bkpt requires that the cond field is AL. |
| 540 return (AL << kConditionShift) | B24 | B21 | | 543 return (AL << kConditionShift) | B24 | B21 | |
| 541 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); | 544 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); |
| 542 } | 545 } |
| 546 #endif |
| 543 | 547 |
| 544 static uword GetBreakInstructionFiller() { | 548 static uword GetBreakInstructionFiller() { |
| 545 return BkptEncoding(0); | 549 return BkptEncoding(0); |
| 546 } | 550 } |
| 547 | 551 |
| 548 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). | 552 // Floating point instructions (VFPv3-D16 and VFPv3-D32 profiles). |
| 549 void vmovsr(SRegister sn, Register rt, Condition cond = AL); | 553 void vmovsr(SRegister sn, Register rt, Condition cond = AL); |
| 550 void vmovrs(Register rt, SRegister sn, Condition cond = AL); | 554 void vmovrs(Register rt, SRegister sn, Condition cond = AL); |
| 551 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); | 555 void vmovsrr(SRegister sm, Register rt, Register rt2, Condition cond = AL); |
| 552 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); | 556 void vmovrrs(Register rt, Register rt2, SRegister sm, Condition cond = AL); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 // a list of 'length' registers starting with dn. The result is placed in dd. | 657 // a list of 'length' registers starting with dn. The result is placed in dd. |
| 654 void vtbl(DRegister dd, DRegister dn, int length, DRegister dm); | 658 void vtbl(DRegister dd, DRegister dn, int length, DRegister dm); |
| 655 | 659 |
| 656 // The words of qd and qm are interleaved with the low words of the result | 660 // The words of qd and qm are interleaved with the low words of the result |
| 657 // in qd and the high words in qm. | 661 // in qd and the high words in qm. |
| 658 void vzipqw(QRegister qd, QRegister qm); | 662 void vzipqw(QRegister qd, QRegister qm); |
| 659 | 663 |
| 660 // Branch instructions. | 664 // Branch instructions. |
| 661 void b(Label* label, Condition cond = AL); | 665 void b(Label* label, Condition cond = AL); |
| 662 void bl(Label* label, Condition cond = AL); | 666 void bl(Label* label, Condition cond = AL); |
| 667 #if 0 |
| 668 // Moved to: ARM32::AssemblerARM32. |
| 663 void bx(Register rm, Condition cond = AL); | 669 void bx(Register rm, Condition cond = AL); |
| 670 #endif |
| 664 void blx(Register rm, Condition cond = AL); | 671 void blx(Register rm, Condition cond = AL); |
| 665 | 672 |
| 666 void Branch(const StubEntry& stub_entry, | 673 void Branch(const StubEntry& stub_entry, |
| 667 Patchability patchable = kNotPatchable, | 674 Patchability patchable = kNotPatchable, |
| 668 Register pp = PP, | 675 Register pp = PP, |
| 669 Condition cond = AL); | 676 Condition cond = AL); |
| 670 | 677 |
| 671 void BranchLink(const StubEntry& stub_entry, | 678 void BranchLink(const StubEntry& stub_entry, |
| 672 Patchability patchable = kNotPatchable); | 679 Patchability patchable = kNotPatchable); |
| 673 void BranchLink(const Code& code, Patchability patchable); | 680 void BranchLink(const Code& code, Patchability patchable); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 Register new_value, | 1212 Register new_value, |
| 1206 FieldContent old_content); | 1213 FieldContent old_content); |
| 1207 | 1214 |
| 1208 DISALLOW_ALLOCATION(); | 1215 DISALLOW_ALLOCATION(); |
| 1209 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1216 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1210 }; | 1217 }; |
| 1211 | 1218 |
| 1212 } // namespace dart | 1219 } // namespace dart |
| 1213 | 1220 |
| 1214 #endif // VM_ASSEMBLER_ARM_H_ | 1221 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |