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

Side by Side Diff: runtime/vm/assembler_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64_H_ 5 #ifndef VM_ASSEMBLER_ARM64_H_
6 #define VM_ASSEMBLER_ARM64_H_ 6 #define VM_ASSEMBLER_ARM64_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_arm64.h directly; use assembler.h instead. 9 #error Do not include assembler_arm64.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 1423
1424 private: 1424 private:
1425 AssemblerBuffer buffer_; // Contains position independent code. 1425 AssemblerBuffer buffer_; // Contains position independent code.
1426 1426
1427 // Objects and patchable jump targets. 1427 // Objects and patchable jump targets.
1428 GrowableObjectArray& object_pool_; 1428 GrowableObjectArray& object_pool_;
1429 1429
1430 // Patchability of pool entries. 1430 // Patchability of pool entries.
1431 GrowableArray<Patchability> patchable_pool_entries_; 1431 GrowableArray<Patchability> patchable_pool_entries_;
1432 1432
1433 // Pair type parameter for DirectChainedHashMap.
1434 class ObjIndexPair {
1435 public:
1436 // TODO(zra): A WeakTable should be used here instead, but then it would
1437 // also have to be possible to register and de-register WeakTables with the
1438 // heap. Also, the Assembler would need to become a StackResource.
1439 // Issue 13305. In the meantime...
1440 // CAUTION: the RawObject* below is only safe because:
1441 // The HashMap that will use this pair type will not contain any RawObject*
1442 // keys that are not in the object_pool_ array. Since the keys will be
1443 // visited by the GC when it visits the object_pool_, and since all objects
1444 // in the object_pool_ are Old (and so will not be moved) the GC does not
1445 // also need to visit the keys here in the HashMap.
1446
1447 // Typedefs needed for the DirectChainedHashMap template.
1448 typedef RawObject* Key;
1449 typedef intptr_t Value;
1450 typedef ObjIndexPair Pair;
1451
1452 ObjIndexPair(Key key, Value value) : key_(key), value_(value) { }
1453
1454 static Key KeyOf(Pair kv) { return kv.key_; }
1455
1456 static Value ValueOf(Pair kv) { return kv.value_; }
1457
1458 static intptr_t Hashcode(Key key) {
1459 return reinterpret_cast<intptr_t>(key) >> kObjectAlignmentLog2;
1460 }
1461
1462 static inline bool IsKeyEqual(Pair kv, Key key) {
1463 return kv.key_ == key;
1464 }
1465
1466 private:
1467 Key key_;
1468 Value value_;
1469 };
1470
1471 // Hashmap for fast lookup in object pool. 1433 // Hashmap for fast lookup in object pool.
1472 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_; 1434 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_;
1473 1435
1474 int32_t prologue_offset_; 1436 int32_t prologue_offset_;
1475 1437
1476 bool use_far_branches_; 1438 bool use_far_branches_;
1477 1439
1478 class CodeComment : public ZoneAllocated { 1440 class CodeComment : public ZoneAllocated {
1479 public: 1441 public:
1480 CodeComment(intptr_t pc_offset, const String& comment) 1442 CodeComment(intptr_t pc_offset, const String& comment)
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 Register value, 1933 Register value,
1972 Label* no_update); 1934 Label* no_update);
1973 1935
1974 DISALLOW_ALLOCATION(); 1936 DISALLOW_ALLOCATION();
1975 DISALLOW_COPY_AND_ASSIGN(Assembler); 1937 DISALLOW_COPY_AND_ASSIGN(Assembler);
1976 }; 1938 };
1977 1939
1978 } // namespace dart 1940 } // namespace dart
1979 1941
1980 #endif // VM_ASSEMBLER_ARM64_H_ 1942 #endif // VM_ASSEMBLER_ARM64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698