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

Unified Diff: src/scanner.h

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/runtime.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
===================================================================
--- src/scanner.h (revision 3427)
+++ src/scanner.h (working copy)
@@ -251,11 +251,27 @@
void Step(uc32 input);
};
+class ScannerData {
+ public:
+ unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace_;
+ private:
+ unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart_;
+ unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart_;
+ unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator_;
+ typedef unibrow::Utf8InputBuffer<1024> Utf8Decoder;
+ StaticResource<Utf8Decoder> utf8_decoder_;
+
+ friend class V8Context;
+ friend class Scanner;
+ ScannerData();
+ DISALLOW_COPY_AND_ASSIGN(ScannerData);
+};
+
class Scanner {
public:
- typedef unibrow::Utf8InputBuffer<1024> Utf8Decoder;
+ typedef ScannerData::Utf8Decoder Utf8Decoder;
// Construction
explicit Scanner(bool is_pre_parsing);
@@ -334,17 +350,14 @@
Handle<String> SubString(int start_pos, int end_pos);
bool stack_overflow() { return stack_overflow_; }
- static StaticResource<Utf8Decoder>* utf8_decoder() { return &utf8_decoder_; }
+ static StaticResource<Utf8Decoder>* utf8_decoder() {
+ return &v8_context()->scanner_data_.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;
private:
@@ -361,8 +374,6 @@
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_;
@@ -377,6 +388,7 @@
TokenDesc next_; // desc for next token (one token look-ahead)
bool has_line_terminator_before_next_;
bool is_pre_parsing_;
+ ScannerData& scanner_data_;
// Literal buffer support
void StartLiteral();
« no previous file with comments | « src/runtime.cc ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698