Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, 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 #ifndef VM_ASSEMBLER_ARM_H_ | 5 #ifndef VM_ASSEMBLER_ARM_H_ |
| 6 #define VM_ASSEMBLER_ARM_H_ | 6 #define VM_ASSEMBLER_ARM_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_arm.h directly; use assembler.h instead. | 9 #error Do not include assembler_arm.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
| 13 #include "vm/constants_arm.h" | 13 #include "vm/constants_arm.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 class Operand : public ValueObject { | |
| 18 protected: | |
| 19 // Operand can be sub classed (e.g: Address). | |
|
srdjan
2013/01/16 19:06:30
s/sub classes/ subclassed/
regis
2013/01/16 23:14:42
Done.
| |
| 20 Operand() { } | |
| 21 | |
| 22 private: | |
| 23 DISALLOW_ALLOCATION(); | |
| 24 }; | |
| 25 | |
| 26 | |
| 27 class Address : public Operand { | |
| 28 public: | |
| 29 Address(Register base, int32_t disp) { | |
| 30 UNIMPLEMENTED(); | |
| 31 } | |
| 32 private: | |
| 33 DISALLOW_ALLOCATION(); | |
| 34 }; | |
| 35 | |
| 36 | |
| 37 class FieldAddress : public Address { | |
| 38 public: | |
| 39 FieldAddress(Register base, int32_t disp) | |
| 40 : Address(base, disp - kHeapObjectTag) {} | |
| 41 }; | |
| 42 | |
| 43 | |
| 17 class Label : public ValueObject { | 44 class Label : public ValueObject { |
| 18 public: | 45 public: |
| 19 Label() : position_(0) { } | 46 Label() : position_(0) { } |
| 20 | 47 |
| 21 ~Label() { | 48 ~Label() { |
| 22 // Assert if label is being destroyed with unresolved branches pending. | 49 // Assert if label is being destroyed with unresolved branches pending. |
| 23 ASSERT(!IsLinked()); | 50 ASSERT(!IsLinked()); |
| 24 } | 51 } |
| 25 | 52 |
| 26 // Returns the position for bound and linked labels. Cannot be used | 53 // Returns the position for bound and linked labels. Cannot be used |
| 27 // for unused labels. | 54 // for unused labels. |
| 28 int Position() const { | 55 int Position() const { |
| 29 ASSERT(!IsUnused()); | 56 ASSERT(!IsUnused()); |
| 30 return IsBound() ? -position_ - kWordSize : position_ - kWordSize; | 57 return IsBound() ? -position_ - kWordSize : position_ - kWordSize; |
| 31 } | 58 } |
| 32 | 59 |
| 33 bool IsBound() const { return position_ < 0; } | 60 bool IsBound() const { return position_ < 0; } |
| 34 bool IsUnused() const { return position_ == 0; } | 61 bool IsUnused() const { return position_ == 0; } |
| 35 bool IsLinked() const { return position_ > 0; } | 62 bool IsLinked() const { return position_ > 0; } |
| 36 | 63 |
| 64 | |
|
srdjan
2013/01/16 19:06:30
delete line
regis
2013/01/16 23:14:42
Done.
| |
| 37 private: | 65 private: |
| 38 int position_; | 66 int position_; |
| 39 | 67 |
| 40 void Reinitialize() { | 68 void Reinitialize() { |
| 41 position_ = 0; | 69 position_ = 0; |
| 42 } | 70 } |
| 43 | 71 |
| 44 void BindTo(int position) { | 72 void BindTo(int position) { |
| 45 ASSERT(!IsBound()); | 73 ASSERT(!IsBound()); |
| 46 position_ = -position - kWordSize; | 74 position_ = -position - kWordSize; |
| 47 ASSERT(IsBound()); | 75 ASSERT(IsBound()); |
| 48 } | 76 } |
| 49 | 77 |
| 50 void LinkTo(int position) { | 78 void LinkTo(int position) { |
| 51 ASSERT(!IsBound()); | 79 ASSERT(!IsBound()); |
| 52 position_ = position + kWordSize; | 80 position_ = position + kWordSize; |
| 53 ASSERT(IsLinked()); | 81 ASSERT(IsLinked()); |
| 54 } | 82 } |
| 55 | 83 |
| 56 friend class Assembler; | 84 friend class Assembler; |
| 57 DISALLOW_COPY_AND_ASSIGN(Label); | 85 DISALLOW_COPY_AND_ASSIGN(Label); |
| 58 }; | 86 }; |
| 59 | 87 |
| 60 | 88 |
| 61 class Assembler { | 89 class CPUFeatures : public AllStatic { |
| 62 public: | 90 public: |
| 63 Assembler() { } | 91 static void InitOnce() { } |
| 92 }; | |
| 93 | |
| 94 | |
| 95 class Assembler : public ValueObject { | |
| 96 public: | |
| 97 Assembler() { UNIMPLEMENTED(); } | |
| 64 ~Assembler() { } | 98 ~Assembler() { } |
| 65 | 99 |
| 66 // Macros for High-level operations. | 100 void PopRegister(Register r) { |
| 67 void AddConstant(Register reg, int value, Condition cond = AL) { | 101 UNIMPLEMENTED(); |
| 102 } | |
| 103 | |
| 104 void Bind(Label* label) { | |
| 68 UNIMPLEMENTED(); | 105 UNIMPLEMENTED(); |
| 69 } | 106 } |
| 70 | 107 |
| 71 // Misc. functionality | 108 // Misc. functionality |
| 72 int CodeSize() const { | 109 int CodeSize() const { |
| 73 UNIMPLEMENTED(); | 110 UNIMPLEMENTED(); |
| 74 return 0; | 111 return 0; |
| 75 } | 112 } |
| 76 int prologue_offset() const { | 113 int prologue_offset() const { |
| 77 UNIMPLEMENTED(); | 114 UNIMPLEMENTED(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 88 // Debugging and bringup support. | 125 // Debugging and bringup support. |
| 89 void Stop(const char* message) { UNIMPLEMENTED(); } | 126 void Stop(const char* message) { UNIMPLEMENTED(); } |
| 90 void Unimplemented(const char* message); | 127 void Unimplemented(const char* message); |
| 91 void Untested(const char* message); | 128 void Untested(const char* message); |
| 92 void Unreachable(const char* message); | 129 void Unreachable(const char* message); |
| 93 | 130 |
| 94 static void InitializeMemoryWithBreakpoints(uword data, int length) { | 131 static void InitializeMemoryWithBreakpoints(uword data, int length) { |
| 95 UNIMPLEMENTED(); | 132 UNIMPLEMENTED(); |
| 96 } | 133 } |
| 97 | 134 |
| 135 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3) { | |
| 136 UNIMPLEMENTED(); | |
| 137 } | |
| 138 | |
| 139 const Code::Comments& GetCodeComments() const { | |
| 140 UNIMPLEMENTED(); | |
| 141 return Code::Comments::New(0); | |
| 142 } | |
| 143 | |
| 144 static const char* RegisterName(Register reg) { | |
| 145 UNIMPLEMENTED(); | |
| 146 return NULL; | |
| 147 } | |
| 148 | |
| 149 static const char* FpuRegisterName(FpuRegister reg) { | |
| 150 UNIMPLEMENTED(); | |
| 151 return NULL; | |
| 152 } | |
| 153 | |
| 98 private: | 154 private: |
| 99 ZoneGrowableArray<int>* pointer_offsets_; | 155 ZoneGrowableArray<int>* pointer_offsets_; |
| 100 DISALLOW_ALLOCATION(); | 156 DISALLOW_ALLOCATION(); |
| 101 DISALLOW_COPY_AND_ASSIGN(Assembler); | 157 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 102 }; | 158 }; |
| 103 | 159 |
| 104 } // namespace dart | 160 } // namespace dart |
| 105 | 161 |
| 106 #endif // VM_ASSEMBLER_ARM_H_ | 162 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |