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

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

Issue 351113002: Attempt to fix Windows compilation error. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 448 }
449 } 449 }
450 return result.raw(); 450 return result.raw();
451 } 451 }
452 }; 452 };
453 453
454 454
455 template<typename Base> 455 template<typename Base>
456 class HashMap : public Base { 456 class HashMap : public Base {
457 public: 457 public:
458 explicit HashMap(Array& data) : Base(data) {} 458 typedef Base BaseTable;
459 explicit HashMap(Array& data) : BaseTable(data) {}
459 template<typename Key> 460 template<typename Key>
460 RawObject* GetOrNull(const Key& key, bool* present = NULL) const { 461 RawObject* GetOrNull(const Key& key, bool* present = NULL) const {
461 intptr_t entry = Base::FindKey(key); 462 intptr_t entry = Base::FindKey(key);
462 if (present != NULL) { 463 if (present != NULL) {
463 *present = (entry != -1); 464 *present = (entry != -1);
464 } 465 }
465 return (entry == -1) ? Object::null() : Base::GetPayload(entry, 0); 466 return (entry == -1) ? Object::null() : Base::GetPayload(entry, 0);
466 } 467 }
467 bool UpdateOrInsert(const Object& key, const Object& value) const { 468 bool UpdateOrInsert(const Object& key, const Object& value) const {
468 HashTables::EnsureLoadFactor(0.0, 0.75, *this); 469 HashTables::EnsureLoadFactor(0.0, 0.75, *this);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 class EnumIndexHashMap : public HashMap<EnumIndexHashTable<KeyTraits, 1> > { 508 class EnumIndexHashMap : public HashMap<EnumIndexHashTable<KeyTraits, 1> > {
508 public: 509 public:
509 typedef HashMap<EnumIndexHashTable<KeyTraits, 1> > Base; 510 typedef HashMap<EnumIndexHashTable<KeyTraits, 1> > Base;
510 explicit EnumIndexHashMap(Array& data) : Base(data) {} 511 explicit EnumIndexHashMap(Array& data) : Base(data) {}
511 }; 512 };
512 513
513 514
514 template<typename Base> 515 template<typename Base>
515 class HashSet : public Base { 516 class HashSet : public Base {
516 public: 517 public:
517 explicit HashSet(Array& data) : Base(data) {} 518 typedef Base BaseTable;
519 explicit HashSet(Array& data) : BaseTable(data) {}
518 bool Insert(const Object& key) { 520 bool Insert(const Object& key) {
519 HashTables::EnsureLoadFactor(0.0, 0.75, *this); 521 HashTables::EnsureLoadFactor(0.0, 0.75, *this);
520 intptr_t entry = -1; 522 intptr_t entry = -1;
521 bool present = Base::FindKeyOrDeletedOrUnused(key, &entry); 523 bool present = Base::FindKeyOrDeletedOrUnused(key, &entry);
522 if (!present) { 524 if (!present) {
523 Base::InsertKey(entry, key); 525 Base::InsertKey(entry, key);
524 } 526 }
525 return present; 527 return present;
526 } 528 }
527 template<typename Key> 529 template<typename Key>
(...skipping 20 matching lines...) Expand all
548 template<typename KeyTraits> 550 template<typename KeyTraits>
549 class EnumIndexHashSet : public HashSet<EnumIndexHashTable<KeyTraits, 0> > { 551 class EnumIndexHashSet : public HashSet<EnumIndexHashTable<KeyTraits, 0> > {
550 public: 552 public:
551 typedef HashSet<EnumIndexHashTable<KeyTraits, 0> > Base; 553 typedef HashSet<EnumIndexHashTable<KeyTraits, 0> > Base;
552 explicit EnumIndexHashSet(Array& data) : Base(data) {} 554 explicit EnumIndexHashSet(Array& data) : Base(data) {}
553 }; 555 };
554 556
555 } // namespace dart 557 } // namespace dart
556 558
557 #endif // VM_HASH_TABLE_H_ 559 #endif // VM_HASH_TABLE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698