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