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

Unified Diff: vm/symbols.h

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« vm/object.cc ('K') | « vm/snapshot.cc ('k') | vm/symbols.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« vm/object.cc ('K') | « vm/snapshot.cc ('k') | vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698