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

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

Issue 380333002: Add VM class for Map/LinkedHashMap. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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
« no previous file with comments | « runtime/vm/bootstrap_natives.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_HASH_TABLE_H_ 5 #ifndef VM_HASH_TABLE_H_
6 #define VM_HASH_TABLE_H_ 6 #define VM_HASH_TABLE_H_
7 7
8 // Temporarily used when sorting the indices in EnumIndexHashTable. 8 // Temporarily used when sorting the indices in EnumIndexHashTable.
9 // TODO(koda): Remove these dependencies before using in production. 9 // TODO(koda): Remove these dependencies before using in production.
10 #include <map> 10 #include <map>
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 376 }
377 377
378 // No extra book-keeping needed for DeleteEntry. 378 // No extra book-keeping needed for DeleteEntry.
379 }; 379 };
380 380
381 381
382 class HashTables : public AllStatic { 382 class HashTables : public AllStatic {
383 public: 383 public:
384 // Allocates and initializes a table. 384 // Allocates and initializes a table.
385 template<typename Table> 385 template<typename Table>
386 static RawArray* New(intptr_t initial_capacity) { 386 static RawArray* New(intptr_t initial_capacity,
387 Heap::Space space = Heap::kNew) {
387 Table table(Array::Handle(Array::New( 388 Table table(Array::Handle(Array::New(
388 Table::ArrayLengthForNumOccupied(initial_capacity)))); 389 Table::ArrayLengthForNumOccupied(initial_capacity), space)));
389 table.Initialize(); 390 table.Initialize();
390 return table.Release(); 391 return table.Release();
391 } 392 }
392 393
393 // Clears 'to' and inserts all elements from 'from', in iteration order. 394 // Clears 'to' and inserts all elements from 'from', in iteration order.
394 // The tables must have the same user payload size. 395 // The tables must have the same user payload size.
395 template<typename From, typename To> 396 template<typename From, typename To>
396 static void Copy(const From& from, const To& to) { 397 static void Copy(const From& from, const To& to) {
397 COMPILE_ASSERT(From::kPayloadSize == To::kPayloadSize); 398 COMPILE_ASSERT(From::kPayloadSize == To::kPayloadSize);
398 to.Initialize(); 399 to.Initialize();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 template<typename KeyTraits> 549 template<typename KeyTraits>
549 class EnumIndexHashSet : public HashSet<EnumIndexHashTable<KeyTraits, 0> > { 550 class EnumIndexHashSet : public HashSet<EnumIndexHashTable<KeyTraits, 0> > {
550 public: 551 public:
551 typedef HashSet<EnumIndexHashTable<KeyTraits, 0> > BaseSet; 552 typedef HashSet<EnumIndexHashTable<KeyTraits, 0> > BaseSet;
552 explicit EnumIndexHashSet(Array& data) : BaseSet(data) {} 553 explicit EnumIndexHashSet(Array& data) : BaseSet(data) {}
553 }; 554 };
554 555
555 } // namespace dart 556 } // namespace dart
556 557
557 #endif // VM_HASH_TABLE_H_ 558 #endif // VM_HASH_TABLE_H_
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698