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

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

Issue 23723008: Fixes slow object pool search on x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
11 11
12 #include "platform/assert.h" 12 #include "platform/assert.h"
13 #include "platform/utils.h" 13 #include "platform/utils.h"
14 #include "vm/constants_x64.h" 14 #include "vm/constants_x64.h"
15 #include "vm/hash_map.h"
15 16
16 namespace dart { 17 namespace dart {
17 18
18 // Forward declarations. 19 // Forward declarations.
19 class RuntimeEntry; 20 class RuntimeEntry;
20 21
21 class Immediate : public ValueObject { 22 class Immediate : public ValueObject {
22 public: 23 public:
23 explicit Immediate(int64_t value) : value_(value) { } 24 explicit Immediate(int64_t value) : value_(value) { }
24 25
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 831
831 private: 832 private:
832 AssemblerBuffer buffer_; 833 AssemblerBuffer buffer_;
833 834
834 // Objects and jump targets. 835 // Objects and jump targets.
835 GrowableObjectArray& object_pool_; 836 GrowableObjectArray& object_pool_;
836 837
837 // Patchability of pool entries. 838 // Patchability of pool entries.
838 GrowableArray<Patchability> patchable_pool_entries_; 839 GrowableArray<Patchability> patchable_pool_entries_;
839 840
841 // Pair type parameter for DirectChainedHashMap.
842 class ObjIndexPair {
843 public:
844 // TODO(zra): When an identity map is added to the VM, use that here
845 // instead. In the meantime...
846 // CAUTION: the RawObject* below is only safe because:
847 // The HashMap that will use this pair type will not contain any RawObject*
848 // keys that are not in the object_pool_ array. Since the keys will be
849 // visited by the GC when it visits the object_pool_, and since all objects
850 // in the object_pool_ are Old (and so will not be moved) the GC does not
851 // also need to visit the keys here in the HashMap.
Ivan Posva 2013/09/13 17:25:09 +fschneider: After discussing this more with Zach
zra 2013/09/13 17:46:18 Done. Issue 13305.
852 typedef RawObject* Key;
Ivan Posva 2013/09/13 17:25:09 Please add a separate comment about why these type
zra 2013/09/13 17:46:18 Done.
853 typedef intptr_t Value;
854 typedef ObjIndexPair Pair;
855
856 ObjIndexPair(Key key, Value value) : key_(key), value_(value) { }
857
858 static Key KeyOf(Pair kv) { return kv.key_; }
859
860 static Value ValueOf(Pair kv) { return kv.value_; }
861
862 static intptr_t Hashcode(Key key) {
863 return String::Hash(reinterpret_cast<uint8_t*>(&key), sizeof(&key));
Ivan Posva 2013/09/13 17:25:09 Please do not use a pointer as a string.
zra 2013/09/13 17:46:18 Done.
864 }
865
866 static inline bool IsKeyEqual(Pair kv, Key key) {
867 return kv.key_ == key;
868 }
869
870 private:
871 Key key_;
872 Value value_;
873 };
874
875 // Hashmap for fast lookup in object pool.
876 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_;
877
840 int prologue_offset_; 878 int prologue_offset_;
841 879
842 class CodeComment : public ZoneAllocated { 880 class CodeComment : public ZoneAllocated {
843 public: 881 public:
844 CodeComment(intptr_t pc_offset, const String& comment) 882 CodeComment(intptr_t pc_offset, const String& comment)
845 : pc_offset_(pc_offset), comment_(comment) { } 883 : pc_offset_(pc_offset), comment_(comment) { }
846 884
847 intptr_t pc_offset() const { return pc_offset_; } 885 intptr_t pc_offset() const { return pc_offset_; }
848 const String& comment() const { return comment_; } 886 const String& comment() const { return comment_; }
849 887
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 1019 }
982 1020
983 1021
984 inline void Assembler::EmitOperandSizeOverride() { 1022 inline void Assembler::EmitOperandSizeOverride() {
985 EmitUint8(0x66); 1023 EmitUint8(0x66);
986 } 1024 }
987 1025
988 } // namespace dart 1026 } // namespace dart
989 1027
990 #endif // VM_ASSEMBLER_X64_H_ 1028 #endif // VM_ASSEMBLER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698