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_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 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 FieldAddress& operator=(const FieldAddress& other) { | 256 FieldAddress& operator=(const FieldAddress& other) { |
257 Address::operator=(other); | 257 Address::operator=(other); |
258 return *this; | 258 return *this; |
259 } | 259 } |
260 }; | 260 }; |
261 | 261 |
262 | 262 |
263 class Assembler : public ValueObject { | 263 class Assembler : public ValueObject { |
264 public: | 264 public: |
265 Assembler() : buffer_(), prologue_offset_(-1), comments_() { } | 265 Assembler() |
| 266 : buffer_(), |
| 267 object_pool_(GrowableObjectArray::Handle(GrowableObjectArray::New())), |
| 268 prologue_offset_(-1), |
| 269 comments_() { } |
266 ~Assembler() { } | 270 ~Assembler() { } |
267 | 271 |
268 void PopRegister(Register r) { Pop(r); } | 272 void PopRegister(Register r) { Pop(r); } |
269 | 273 |
270 void Bind(Label* label); | 274 void Bind(Label* label); |
271 | 275 |
272 // Misc. functionality | 276 // Misc. functionality |
273 int CodeSize() const { return buffer_.Size(); } | 277 int CodeSize() const { return buffer_.Size(); } |
274 int prologue_offset() const { return prologue_offset_; } | 278 int prologue_offset() const { return prologue_offset_; } |
275 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 279 const ZoneGrowableArray<int>& GetPointerOffsets() const { |
| 280 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. |
276 return buffer_.pointer_offsets(); | 281 return buffer_.pointer_offsets(); |
277 } | 282 } |
| 283 const GrowableObjectArray& object_pool() const { |
| 284 return object_pool_; |
| 285 } |
278 | 286 |
279 void FinalizeInstructions(const MemoryRegion& region) { | 287 void FinalizeInstructions(const MemoryRegion& region) { |
280 buffer_.FinalizeInstructions(region); | 288 buffer_.FinalizeInstructions(region); |
| 289 ASSERT(object_pool_.Length() == 0); // TODO(regis): Otherwise, more work. |
281 } | 290 } |
282 | 291 |
283 // Debugging and bringup support. | 292 // Debugging and bringup support. |
284 void Stop(const char* message); | 293 void Stop(const char* message); |
285 void Unimplemented(const char* message); | 294 void Unimplemented(const char* message); |
286 void Untested(const char* message); | 295 void Untested(const char* message); |
287 void Unreachable(const char* message); | 296 void Unreachable(const char* message); |
288 | 297 |
289 static void InitializeMemoryWithBreakpoints(uword data, int length) { | 298 static void InitializeMemoryWithBreakpoints(uword data, int length); |
290 UNIMPLEMENTED(); | |
291 } | |
292 | 299 |
293 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 300 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
294 | 301 |
295 const Code::Comments& GetCodeComments() const; | 302 const Code::Comments& GetCodeComments() const; |
296 | 303 |
297 static const char* RegisterName(Register reg) { | 304 static const char* RegisterName(Register reg) { |
298 UNIMPLEMENTED(); | 305 UNIMPLEMENTED(); |
299 return NULL; | 306 return NULL; |
300 } | 307 } |
301 | 308 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 void Lsl(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 525 void Lsl(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
519 void Lsr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 526 void Lsr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
520 void Asr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 527 void Asr(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
521 void Ror(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); | 528 void Ror(Register rd, Register rm, uint32_t shift_imm, Condition cond = AL); |
522 void Rrx(Register rd, Register rm, Condition cond = AL); | 529 void Rrx(Register rd, Register rm, Condition cond = AL); |
523 | 530 |
524 // Emit data (e.g encoded instruction or immediate) in instruction stream. | 531 // Emit data (e.g encoded instruction or immediate) in instruction stream. |
525 void Emit(int32_t value); | 532 void Emit(int32_t value); |
526 | 533 |
527 private: | 534 private: |
528 AssemblerBuffer buffer_; | 535 AssemblerBuffer buffer_; // Contains position independent code. |
529 ZoneGrowableArray<int>* pointer_offsets_; | 536 const GrowableObjectArray& object_pool_; // Objects and jump targets. |
530 int prologue_offset_; | 537 int32_t prologue_offset_; |
| 538 |
| 539 int32_t AddObject(const Object& obj); |
| 540 int32_t AddExternalLabel(const ExternalLabel* label); |
531 | 541 |
532 class CodeComment : public ZoneAllocated { | 542 class CodeComment : public ZoneAllocated { |
533 public: | 543 public: |
534 CodeComment(intptr_t pc_offset, const String& comment) | 544 CodeComment(intptr_t pc_offset, const String& comment) |
535 : pc_offset_(pc_offset), comment_(comment) { } | 545 : pc_offset_(pc_offset), comment_(comment) { } |
536 | 546 |
537 intptr_t pc_offset() const { return pc_offset_; } | 547 intptr_t pc_offset() const { return pc_offset_; } |
538 const String& comment() const { return comment_; } | 548 const String& comment() const { return comment_; } |
539 | 549 |
540 private: | 550 private: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 return *reg1 - *reg2; | 635 return *reg1 - *reg2; |
626 } | 636 } |
627 | 637 |
628 DISALLOW_ALLOCATION(); | 638 DISALLOW_ALLOCATION(); |
629 DISALLOW_COPY_AND_ASSIGN(Assembler); | 639 DISALLOW_COPY_AND_ASSIGN(Assembler); |
630 }; | 640 }; |
631 | 641 |
632 } // namespace dart | 642 } // namespace dart |
633 | 643 |
634 #endif // VM_ASSEMBLER_ARM_H_ | 644 #endif // VM_ASSEMBLER_ARM_H_ |
OLD | NEW |