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

Unified Diff: src/scanner.h

Issue 2831016: [Isolates] Static mutable data of Scanner class moved to ScannerCharacterClasses / Isolate. (Closed)
Patch Set: . Created 10 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 | « src/objects.cc ('k') | src/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index d5efdff97c6f805177fb778c83fc5cc6bf5ddf91..0ec7a7ae904b4ba7eedf0ae89e2da61a561a130b 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -258,6 +258,9 @@ class KeywordMatcher {
};
+class ScannerCharacterClasses;
+
+
enum ParserMode { PARSE, PREPARSE };
enum ParserLanguage { JAVASCRIPT, JSON };
@@ -347,17 +350,6 @@ class Scanner {
bool stack_overflow() { return stack_overflow_; }
- static StaticResource<Utf8Decoder>* utf8_decoder() { return &utf8_decoder_; }
-
- // Tells whether the buffer contains an identifier (no escapes).
- // Used for checking if a property name is an identifier.
- static bool IsIdentifier(unibrow::CharacterStream* buffer);
-
- static unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart;
- static unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart;
- static unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator;
- static unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace;
-
static const int kCharacterLookaheadBufferSize = 1;
static const int kNoEndPosition = 1;
@@ -388,7 +380,6 @@ class Scanner {
UTF8Buffer literal_buffer_2_;
bool stack_overflow_;
- static StaticResource<Utf8Decoder> utf8_decoder_;
// One Unicode character look-ahead; c0_ < 0 at the end of the input.
uc32 c0_;
@@ -406,6 +397,8 @@ class Scanner {
bool is_pre_parsing_;
bool is_parsing_json_;
+ ScannerCharacterClasses* const character_classes_;
+
// Literal buffer support
void StartLiteral();
void AddChar(uc32 ch);
@@ -491,6 +484,38 @@ class Scanner {
uc32 ScanIdentifierUnicodeEscape();
};
+
+class ScannerCharacterClasses {
+ public:
+ StaticResource<Scanner::Utf8Decoder>* utf8_decoder() {
+ return &utf8_decoder_;
+ }
+
+ // Tells whether the buffer contains an identifier (no escapes).
+ // Used for checking if a property name is an identifier.
+ bool IsIdentifier(unibrow::CharacterStream* buffer);
+
+ bool IsWhiteSpace(unibrow::uchar c) { return is_white_space_.get(c); }
+
+ private:
+ ScannerCharacterClasses() {}
+
+ // --------------------------------------------------------------------------
+ // Character predicates
+
+ unibrow::Predicate<IdentifierStart, 128> is_identifier_start_;
+ unibrow::Predicate<IdentifierPart, 128> is_identifier_part_;
+ unibrow::Predicate<unibrow::LineTerminator, 128> is_line_terminator_;
+ unibrow::Predicate<unibrow::WhiteSpace, 128> is_white_space_;
+
+ StaticResource<Scanner::Utf8Decoder> utf8_decoder_;
+
+ friend class Isolate;
+ friend class Scanner;
+
+ DISALLOW_COPY_AND_ASSIGN(ScannerCharacterClasses);
+};
+
} } // namespace v8::internal
#endif // V8_SCANNER_H_
« no previous file with comments | « src/objects.cc ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698