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_IA32_H_ | 5 #ifndef VM_ASSEMBLER_IA32_H_ |
6 #define VM_ASSEMBLER_IA32_H_ | 6 #define VM_ASSEMBLER_IA32_H_ |
7 | 7 |
8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
9 #error Do not include assembler_ia32.h directly; use assembler.h instead. | 9 #error Do not include assembler_ia32.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 DISALLOW_COPY_AND_ASSIGN(Label); | 298 DISALLOW_COPY_AND_ASSIGN(Label); |
299 }; | 299 }; |
300 | 300 |
301 | 301 |
302 class Assembler : public ValueObject { | 302 class Assembler : public ValueObject { |
303 public: | 303 public: |
304 explicit Assembler(bool use_far_branches = false) | 304 explicit Assembler(bool use_far_branches = false) |
305 : buffer_(), | 305 : buffer_(), |
306 prologue_offset_(-1), | 306 prologue_offset_(-1), |
307 jit_cookie_(0), | 307 jit_cookie_(0), |
308 comments_(), | 308 comments_() { |
309 code_(Code::ZoneHandle()) { | |
310 // This mode is only needed and implemented for MIPS and ARM. | 309 // This mode is only needed and implemented for MIPS and ARM. |
311 ASSERT(!use_far_branches); | 310 ASSERT(!use_far_branches); |
312 } | 311 } |
313 ~Assembler() { } | 312 ~Assembler() { } |
314 | 313 |
315 static const bool kNearJump = true; | 314 static const bool kNearJump = true; |
316 static const bool kFarJump = false; | 315 static const bool kFarJump = false; |
317 | 316 |
318 /* | 317 /* |
319 * Emit Machine Instructions. | 318 * Emit Machine Instructions. |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 if (Utils::IsPowerOfTwo(value) || Utils::IsPowerOfTwo(value + 1)) { | 950 if (Utils::IsPowerOfTwo(value) || Utils::IsPowerOfTwo(value + 1)) { |
952 return true; | 951 return true; |
953 } | 952 } |
954 | 953 |
955 return false; | 954 return false; |
956 } | 955 } |
957 static bool IsSafe(const Object& object) { | 956 static bool IsSafe(const Object& object) { |
958 return !object.IsSmi() || IsSafeSmi(object); | 957 return !object.IsSmi() || IsSafeSmi(object); |
959 } | 958 } |
960 | 959 |
961 void set_code_object(const Code& code) { | |
962 code_ ^= code.raw(); | |
963 } | |
964 | |
965 void PushCodeObject(); | |
966 | |
967 private: | 960 private: |
968 class CodeComment : public ZoneAllocated { | 961 class CodeComment : public ZoneAllocated { |
969 public: | 962 public: |
970 CodeComment(intptr_t pc_offset, const String& comment) | 963 CodeComment(intptr_t pc_offset, const String& comment) |
971 : pc_offset_(pc_offset), comment_(comment) { } | 964 : pc_offset_(pc_offset), comment_(comment) { } |
972 | 965 |
973 intptr_t pc_offset() const { return pc_offset_; } | 966 intptr_t pc_offset() const { return pc_offset_; } |
974 const String& comment() const { return comment_; } | 967 const String& comment() const { return comment_; } |
975 | 968 |
976 private: | 969 private: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 FieldContent old_content); | 1010 FieldContent old_content); |
1018 void UnverifiedStoreOldObject(const Address& dest, const Object& value); | 1011 void UnverifiedStoreOldObject(const Address& dest, const Object& value); |
1019 | 1012 |
1020 int32_t jit_cookie(); | 1013 int32_t jit_cookie(); |
1021 | 1014 |
1022 AssemblerBuffer buffer_; | 1015 AssemblerBuffer buffer_; |
1023 ObjectPoolWrapper object_pool_wrapper_; | 1016 ObjectPoolWrapper object_pool_wrapper_; |
1024 intptr_t prologue_offset_; | 1017 intptr_t prologue_offset_; |
1025 int32_t jit_cookie_; | 1018 int32_t jit_cookie_; |
1026 GrowableArray<CodeComment*> comments_; | 1019 GrowableArray<CodeComment*> comments_; |
1027 Code& code_; | |
1028 | 1020 |
1029 DISALLOW_ALLOCATION(); | 1021 DISALLOW_ALLOCATION(); |
1030 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1022 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1031 }; | 1023 }; |
1032 | 1024 |
1033 | 1025 |
1034 inline void Assembler::EmitUint8(uint8_t value) { | 1026 inline void Assembler::EmitUint8(uint8_t value) { |
1035 buffer_.Emit<uint8_t>(value); | 1027 buffer_.Emit<uint8_t>(value); |
1036 } | 1028 } |
1037 | 1029 |
(...skipping 19 matching lines...) Expand all Loading... |
1057 } | 1049 } |
1058 | 1050 |
1059 | 1051 |
1060 inline void Assembler::EmitOperandSizeOverride() { | 1052 inline void Assembler::EmitOperandSizeOverride() { |
1061 EmitUint8(0x66); | 1053 EmitUint8(0x66); |
1062 } | 1054 } |
1063 | 1055 |
1064 } // namespace dart | 1056 } // namespace dart |
1065 | 1057 |
1066 #endif // VM_ASSEMBLER_IA32_H_ | 1058 #endif // VM_ASSEMBLER_IA32_H_ |
OLD | NEW |