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

Unified Diff: runtime/vm/symbols.h

Issue 11369259: Add one-char string table for faster String.charAt to the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 8 years, 1 month 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/symbols.h
===================================================================
--- runtime/vm/symbols.h (revision 15087)
+++ runtime/vm/symbols.h (working copy)
@@ -146,16 +146,19 @@
// without having to maintain copies in each isolate.
class Symbols : public AllStatic {
public:
+ enum { kMaxOneCharCodeSymbol = 0xFF };
+
// List of strings that are pre created in the vm isolate.
- enum {
+ enum SymbolId {
kIllegal = 0,
#define DEFINE_SYMBOL_INDEX(symbol, literal) \
k##symbol,
PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_INDEX)
#undef DEFINE_SYMBOL_INDEX
-
- kMaxId,
+ kMaxPredefinedId,
+ kNullCharId = kMaxPredefinedId,
+ kMaxId = kNullCharId + kMaxOneCharCodeSymbol + 1,
};
// Access methods for symbols stored in the vm isolate.
@@ -183,11 +186,13 @@
intptr_t length);
// Returns char* of predefined symbol.
- static const char* Name(intptr_t symbol);
+ static const char* Name(SymbolId symbol);
+ static RawString* FromCharCode(uint32_t char_code);
+
private:
enum {
- kInitialVMIsolateSymtabSize = ((Symbols::kMaxId + 15) & -16),
+ kInitialVMIsolateSymtabSize = ((kMaxId + 15) & -16),
kInitialSymtabSize = 256
};
@@ -218,11 +223,11 @@
static RawObject* GetVMSymbol(intptr_t object_id);
static bool IsVMSymbolId(intptr_t object_id) {
return (object_id >= kMaxPredefinedObjectIds &&
- object_id < (kMaxPredefinedObjectIds + Symbols::kMaxId));
+ object_id < (kMaxPredefinedObjectIds + kMaxId));
}
// List of symbols that are stored in the vm isolate for easy access.
- static RawString* predefined_[Symbols::kMaxId];
+ static RawString* predefined_[kMaxId];
friend class SnapshotReader;
friend class SnapshotWriter;
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698