Index: vm/symbols.h |
=================================================================== |
--- vm/symbols.h (revision 0) |
+++ vm/symbols.h (revision 0) |
@@ -0,0 +1,48 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#ifndef VM_SYMBOLS_H_ |
+#define VM_SYMBOLS_H_ |
+ |
+#include "vm/object.h" |
+ |
+namespace dart { |
+ |
+// Forward declarations. |
+class Isolate; |
+class ObjectPointerVisitor; |
+ |
+// Contains a list of frequently used strings in a canonicalized form. This |
+// list is kept in the vm_isolate in order to share the copy across isolates |
+// without having to maintain copies in each isolate. |
+class Symbols { |
+ public: |
+ ~Symbols(); |
+ |
+ void VisitObjectPointers(ObjectPointerVisitor* visitor); |
+ |
+ // Access methods for symbols stored in the vm isolate. |
+ static RawString* Dot() { return Dart::vm_isolate()->symbols()->dot_; } |
Ivan Posva
2012/07/18 04:09:22
static RawString dot() { return dot_; }
See below
siva
2012/07/19 01:12:34
Done.
|
+ |
+ // Initialize frequently used symbols in the vm isolate. |
+ static void Init(Isolate* isolate); |
+ |
+ private: |
+ Symbols(); |
+ |
+ RawObject** from() { return reinterpret_cast<RawObject**>(&dot_); } |
Ivan Posva
2012/07/18 04:09:22
from() and to() should not be needed, neither is V
siva
2012/07/19 01:12:34
Done.
|
+ |
+ // List of symbols that are stored in the vm isolate for easy access. |
+ RawString* dot_; // "." string. |
Ivan Posva
2012/07/18 04:09:22
Why is this not a static? That would avoid having
siva
2012/07/19 01:12:34
Made a static entry.
On 2012/07/18 04:09:22, Ivan
|
+ |
+ RawObject** to() { return reinterpret_cast<RawObject**>(&dot_); } |
+ |
+ friend class SnapshotReader; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(Symbols); |
+}; |
+ |
+} // namespace dart |
+ |
+#endif // VM_SYMBOLS_H_ |