| OLD | NEW |
| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return reinterpret_cast<RawString**>(&predefined_); | 208 return reinterpret_cast<RawString**>(&predefined_); |
| 209 } | 209 } |
| 210 | 210 |
| 211 private: | 211 private: |
| 212 enum { | 212 enum { |
| 213 kInitialVMIsolateSymtabSize = ((kMaxId + 15) & -16), | 213 kInitialVMIsolateSymtabSize = ((kMaxId + 15) & -16), |
| 214 kInitialSymtabSize = 256 | 214 kInitialSymtabSize = 256 |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 // Helper functions to create a symbol given a string or set of characters. | 217 // Helper functions to create a symbol given a string or set of characters. |
| 218 template<typename T> | 218 template<typename CharacterType, typename CallbackType> |
| 219 static RawString* NewSymbol(const T* characters, intptr_t len); | 219 static RawString* NewSymbol(const CharacterType* characters, |
| 220 intptr_t len, |
| 221 CallbackType new_string); |
| 220 | 222 |
| 221 // Add the string into the VM isolate symbol table. | 223 // Add the string into the VM isolate symbol table. |
| 222 static void Add(const Array& symbol_table, const String& str); | 224 static void Add(const Array& symbol_table, const String& str); |
| 223 | 225 |
| 224 // Insert symbol into symbol table, growing it if necessary. | 226 // Insert symbol into symbol table, growing it if necessary. |
| 225 static void InsertIntoSymbolTable(const Array& symbol_table, | 227 static void InsertIntoSymbolTable(const Array& symbol_table, |
| 226 const String& symbol, | 228 const String& symbol, |
| 227 intptr_t index); | 229 intptr_t index); |
| 228 | 230 |
| 229 // Grow the symbol table. | 231 // Grow the symbol table. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 255 friend class SnapshotReader; | 257 friend class SnapshotReader; |
| 256 friend class SnapshotWriter; | 258 friend class SnapshotWriter; |
| 257 friend class ApiMessageReader; | 259 friend class ApiMessageReader; |
| 258 | 260 |
| 259 DISALLOW_COPY_AND_ASSIGN(Symbols); | 261 DISALLOW_COPY_AND_ASSIGN(Symbols); |
| 260 }; | 262 }; |
| 261 | 263 |
| 262 } // namespace dart | 264 } // namespace dart |
| 263 | 265 |
| 264 #endif // VM_SYMBOLS_H_ | 266 #endif // VM_SYMBOLS_H_ |
| OLD | NEW |