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

Side by Side Diff: runtime/vm/symbols.cc

Issue 1882763002: Add usage and collision details to the hash table data structure in order to determine effectivenes… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-review-comments Created 4 years, 8 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
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/symbols.h" 5 #include "vm/symbols.h"
6 6
7 #include "vm/handles.h" 7 #include "vm/handles.h"
8 #include "vm/handles_impl.h" 8 #include "vm/handles_impl.h"
9 #include "vm/hash_table.h" 9 #include "vm/hash_table.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 String& result = String::Handle(String::Concat(str1_, str2_, Heap::kOld)); 141 String& result = String::Handle(String::Concat(str1_, str2_, Heap::kOld));
142 result.SetCanonical(); 142 result.SetCanonical();
143 result.SetHash(hash_); 143 result.SetHash(hash_);
144 return result.raw(); 144 return result.raw();
145 } 145 }
146 146
147 147
148 class SymbolTraits { 148 class SymbolTraits {
149 public: 149 public:
150 static const char* Name() { return "SymbolTraits"; } 150 static const char* Name() { return "SymbolTraits"; }
151 static bool ReportStats() { return false; }
151 152
152 static bool IsMatch(const Object& a, const Object& b) { 153 static bool IsMatch(const Object& a, const Object& b) {
153 const String& a_str = String::Cast(a); 154 const String& a_str = String::Cast(a);
154 const String& b_str = String::Cast(b); 155 const String& b_str = String::Cast(b);
155 ASSERT(a_str.HasHash()); 156 ASSERT(a_str.HasHash());
156 ASSERT(b_str.HasHash()); 157 ASSERT(b_str.HasHash());
157 if (a_str.Hash() != b_str.Hash()) { 158 if (a_str.Hash() != b_str.Hash()) {
158 return false; 159 return false;
159 } 160 }
160 intptr_t a_len = a_str.Length(); 161 intptr_t a_len = a_str.Length();
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { 756 RawObject* Symbols::GetVMSymbol(intptr_t object_id) {
756 ASSERT(IsVMSymbolId(object_id)); 757 ASSERT(IsVMSymbolId(object_id));
757 intptr_t i = (object_id - kMaxPredefinedObjectIds); 758 intptr_t i = (object_id - kMaxPredefinedObjectIds);
758 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { 759 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) {
759 return symbol_handles_[i]->raw(); 760 return symbol_handles_[i]->raw();
760 } 761 }
761 return Object::null(); 762 return Object::null();
762 } 763 }
763 764
764 } // namespace dart 765 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698