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

Unified Diff: runtime/vm/scanner.h

Issue 315303002: Improve scanner performance by remembering string's CharAt function as the string type does not cha… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scanner.h
===================================================================
--- runtime/vm/scanner.h (revision 37049)
+++ runtime/vm/scanner.h (working copy)
@@ -25,6 +25,8 @@
// GetStream() scans the entire source text and returns a stream of tokens.
class Scanner : ValueObject {
public:
+ typedef int32_t (*CharAtFunc)(const String& str, intptr_t index);
+
// SourcePosition describes a text location in user friendly
// terms of line number and column.
struct SourcePosition {
@@ -75,7 +77,7 @@
static void InitOnce();
// Return true if str is an identifier.
- static bool IsIdent(const String& str);
+ bool IsIdent(const String& str);
// Does the token stream contain a valid literal. This is used to implement
// the Dart methods int.parse and double.parse.
@@ -182,6 +184,10 @@
void ScanScriptTag();
+ CharAtFunc CallCharAt() const { return char_at_func_; }
+
+ Isolate* isolate() const { return isolate_; }
+
static void PrintTokens(const GrowableTokenStream& ts);
TokenDescriptor current_token_; // Current token.
@@ -207,6 +213,10 @@
SourcePosition c0_pos_; // Source position of lookahead character c0_.
+ const CharAtFunc char_at_func_;
+
+ Isolate* isolate_;
+
static KeywordTable keywords_[Token::kNumKeywords];
static int keywords_char_offset_[kNumLowercaseChars];
};
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698