| 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 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 // Forward declarations. | 13 // Forward declarations. |
| 14 class Isolate; | 14 class Isolate; |
| 15 class ObjectPointerVisitor; | 15 class ObjectPointerVisitor; |
| 16 | 16 |
| 17 #define PREDEFINED_SYMBOLS_LIST(V) \ | 17 #define PREDEFINED_SYMBOLS_LIST(V) \ |
| 18 V(Empty, "") \ |
| 18 V(Dot, ".") \ | 19 V(Dot, ".") \ |
| 19 V(Equals, "=") \ | 20 V(Equals, "=") \ |
| 20 V(IndexToken, "[]") \ | 21 V(IndexToken, "[]") \ |
| 21 V(AssignIndexToken, "[]=") \ | 22 V(AssignIndexToken, "[]=") \ |
| 22 V(TopLevel, "::") \ | 23 V(TopLevel, "::") \ |
| 23 V(Empty, "") \ | 24 V(DefaultLabel, ":L") \ |
| 24 V(This, "this") \ | 25 V(This, "this") \ |
| 25 V(HasNext, "hasNext") \ | 26 V(HasNext, "hasNext") \ |
| 26 V(Next, "next") \ | 27 V(Next, "next") \ |
| 27 V(Value, "value") \ | 28 V(Value, "value") \ |
| 28 V(ExprTemp, ":expr_temp") \ | 29 V(ExprTemp, ":expr_temp") \ |
| 29 V(AnonymousClosure, "<anonymous closure>") \ | 30 V(AnonymousClosure, "<anonymous closure>") \ |
| 30 V(PhaseParameter, ":phase") \ | 31 V(PhaseParameter, ":phase") \ |
| 31 V(TypeArgumentsParameter, ":type_arguments") \ | 32 V(TypeArgumentsParameter, ":type_arguments") \ |
| 32 V(AssertionError, "AssertionErrorImplementation") \ | 33 V(AssertionError, "AssertionErrorImplementation") \ |
| 33 V(TypeError, "TypeErrorImplementation") \ | 34 V(TypeError, "TypeErrorImplementation") \ |
| 34 V(FallThroughError, "FallThroughErrorImplementation") \ | 35 V(FallThroughError, "FallThroughErrorImplementation") \ |
| 35 V(StaticResolutionException, "StaticResolutionException") \ | 36 V(StaticResolutionException, "StaticResolutionException") \ |
| 36 V(ThrowNew, "_throwNew") \ | 37 V(ThrowNew, "_throwNew") \ |
| 37 V(ListLiteralFactoryClass, "_ListLiteralFactory") \ | 38 V(ListLiteralFactoryClass, "_ListLiteralFactory") \ |
| 38 V(ListLiteralFactory, "List.fromLiteral") \ | 39 V(ListLiteralFactory, "List.fromLiteral") \ |
| 39 V(MapLiteralFactoryClass, "_MapLiteralFactory") \ | 40 V(MapLiteralFactoryClass, "_MapLiteralFactory") \ |
| 40 V(MapLiteralFactory, "Map.fromLiteral") \ | 41 V(MapLiteralFactory, "Map.fromLiteral") \ |
| 41 V(ImmutableMap, "ImmutableMap") \ | 42 V(ImmutableMap, "ImmutableMap") \ |
| 42 V(ImmutableMapConstructor, "ImmutableMap._create") \ | 43 V(ImmutableMapConstructor, "ImmutableMap._create") \ |
| 43 V(StringBase, "StringBase") \ | 44 V(StringBase, "StringBase") \ |
| 44 V(Interpolate, "_interpolate") \ | 45 V(Interpolate, "_interpolate") \ |
| 45 V(GetIterator, "iterator") \ | 46 V(GetIterator, "iterator") \ |
| 46 V(NoSuchMethod, "noSuchMethod") \ | 47 V(NoSuchMethod, "noSuchMethod") \ |
| 48 V(SavedArgDescVarPrefix, ":saved_args_desc_var") \ |
| 49 V(SavedEntryContextVar, ":saved_entry_context_var") \ |
| 47 V(SavedContextVar, ":saved_context_var") \ | 50 V(SavedContextVar, ":saved_context_var") \ |
| 48 V(ExceptionVar, ":exception_var") \ | 51 V(ExceptionVar, ":exception_var") \ |
| 49 V(StacktraceVar, ":stacktrace_var") \ | 52 V(StacktraceVar, ":stacktrace_var") \ |
| 50 V(ListLiteralElement, "list literal element") \ | 53 V(ListLiteralElement, "list literal element") \ |
| 51 V(ForInIter, ":for-in-iter") \ | 54 V(ForInIter, ":for-in-iter") \ |
| 52 V(Library, "library") \ | 55 V(Library, "library") \ |
| 53 V(Import, "import") \ | 56 V(Import, "import") \ |
| 54 V(Source, "source") \ | 57 V(Source, "source") \ |
| 55 V(Resource, "resource") \ | 58 V(Resource, "resource") \ |
| 56 V(Class, "Class") \ | 59 V(Class, "Class") \ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 163 |
| 161 // Helper functions to create a symbol given a string or set of characters. | 164 // Helper functions to create a symbol given a string or set of characters. |
| 162 static RawString* New(const char* str); | 165 static RawString* New(const char* str); |
| 163 template<typename T> | 166 template<typename T> |
| 164 static RawString* New(const T* characters, intptr_t len); | 167 static RawString* New(const T* characters, intptr_t len); |
| 165 static RawString* New(const String& str); | 168 static RawString* New(const String& str); |
| 166 static RawString* New(const String& str, | 169 static RawString* New(const String& str, |
| 167 intptr_t begin_index, | 170 intptr_t begin_index, |
| 168 intptr_t length); | 171 intptr_t length); |
| 169 | 172 |
| 173 // Returns char* of predefined symbol. |
| 174 static const char* Name(intptr_t symbol); |
| 170 | 175 |
| 171 private: | 176 private: |
| 172 enum { | 177 enum { |
| 173 kInitialVMIsolateSymtabSize = ((Symbols::kMaxId + 15) & -16), | 178 kInitialVMIsolateSymtabSize = ((Symbols::kMaxId + 15) & -16), |
| 174 kInitialSymtabSize = 256 | 179 kInitialSymtabSize = 256 |
| 175 }; | 180 }; |
| 176 | 181 |
| 177 // Add the string into the VM isolate symbol table. | 182 // Add the string into the VM isolate symbol table. |
| 178 static void Add(const Array& symbol_table, const String& str); | 183 static void Add(const Array& symbol_table, const String& str); |
| 179 | 184 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 210 friend class SnapshotReader; | 215 friend class SnapshotReader; |
| 211 friend class SnapshotWriter; | 216 friend class SnapshotWriter; |
| 212 friend class ApiMessageReader; | 217 friend class ApiMessageReader; |
| 213 | 218 |
| 214 DISALLOW_COPY_AND_ASSIGN(Symbols); | 219 DISALLOW_COPY_AND_ASSIGN(Symbols); |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 } // namespace dart | 222 } // namespace dart |
| 218 | 223 |
| 219 #endif // VM_SYMBOLS_H_ | 224 #endif // VM_SYMBOLS_H_ |
| OLD | NEW |