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). | |
| 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; } |
| 63 bool HasNear() const { return false; } | |
|
Ivan Posva
2013/01/16 01:17:56
Does ARM have near branches?
regis
2013/01/16 01:55:07
No, but FlowGraphCompiler::~FlowGraphCompiler() is
| |
| 64 | |
| 36 | 65 |
| 37 private: | 66 private: |
| 38 int position_; | 67 int position_; |
| 39 | 68 |
| 40 void Reinitialize() { | 69 void Reinitialize() { |
| 41 position_ = 0; | 70 position_ = 0; |
| 42 } | 71 } |
| 43 | 72 |
| 44 void BindTo(int position) { | 73 void BindTo(int position) { |
| 45 ASSERT(!IsBound()); | 74 ASSERT(!IsBound()); |
| 46 position_ = -position - kWordSize; | 75 position_ = -position - kWordSize; |
| 47 ASSERT(IsBound()); | 76 ASSERT(IsBound()); |
| 48 } | 77 } |
| 49 | 78 |
| 50 void LinkTo(int position) { | 79 void LinkTo(int position) { |
| 51 ASSERT(!IsBound()); | 80 ASSERT(!IsBound()); |
| 52 position_ = position + kWordSize; | 81 position_ = position + kWordSize; |
| 53 ASSERT(IsLinked()); | 82 ASSERT(IsLinked()); |
| 54 } | 83 } |
| 55 | 84 |
| 56 friend class Assembler; | 85 friend class Assembler; |
| 57 DISALLOW_COPY_AND_ASSIGN(Label); | 86 DISALLOW_COPY_AND_ASSIGN(Label); |
| 58 }; | 87 }; |
| 59 | 88 |
| 60 | 89 |
| 61 class Assembler { | 90 class CPUFeatures : public AllStatic { |
| 62 public: | 91 public: |
| 63 Assembler() { } | 92 static void InitOnce() { } |
| 93 static bool sse2_supported() { return false; } | |
|
Ivan Posva
2013/01/16 01:17:56
This makes no sense for ARM, it needs to be taken
regis
2013/01/16 01:55:07
This is used by the flow_graph_optimizer, which I
| |
| 94 static bool sse4_1_supported() { return false; } | |
| 95 }; | |
| 96 | |
| 97 | |
| 98 class Assembler : public ValueObject { | |
| 99 public: | |
| 100 Assembler() { UNIMPLEMENTED(); } | |
| 64 ~Assembler() { } | 101 ~Assembler() { } |
| 65 | 102 |
| 66 // Macros for High-level operations. | 103 void PopRegister(Register r) { |
| 67 void AddConstant(Register reg, int value, Condition cond = AL) { | 104 UNIMPLEMENTED(); |
| 105 } | |
| 106 | |
| 107 void Bind(Label* label) { | |
| 68 UNIMPLEMENTED(); | 108 UNIMPLEMENTED(); |
| 69 } | 109 } |
| 70 | 110 |
| 71 // Misc. functionality | 111 // Misc. functionality |
| 72 int CodeSize() const { | 112 int CodeSize() const { |
| 73 UNIMPLEMENTED(); | 113 UNIMPLEMENTED(); |
| 74 return 0; | 114 return 0; |
| 75 } | 115 } |
| 76 int prologue_offset() const { | 116 int prologue_offset() const { |
| 77 UNIMPLEMENTED(); | 117 UNIMPLEMENTED(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 88 // Debugging and bringup support. | 128 // Debugging and bringup support. |
| 89 void Stop(const char* message) { UNIMPLEMENTED(); } | 129 void Stop(const char* message) { UNIMPLEMENTED(); } |
| 90 void Unimplemented(const char* message); | 130 void Unimplemented(const char* message); |
| 91 void Untested(const char* message); | 131 void Untested(const char* message); |
| 92 void Unreachable(const char* message); | 132 void Unreachable(const char* message); |
| 93 | 133 |
| 94 static void InitializeMemoryWithBreakpoints(uword data, int length) { | 134 static void InitializeMemoryWithBreakpoints(uword data, int length) { |
| 95 UNIMPLEMENTED(); | 135 UNIMPLEMENTED(); |
| 96 } | 136 } |
| 97 | 137 |
| 138 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3) { | |
| 139 UNIMPLEMENTED(); | |
| 140 } | |
| 141 | |
| 142 const Code::Comments& GetCodeComments() const { | |
| 143 UNIMPLEMENTED(); | |
| 144 return Code::Comments::New(0); | |
| 145 } | |
| 146 | |
| 147 static const char* RegisterName(Register reg) { | |
| 148 UNIMPLEMENTED(); | |
| 149 return NULL; | |
| 150 } | |
| 151 | |
| 152 static const char* FpuRegisterName(DRegister reg) { | |
| 153 UNIMPLEMENTED(); | |
| 154 return NULL; | |
| 155 } | |
| 156 | |
| 98 private: | 157 private: |
| 99 ZoneGrowableArray<int>* pointer_offsets_; | 158 ZoneGrowableArray<int>* pointer_offsets_; |
| 100 DISALLOW_ALLOCATION(); | 159 DISALLOW_ALLOCATION(); |
| 101 DISALLOW_COPY_AND_ASSIGN(Assembler); | 160 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 102 }; | 161 }; |
| 103 | 162 |
| 104 } // namespace dart | 163 } // namespace dart |
| 105 | 164 |
| 106 #endif // VM_ASSEMBLER_ARM_H_ | 165 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |