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

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

Issue 848703002: Improve constant pool implementation in the assembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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_X64_H_ 5 #ifndef VM_ASSEMBLER_X64_H_
6 #define VM_ASSEMBLER_X64_H_ 6 #define VM_ASSEMBLER_X64_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_x64.h directly; use assembler.h instead. 9 #error Do not include assembler_x64.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1016
1017 private: 1017 private:
1018 AssemblerBuffer buffer_; 1018 AssemblerBuffer buffer_;
1019 1019
1020 // Objects and jump targets. 1020 // Objects and jump targets.
1021 GrowableObjectArray& object_pool_; 1021 GrowableObjectArray& object_pool_;
1022 1022
1023 // Patchability of pool entries. 1023 // Patchability of pool entries.
1024 GrowableArray<Patchability> patchable_pool_entries_; 1024 GrowableArray<Patchability> patchable_pool_entries_;
1025 1025
1026 // Pair type parameter for DirectChainedHashMap.
1027 class ObjIndexPair {
1028 public:
1029 // TODO(zra): A WeakTable should be used here instead, but then it would
1030 // also have to be possible to register and de-register WeakTables with the
1031 // heap. Also, the Assembler would need to become a StackResource.
1032 // Issue 13305. In the meantime...
1033 // CAUTION: the RawObject* below is only safe because:
1034 // The HashMap that will use this pair type will not contain any RawObject*
1035 // keys that are not in the object_pool_ array. Since the keys will be
1036 // visited by the GC when it visits the object_pool_, and since all objects
1037 // in the object_pool_ are Old (and so will not be moved) the GC does not
1038 // also need to visit the keys here in the HashMap.
1039
1040 // Typedefs needed for the DirectChainedHashMap template.
1041 typedef RawObject* Key;
1042 typedef intptr_t Value;
1043 typedef ObjIndexPair Pair;
1044
1045 ObjIndexPair(Key key, Value value) : key_(key), value_(value) { }
1046
1047 static Key KeyOf(Pair kv) { return kv.key_; }
1048
1049 static Value ValueOf(Pair kv) { return kv.value_; }
1050
1051 static intptr_t Hashcode(Key key) {
1052 return reinterpret_cast<intptr_t>(key) >> kObjectAlignmentLog2;
1053 }
1054
1055 static inline bool IsKeyEqual(Pair kv, Key key) {
1056 return kv.key_ == key;
1057 }
1058
1059 private:
1060 Key key_;
1061 Value value_;
1062 };
1063
1064 // Hashmap for fast lookup in object pool. 1026 // Hashmap for fast lookup in object pool.
1065 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_; 1027 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_;
1066 1028
1067 intptr_t prologue_offset_; 1029 intptr_t prologue_offset_;
1068 1030
1069 class CodeComment : public ZoneAllocated { 1031 class CodeComment : public ZoneAllocated {
1070 public: 1032 public:
1071 CodeComment(intptr_t pc_offset, const String& comment) 1033 CodeComment(intptr_t pc_offset, const String& comment)
1072 : pc_offset_(pc_offset), comment_(comment) { } 1034 : pc_offset_(pc_offset), comment_(comment) { }
1073 1035
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 } 1188 }
1227 1189
1228 1190
1229 inline void Assembler::EmitOperandSizeOverride() { 1191 inline void Assembler::EmitOperandSizeOverride() {
1230 EmitUint8(0x66); 1192 EmitUint8(0x66);
1231 } 1193 }
1232 1194
1233 } // namespace dart 1195 } // namespace dart
1234 1196
1235 #endif // VM_ASSEMBLER_X64_H_ 1197 #endif // VM_ASSEMBLER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698