| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 class Address : public ValueObject { | 190 class Address : public ValueObject { |
| 191 public: | 191 public: |
| 192 enum OffsetKind { | 192 enum OffsetKind { |
| 193 Immediate, | 193 Immediate, |
| 194 IndexRegister, | 194 IndexRegister, |
| 195 ScaledIndexRegister, | 195 ScaledIndexRegister, |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 // Memory operand addressing mode | 198 // Memory operand addressing mode |
| 199 enum Mode { | 199 enum Mode { |
| 200 kModeMask = (8|4|1) << 21, |
| 200 // bit encoding P U W | 201 // bit encoding P U W |
| 201 Offset = (8|4|0) << 21, // offset (w/o writeback to base) | 202 Offset = (8|4|0) << 21, // offset (w/o writeback to base) |
| 202 PreIndex = (8|4|1) << 21, // pre-indexed addressing with writeback | 203 PreIndex = (8|4|1) << 21, // pre-indexed addressing with writeback |
| 203 PostIndex = (0|4|0) << 21, // post-indexed addressing with writeback | 204 PostIndex = (0|4|0) << 21, // post-indexed addressing with writeback |
| 204 NegOffset = (8|0|0) << 21, // negative offset (w/o writeback to base) | 205 NegOffset = (8|0|0) << 21, // negative offset (w/o writeback to base) |
| 205 NegPreIndex = (8|0|1) << 21, // negative pre-indexed with writeback | 206 NegPreIndex = (8|0|1) << 21, // negative pre-indexed with writeback |
| 206 NegPostIndex = (0|0|0) << 21 // negative post-indexed with writeback | 207 NegPostIndex = (0|0|0) << 21 // negative post-indexed with writeback |
| 207 }; | 208 }; |
| 208 | 209 |
| 209 Address(const Address& other) | 210 Address(const Address& other) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 int32_t offset, | 257 int32_t offset, |
| 257 int32_t* offset_mask); | 258 int32_t* offset_mask); |
| 258 static bool CanHoldStoreOffset(OperandSize size, | 259 static bool CanHoldStoreOffset(OperandSize size, |
| 259 int32_t offset, | 260 int32_t offset, |
| 260 int32_t* offset_mask); | 261 int32_t* offset_mask); |
| 261 static bool CanHoldImmediateOffset(bool is_load, | 262 static bool CanHoldImmediateOffset(bool is_load, |
| 262 intptr_t cid, | 263 intptr_t cid, |
| 263 int64_t offset); | 264 int64_t offset); |
| 264 | 265 |
| 265 private: | 266 private: |
| 267 Register rn() const { |
| 268 return Instr::At(reinterpret_cast<uword>(&encoding_))->RnField(); |
| 269 } |
| 270 |
| 271 Register rm() const { |
| 272 return ((kind() == IndexRegister) || (kind() == ScaledIndexRegister)) ? |
| 273 Instr::At(reinterpret_cast<uword>(&encoding_))->RmField() : |
| 274 kNoRegister; |
| 275 } |
| 276 |
| 277 Mode mode() const { return static_cast<Mode>(encoding() & kModeMask); } |
| 278 |
| 266 uint32_t encoding() const { return encoding_; } | 279 uint32_t encoding() const { return encoding_; } |
| 267 | 280 |
| 268 // Encoding for addressing mode 3. | 281 // Encoding for addressing mode 3. |
| 269 uint32_t encoding3() const; | 282 uint32_t encoding3() const; |
| 270 | 283 |
| 271 // Encoding for vfp load/store addressing. | 284 // Encoding for vfp load/store addressing. |
| 272 uint32_t vencoding() const; | 285 uint32_t vencoding() const; |
| 273 | 286 |
| 274 OffsetKind kind() const { return kind_; } | 287 OffsetKind kind() const { return kind_; } |
| 275 | 288 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const { | 339 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const { |
| 327 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. | 340 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. |
| 328 return buffer_.pointer_offsets(); | 341 return buffer_.pointer_offsets(); |
| 329 } | 342 } |
| 330 const GrowableObjectArray& object_pool() const { return object_pool_; } | 343 const GrowableObjectArray& object_pool() const { return object_pool_; } |
| 331 | 344 |
| 332 bool use_far_branches() const { | 345 bool use_far_branches() const { |
| 333 return FLAG_use_far_branches || use_far_branches_; | 346 return FLAG_use_far_branches || use_far_branches_; |
| 334 } | 347 } |
| 335 | 348 |
| 349 #if defined(TESTING) || defined(DEBUG) |
| 350 // Used in unit tests and to ensure predictable verification code size in |
| 351 // FlowGraphCompiler::EmitEdgeCounter. |
| 336 void set_use_far_branches(bool b) { | 352 void set_use_far_branches(bool b) { |
| 337 ASSERT(buffer_.Size() == 0); | |
| 338 use_far_branches_ = b; | 353 use_far_branches_ = b; |
| 339 } | 354 } |
| 355 #endif // TESTING || DEBUG |
| 340 | 356 |
| 341 void FinalizeInstructions(const MemoryRegion& region) { | 357 void FinalizeInstructions(const MemoryRegion& region) { |
| 342 buffer_.FinalizeInstructions(region); | 358 buffer_.FinalizeInstructions(region); |
| 343 } | 359 } |
| 344 | 360 |
| 345 // Debugging and bringup support. | 361 // Debugging and bringup support. |
| 346 void Stop(const char* message); | 362 void Stop(const char* message); |
| 347 void Unimplemented(const char* message); | 363 void Unimplemented(const char* message); |
| 348 void Untested(const char* message); | 364 void Untested(const char* message); |
| 349 void Unreachable(const char* message); | 365 void Unreachable(const char* message); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 // Store value_even, value_odd, value_even, ... into the words in the address | 687 // Store value_even, value_odd, value_even, ... into the words in the address |
| 672 // range [begin, end), assumed to be uninitialized fields in object (tagged). | 688 // range [begin, end), assumed to be uninitialized fields in object (tagged). |
| 673 // The stores must not need a generational store barrier (e.g., smi/null), | 689 // The stores must not need a generational store barrier (e.g., smi/null), |
| 674 // and (value_even, value_odd) must be a valid register pair. | 690 // and (value_even, value_odd) must be a valid register pair. |
| 675 // Destroys register 'begin'. | 691 // Destroys register 'begin'. |
| 676 void InitializeFieldsNoBarrier(Register object, | 692 void InitializeFieldsNoBarrier(Register object, |
| 677 Register begin, | 693 Register begin, |
| 678 Register end, | 694 Register end, |
| 679 Register value_even, | 695 Register value_even, |
| 680 Register value_odd); | 696 Register value_odd); |
| 681 // Like above, for the range [begin, begin+count*kWordSize), unrolled. | 697 // Like above, for the range [base+begin_offset, base+end_offset), unrolled. |
| 682 void InitializeFieldsNoBarrierUnrolled(Register object, | 698 void InitializeFieldsNoBarrierUnrolled(Register object, |
| 683 Register begin, | 699 Register base, |
| 684 intptr_t count, | 700 intptr_t begin_offset, |
| 701 intptr_t end_offset, |
| 685 Register value_even, | 702 Register value_even, |
| 686 Register value_odd); | 703 Register value_odd); |
| 687 | 704 |
| 705 // Stores a Smi value into a heap object field that always contains a Smi. |
| 706 void StoreIntoSmiField(const Address& dest, Register value); |
| 707 |
| 688 void LoadClassId(Register result, Register object, Condition cond = AL); | 708 void LoadClassId(Register result, Register object, Condition cond = AL); |
| 689 void LoadClassById(Register result, Register class_id); | 709 void LoadClassById(Register result, Register class_id); |
| 690 void LoadClass(Register result, Register object, Register scratch); | 710 void LoadClass(Register result, Register object, Register scratch); |
| 691 void CompareClassId(Register object, intptr_t class_id, Register scratch); | 711 void CompareClassId(Register object, intptr_t class_id, Register scratch); |
| 692 void LoadTaggedClassIdMayBeSmi(Register result, Register object); | 712 void LoadTaggedClassIdMayBeSmi(Register result, Register object); |
| 693 | 713 |
| 694 void LoadWordFromPoolOffset(Register rd, int32_t offset, Condition cond = AL); | 714 void LoadWordFromPoolOffset(Register rd, int32_t offset, Condition cond = AL); |
| 695 void LoadFromOffset(OperandSize type, | 715 void LoadFromOffset(OperandSize type, |
| 696 Register reg, | 716 Register reg, |
| 697 Register base, | 717 Register base, |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 int32_t EncodeTstOffset(int32_t offset, int32_t inst); | 1061 int32_t EncodeTstOffset(int32_t offset, int32_t inst); |
| 1042 int32_t DecodeTstOffset(int32_t inst); | 1062 int32_t DecodeTstOffset(int32_t inst); |
| 1043 | 1063 |
| 1044 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 1064 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
| 1045 | 1065 |
| 1046 // Shorter filtering sequence that assumes that value is not a smi. | 1066 // Shorter filtering sequence that assumes that value is not a smi. |
| 1047 void StoreIntoObjectFilterNoSmi(Register object, | 1067 void StoreIntoObjectFilterNoSmi(Register object, |
| 1048 Register value, | 1068 Register value, |
| 1049 Label* no_update); | 1069 Label* no_update); |
| 1050 | 1070 |
| 1071 // Helpers for write-barrier verification. |
| 1072 |
| 1073 // Returns VerifiedMemory::offset() as an Operand. |
| 1074 Operand GetVerifiedMemoryShadow(); |
| 1075 // Writes value to [base + offset] and also its shadow location, if enabled. |
| 1076 void WriteShadowedField(Register base, |
| 1077 intptr_t offset, |
| 1078 Register value, |
| 1079 Condition cond = AL); |
| 1080 void WriteShadowedFieldPair(Register base, |
| 1081 intptr_t offset, |
| 1082 Register value_even, |
| 1083 Register value_odd, |
| 1084 Condition cond = AL); |
| 1085 // Writes new_value to address and its shadow location, if enabled, after |
| 1086 // verifying that its old value matches its shadow. |
| 1087 void VerifiedWrite(const Address& address, Register new_value); |
| 1088 |
| 1051 DISALLOW_ALLOCATION(); | 1089 DISALLOW_ALLOCATION(); |
| 1052 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1090 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1053 }; | 1091 }; |
| 1054 | 1092 |
| 1055 } // namespace dart | 1093 } // namespace dart |
| 1056 | 1094 |
| 1057 #endif // VM_ASSEMBLER_ARM_H_ | 1095 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |