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

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

Issue 1873283003: Provide a mechanism for naming a hash table so that it can be used in DumpStats to identify the tab… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 RawString* ConcatString::ToSymbol() const { 127 RawString* ConcatString::ToSymbol() const {
128 String& result = String::Handle(String::Concat(str1_, str2_, Heap::kOld)); 128 String& result = String::Handle(String::Concat(str1_, str2_, Heap::kOld));
129 result.SetCanonical(); 129 result.SetCanonical();
130 result.SetHash(hash_); 130 result.SetHash(hash_);
131 return result.raw(); 131 return result.raw();
132 } 132 }
133 133
134 134
135 class SymbolTraits { 135 class SymbolTraits {
136 public: 136 public:
137 static const char* Name() { return "SymbolTraits"; }
138
137 static bool IsMatch(const Object& a, const Object& b) { 139 static bool IsMatch(const Object& a, const Object& b) {
138 return String::Cast(a).Equals(String::Cast(b)); 140 return String::Cast(a).Equals(String::Cast(b));
139 } 141 }
140 template<typename CharType> 142 template<typename CharType>
141 static bool IsMatch(const CharArray<CharType>& array, const Object& obj) { 143 static bool IsMatch(const CharArray<CharType>& array, const Object& obj) {
142 return array.Equals(String::Cast(obj)); 144 return array.Equals(String::Cast(obj));
143 } 145 }
144 static bool IsMatch(const StringSlice& slice, const Object& obj) { 146 static bool IsMatch(const StringSlice& slice, const Object& obj) {
145 return slice.Equals(String::Cast(obj)); 147 return slice.Equals(String::Cast(obj));
146 } 148 }
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { 689 RawObject* Symbols::GetVMSymbol(intptr_t object_id) {
688 ASSERT(IsVMSymbolId(object_id)); 690 ASSERT(IsVMSymbolId(object_id));
689 intptr_t i = (object_id - kMaxPredefinedObjectIds); 691 intptr_t i = (object_id - kMaxPredefinedObjectIds);
690 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { 692 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) {
691 return symbol_handles_[i]->raw(); 693 return symbol_handles_[i]->raw();
692 } 694 }
693 return Object::null(); 695 return Object::null();
694 } 696 }
695 697
696 } // namespace dart 698 } // 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