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

Side by Side Diff: vm/symbols.h

Issue 11416356: Add dump_symbol_stats to dump symbol table stats at the end of a test run (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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 | « vm/isolate.cc ('k') | vm/symbols.cc » ('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) 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 #ifndef VM_SYMBOLS_H_ 5 #ifndef VM_SYMBOLS_H_
6 #define VM_SYMBOLS_H_ 6 #define VM_SYMBOLS_H_
7 7
8 #include "vm/object.h" 8 #include "vm/object.h"
9 #include "vm/snapshot_ids.h" 9 #include "vm/snapshot_ids.h"
10 10
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 static const char* Name(SymbolId symbol); 219 static const char* Name(SymbolId symbol);
220 220
221 static RawString* FromCharCode(int32_t char_code); 221 static RawString* FromCharCode(int32_t char_code);
222 222
223 static RawString** PredefinedAddress() { 223 static RawString** PredefinedAddress() {
224 return reinterpret_cast<RawString**>(&predefined_); 224 return reinterpret_cast<RawString**>(&predefined_);
225 } 225 }
226 226
227 static bool IsPredefinedHandle(uword address); 227 static bool IsPredefinedHandle(uword address);
228 228
229 static void DumpStats();
230
229 private: 231 private:
230 enum { 232 enum {
231 kInitialVMIsolateSymtabSize = ((kMaxId + 15) & -16), 233 kInitialVMIsolateSymtabSize = 512,
232 kInitialSymtabSize = 256 234 kInitialSymtabSize = 2048
233 }; 235 };
234 236
235 // Helper functions to create a symbol given a string or set of characters. 237 // Helper functions to create a symbol given a string or set of characters.
236 template<typename CharacterType, typename CallbackType> 238 template<typename CharacterType, typename CallbackType>
237 static RawString* NewSymbol(const CharacterType* characters, 239 static RawString* NewSymbol(const CharacterType* characters,
238 intptr_t len, 240 intptr_t len,
239 CallbackType new_string); 241 CallbackType new_string);
240 242
241 // Add the string into the VM isolate symbol table. 243 // Add the string into the VM isolate symbol table.
242 static void Add(const Array& symbol_table, const String& str); 244 static void Add(const Array& symbol_table, const String& str);
(...skipping 25 matching lines...) Expand all
268 object_id < (kMaxPredefinedObjectIds + kMaxId)); 270 object_id < (kMaxPredefinedObjectIds + kMaxId));
269 } 271 }
270 272
271 // List of symbols that are stored in the vm isolate for easy access. 273 // List of symbols that are stored in the vm isolate for easy access.
272 static RawString* predefined_[kMaxId]; 274 static RawString* predefined_[kMaxId];
273 275
274 // Structure for managing handles allocation for symbols that are 276 // Structure for managing handles allocation for symbols that are
275 // stored in the vm isolate. 277 // stored in the vm isolate.
276 static VMHandles predefined_handles_; 278 static VMHandles predefined_handles_;
277 279
280 // Statistics used to measure the efficiency of the symbol table.
281 static const intptr_t kMaxCollisionBuckets = 10;
282 static intptr_t num_of_grows_;
283 static intptr_t collision_count_[kMaxCollisionBuckets];
284
278 #define DECLARE_SYMBOL_HANDLE(symbol) \ 285 #define DECLARE_SYMBOL_HANDLE(symbol) \
279 static String* symbol##_handle_; 286 static String* symbol##_handle_;
280 PREDEFINED_SYMBOL_HANDLES_LIST(DECLARE_SYMBOL_HANDLE) 287 PREDEFINED_SYMBOL_HANDLES_LIST(DECLARE_SYMBOL_HANDLE)
281 #undef DECLARE_SYMBOL_HANDLE 288 #undef DECLARE_SYMBOL_HANDLE
282 289
283 friend class String; 290 friend class String;
284 friend class SnapshotReader; 291 friend class SnapshotReader;
285 friend class SnapshotWriter; 292 friend class SnapshotWriter;
286 friend class ApiMessageReader; 293 friend class ApiMessageReader;
287 294
288 DISALLOW_COPY_AND_ASSIGN(Symbols); 295 DISALLOW_COPY_AND_ASSIGN(Symbols);
289 }; 296 };
290 297
291 } // namespace dart 298 } // namespace dart
292 299
293 #endif // VM_SYMBOLS_H_ 300 #endif // VM_SYMBOLS_H_
OLDNEW
« no previous file with comments | « vm/isolate.cc ('k') | vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698