| 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 #ifndef VM_ASSEMBLER_MIPS_H_ | 5 #ifndef VM_ASSEMBLER_MIPS_H_ |
| 6 #define VM_ASSEMBLER_MIPS_H_ | 6 #define VM_ASSEMBLER_MIPS_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_mips.h directly; use assembler.h instead. | 9 #error Do not include assembler_mips.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 public: | 94 public: |
| 95 Label() : position_(0) { } | 95 Label() : position_(0) { } |
| 96 | 96 |
| 97 ~Label() { | 97 ~Label() { |
| 98 // Assert if label is being destroyed with unresolved branches pending. | 98 // Assert if label is being destroyed with unresolved branches pending. |
| 99 ASSERT(!IsLinked()); | 99 ASSERT(!IsLinked()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 // Returns the position for bound and linked labels. Cannot be used | 102 // Returns the position for bound and linked labels. Cannot be used |
| 103 // for unused labels. | 103 // for unused labels. |
| 104 int Position() const { | 104 intptr_t Position() const { |
| 105 ASSERT(!IsUnused()); | 105 ASSERT(!IsUnused()); |
| 106 return IsBound() ? -position_ - kWordSize : position_ - kWordSize; | 106 return IsBound() ? -position_ - kWordSize : position_ - kWordSize; |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool IsBound() const { return position_ < 0; } | 109 bool IsBound() const { return position_ < 0; } |
| 110 bool IsUnused() const { return position_ == 0; } | 110 bool IsUnused() const { return position_ == 0; } |
| 111 bool IsLinked() const { return position_ > 0; } | 111 bool IsLinked() const { return position_ > 0; } |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 int position_; | 114 intptr_t position_; |
| 115 | 115 |
| 116 void Reinitialize() { | 116 void Reinitialize() { |
| 117 position_ = 0; | 117 position_ = 0; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void BindTo(int position) { | 120 void BindTo(intptr_t position) { |
| 121 ASSERT(!IsBound()); | 121 ASSERT(!IsBound()); |
| 122 position_ = -position - kWordSize; | 122 position_ = -position - kWordSize; |
| 123 ASSERT(IsBound()); | 123 ASSERT(IsBound()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void LinkTo(int position) { | 126 void LinkTo(intptr_t position) { |
| 127 ASSERT(!IsBound()); | 127 ASSERT(!IsBound()); |
| 128 position_ = position + kWordSize; | 128 position_ = position + kWordSize; |
| 129 ASSERT(IsLinked()); | 129 ASSERT(IsLinked()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 friend class Assembler; | 132 friend class Assembler; |
| 133 DISALLOW_COPY_AND_ASSIGN(Label); | 133 DISALLOW_COPY_AND_ASSIGN(Label); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 | 136 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 153 delay_slot_available_(false), | 153 delay_slot_available_(false), |
| 154 in_delay_slot_(false), | 154 in_delay_slot_(false), |
| 155 comments_() { } | 155 comments_() { } |
| 156 ~Assembler() { } | 156 ~Assembler() { } |
| 157 | 157 |
| 158 void PopRegister(Register r) { Pop(r); } | 158 void PopRegister(Register r) { Pop(r); } |
| 159 | 159 |
| 160 void Bind(Label* label); | 160 void Bind(Label* label); |
| 161 | 161 |
| 162 // Misc. functionality | 162 // Misc. functionality |
| 163 int CodeSize() const { return buffer_.Size(); } | 163 intptr_t CodeSize() const { return buffer_.Size(); } |
| 164 int prologue_offset() const { return prologue_offset_; } | 164 intptr_t prologue_offset() const { return prologue_offset_; } |
| 165 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 165 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const { |
| 166 return buffer_.pointer_offsets(); | 166 return buffer_.pointer_offsets(); |
| 167 } | 167 } |
| 168 const GrowableObjectArray& object_pool() const { return object_pool_; } | 168 const GrowableObjectArray& object_pool() const { return object_pool_; } |
| 169 void FinalizeInstructions(const MemoryRegion& region) { | 169 void FinalizeInstructions(const MemoryRegion& region) { |
| 170 buffer_.FinalizeInstructions(region); | 170 buffer_.FinalizeInstructions(region); |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool use_far_branches() const { | 173 bool use_far_branches() const { |
| 174 return FLAG_use_far_branches || use_far_branches_; | 174 return FLAG_use_far_branches || use_far_branches_; |
| 175 } | 175 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 199 // Debugging and bringup support. | 199 // Debugging and bringup support. |
| 200 void Stop(const char* message); | 200 void Stop(const char* message); |
| 201 | 201 |
| 202 // TODO(zra): TraceSimMsg enables printing of helpful messages when | 202 // TODO(zra): TraceSimMsg enables printing of helpful messages when |
| 203 // --trace_sim is given. Eventually these calls will be changed to Comment. | 203 // --trace_sim is given. Eventually these calls will be changed to Comment. |
| 204 void TraceSimMsg(const char* message); | 204 void TraceSimMsg(const char* message); |
| 205 void Unimplemented(const char* message); | 205 void Unimplemented(const char* message); |
| 206 void Untested(const char* message); | 206 void Untested(const char* message); |
| 207 void Unreachable(const char* message); | 207 void Unreachable(const char* message); |
| 208 | 208 |
| 209 static void InitializeMemoryWithBreakpoints(uword data, int length); | 209 static void InitializeMemoryWithBreakpoints(uword data, intptr_t length); |
| 210 | 210 |
| 211 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 211 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 212 | 212 |
| 213 const Code::Comments& GetCodeComments() const; | 213 const Code::Comments& GetCodeComments() const; |
| 214 | 214 |
| 215 static const char* RegisterName(Register reg); | 215 static const char* RegisterName(Register reg); |
| 216 | 216 |
| 217 static const char* FpuRegisterName(FpuRegister reg); | 217 static const char* FpuRegisterName(FpuRegister reg); |
| 218 | 218 |
| 219 void SetPrologueOffset() { | 219 void SetPrologueOffset() { |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 void LeaveDartFrameAndReturn(); | 1123 void LeaveDartFrameAndReturn(); |
| 1124 | 1124 |
| 1125 // Set up a Dart frame for a function compiled for on-stack replacement. | 1125 // Set up a Dart frame for a function compiled for on-stack replacement. |
| 1126 // The frame layout is a normal Dart frame, but the frame is partially set | 1126 // The frame layout is a normal Dart frame, but the frame is partially set |
| 1127 // up on entry (it is the frame of the unoptimized code). | 1127 // up on entry (it is the frame of the unoptimized code). |
| 1128 void EnterOsrFrame(intptr_t extra_size); | 1128 void EnterOsrFrame(intptr_t extra_size); |
| 1129 | 1129 |
| 1130 private: | 1130 private: |
| 1131 AssemblerBuffer buffer_; | 1131 AssemblerBuffer buffer_; |
| 1132 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 1132 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
| 1133 int prologue_offset_; | 1133 intptr_t prologue_offset_; |
| 1134 | 1134 |
| 1135 const bool use_far_branches_; | 1135 const bool use_far_branches_; |
| 1136 bool delay_slot_available_; | 1136 bool delay_slot_available_; |
| 1137 bool in_delay_slot_; | 1137 bool in_delay_slot_; |
| 1138 | 1138 |
| 1139 int32_t AddObject(const Object& obj); | 1139 int32_t AddObject(const Object& obj); |
| 1140 int32_t AddExternalLabel(const ExternalLabel* label); | 1140 int32_t AddExternalLabel(const ExternalLabel* label); |
| 1141 | 1141 |
| 1142 class CodeComment : public ZoneAllocated { | 1142 class CodeComment : public ZoneAllocated { |
| 1143 public: | 1143 public: |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 Register value, | 1255 Register value, |
| 1256 Label* no_update); | 1256 Label* no_update); |
| 1257 | 1257 |
| 1258 DISALLOW_ALLOCATION(); | 1258 DISALLOW_ALLOCATION(); |
| 1259 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1259 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1260 }; | 1260 }; |
| 1261 | 1261 |
| 1262 } // namespace dart | 1262 } // namespace dart |
| 1263 | 1263 |
| 1264 #endif // VM_ASSEMBLER_MIPS_H_ | 1264 #endif // VM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |