Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: runtime/vm/assembler_arm.h

Issue 886173003: VM: Align implementations of assembler constant pools. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed ARM debug assert Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 Address::operator=(other); 309 Address::operator=(other);
310 return *this; 310 return *this;
311 } 311 }
312 }; 312 };
313 313
314 314
315 class Assembler : public ValueObject { 315 class Assembler : public ValueObject {
316 public: 316 public:
317 explicit Assembler(bool use_far_branches = false) 317 explicit Assembler(bool use_far_branches = false)
318 : buffer_(), 318 : buffer_(),
319 object_pool_(GrowableObjectArray::Handle()),
320 prologue_offset_(-1), 319 prologue_offset_(-1),
321 use_far_branches_(use_far_branches), 320 use_far_branches_(use_far_branches),
322 comments_(), 321 comments_(),
323 allow_constant_pool_(true) { } 322 allow_constant_pool_(true) { }
324 323
325 ~Assembler() { } 324 ~Assembler() { }
326 325
327 void PopRegister(Register r) { Pop(r); } 326 void PopRegister(Register r) { Pop(r); }
328 327
329 void Bind(Label* label); 328 void Bind(Label* label);
330 void Jump(Label* label) { b(label); } 329 void Jump(Label* label) { b(label); }
331 330
332 // Misc. functionality 331 // Misc. functionality
333 intptr_t CodeSize() const { return buffer_.Size(); } 332 intptr_t CodeSize() const { return buffer_.Size(); }
334 intptr_t prologue_offset() const { return prologue_offset_; } 333 intptr_t prologue_offset() const { return prologue_offset_; }
335 334
336 // Count the fixups that produce a pointer offset, without processing 335 // Count the fixups that produce a pointer offset, without processing
337 // the fixups. On ARM there are no pointers in code. 336 // the fixups. On ARM there are no pointers in code.
338 intptr_t CountPointerOffsets() const { return 0; } 337 intptr_t CountPointerOffsets() const { return 0; }
339 338
340 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const { 339 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const {
341 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. 340 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code.
342 return buffer_.pointer_offsets(); 341 return buffer_.pointer_offsets();
343 } 342 }
344 const GrowableObjectArray& object_pool() const { return object_pool_; } 343 const GrowableObjectArray& object_pool() const { return object_pool_.data(); }
345 344
346 bool use_far_branches() const { 345 bool use_far_branches() const {
347 return FLAG_use_far_branches || use_far_branches_; 346 return FLAG_use_far_branches || use_far_branches_;
348 } 347 }
349 348
350 #if defined(TESTING) || defined(DEBUG) 349 #if defined(TESTING) || defined(DEBUG)
351 // Used in unit tests and to ensure predictable verification code size in 350 // Used in unit tests and to ensure predictable verification code size in
352 // FlowGraphCompiler::EmitEdgeCounter. 351 // FlowGraphCompiler::EmitEdgeCounter.
353 void set_use_far_branches(bool b) { 352 void set_use_far_branches(bool b) {
354 use_far_branches_ = b; 353 use_far_branches_ = b;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // If we aren't on ARMv7, there is no smull. 638 // If we aren't on ARMv7, there is no smull.
640 void CheckMultSignedOverflow(Register left, 639 void CheckMultSignedOverflow(Register left,
641 Register right, 640 Register right,
642 Register tmp, 641 Register tmp,
643 DRegister dtmp0, DRegister dtmp1, 642 DRegister dtmp0, DRegister dtmp1,
644 Label* overflow); 643 Label* overflow);
645 644
646 // Load and Store. 645 // Load and Store.
647 // These three do not clobber IP. 646 // These three do not clobber IP.
648 void LoadPatchableImmediate(Register rd, int32_t value, Condition cond = AL); 647 void LoadPatchableImmediate(Register rd, int32_t value, Condition cond = AL);
649 void LoadDecodableImmediate(Register rd, int32_t value, Condition cond = AL);
650 void LoadImmediate(Register rd, int32_t value, Condition cond = AL); 648 void LoadImmediate(Register rd, int32_t value, Condition cond = AL);
651 // These two may clobber IP. 649 // These two may clobber IP.
652 void LoadSImmediate(SRegister sd, float value, Condition cond = AL); 650 void LoadSImmediate(SRegister sd, float value, Condition cond = AL);
653 void LoadDImmediate(DRegister dd, double value, 651 void LoadDImmediate(DRegister dd, double value,
654 Register scratch, Condition cond = AL); 652 Register scratch, Condition cond = AL);
655 653
656 void MarkExceptionHandler(Label* label); 654 void MarkExceptionHandler(Label* label);
657 655
658 void Drop(intptr_t stack_elements); 656 void Drop(intptr_t stack_elements);
659 657
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 950
953 bool allow_constant_pool() const { 951 bool allow_constant_pool() const {
954 return allow_constant_pool_; 952 return allow_constant_pool_;
955 } 953 }
956 void set_allow_constant_pool(bool b) { 954 void set_allow_constant_pool(bool b) {
957 allow_constant_pool_ = b; 955 allow_constant_pool_ = b;
958 } 956 }
959 957
960 private: 958 private:
961 AssemblerBuffer buffer_; // Contains position independent code. 959 AssemblerBuffer buffer_; // Contains position independent code.
962 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. 960 ObjectPool object_pool_; // Objects and patchable jump targets.
963
964 // Hashmap for fast lookup in object pool.
965 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_;
966 961
967 int32_t prologue_offset_; 962 int32_t prologue_offset_;
968 963
969 bool use_far_branches_; 964 bool use_far_branches_;
970 965
971 // If you are thinking of using one or both of these instructions directly, 966 // If you are thinking of using one or both of these instructions directly,
972 // instead LoadImmediate should probably be used. 967 // instead LoadImmediate should probably be used.
973 void movw(Register rd, uint16_t imm16, Condition cond = AL); 968 void movw(Register rd, uint16_t imm16, Condition cond = AL);
974 void movt(Register rd, uint16_t imm16, Condition cond = AL); 969 void movt(Register rd, uint16_t imm16, Condition cond = AL);
975 970
976 int32_t AddObject(const Object& obj);
977 int32_t AddExternalLabel(const ExternalLabel* label);
978
979 void BindARMv6(Label* label); 971 void BindARMv6(Label* label);
980 void BindARMv7(Label* label); 972 void BindARMv7(Label* label);
981 973
982 class CodeComment : public ZoneAllocated { 974 class CodeComment : public ZoneAllocated {
983 public: 975 public:
984 CodeComment(intptr_t pc_offset, const String& comment) 976 CodeComment(intptr_t pc_offset, const String& comment)
985 : pc_offset_(pc_offset), comment_(comment) { } 977 : pc_offset_(pc_offset), comment_(comment) { }
986 978
987 intptr_t pc_offset() const { return pc_offset_; } 979 intptr_t pc_offset() const { return pc_offset_; }
988 const String& comment() const { return comment_; } 980 const String& comment() const { return comment_; }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 Register new_value, 1118 Register new_value,
1127 FieldContent old_content); 1119 FieldContent old_content);
1128 1120
1129 DISALLOW_ALLOCATION(); 1121 DISALLOW_ALLOCATION();
1130 DISALLOW_COPY_AND_ASSIGN(Assembler); 1122 DISALLOW_COPY_AND_ASSIGN(Assembler);
1131 }; 1123 };
1132 1124
1133 } // namespace dart 1125 } // namespace dart
1134 1126
1135 #endif // VM_ASSEMBLER_ARM_H_ 1127 #endif // VM_ASSEMBLER_ARM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698