Index: src/parser.h |
=================================================================== |
--- src/parser.h (revision 7267) |
+++ src/parser.h (working copy) |
@@ -388,6 +388,8 @@ |
int disjunction_capture_index_; |
}; |
+ Isolate* isolate() { return isolate_; } |
+ |
uc32 current() { return current_; } |
bool has_more() { return has_more_; } |
bool has_next() { return next_pos_ < in()->length(); } |
@@ -395,6 +397,7 @@ |
FlatStringReader* in() { return in_; } |
void ScanForCaptures(); |
+ Isolate* isolate_; |
Handle<String>* error_; |
ZoneList<RegExpCapture*>* captures_; |
FlatStringReader* in_; |
@@ -449,6 +452,8 @@ |
PARSE_EAGERLY |
}; |
+ Isolate* isolate() { return isolate_; } |
+ |
// Called by ParseProgram after setting up the scanner. |
FunctionLiteral* DoParseProgram(Handle<String> source, |
bool in_global_context, |
@@ -574,7 +579,7 @@ |
if (stack_overflow_) { |
return Token::ILLEGAL; |
} |
- if (StackLimitCheck().HasOverflowed()) { |
+ if (StackLimitCheck(isolate()).HasOverflowed()) { |
// Any further calls to Next or peek will return the illegal token. |
// The current call must return the next token, which might already |
// have been peek'ed. |
@@ -592,21 +597,21 @@ |
Handle<String> LiteralString(PretenureFlag tenured) { |
if (scanner().is_literal_ascii()) { |
- return Factory::NewStringFromAscii(scanner().literal_ascii_string(), |
- tenured); |
+ return isolate_->factory()->NewStringFromAscii( |
+ scanner().literal_ascii_string(), tenured); |
} else { |
- return Factory::NewStringFromTwoByte(scanner().literal_uc16_string(), |
- tenured); |
+ return isolate_->factory()->NewStringFromTwoByte( |
+ scanner().literal_uc16_string(), tenured); |
} |
} |
Handle<String> NextLiteralString(PretenureFlag tenured) { |
if (scanner().is_next_literal_ascii()) { |
- return Factory::NewStringFromAscii(scanner().next_literal_ascii_string(), |
- tenured); |
+ return isolate_->factory()->NewStringFromAscii( |
+ scanner().next_literal_ascii_string(), tenured); |
} else { |
- return Factory::NewStringFromTwoByte(scanner().next_literal_uc16_string(), |
- tenured); |
+ return isolate_->factory()->NewStringFromTwoByte( |
+ scanner().next_literal_uc16_string(), tenured); |
} |
} |
@@ -686,6 +691,7 @@ |
Handle<String> type, |
Vector< Handle<Object> > arguments); |
+ Isolate* isolate_; |
ZoneList<Handle<String> > symbol_cache_; |
Handle<Script> script_; |
@@ -765,9 +771,11 @@ |
} |
private: |
- JsonParser() { } |
+ JsonParser() : isolate_(Isolate::Current()), scanner_(isolate_) { } |
~JsonParser() { } |
+ Isolate* isolate() { return isolate_; } |
+ |
// Parse a string containing a single JSON value. |
Handle<Object> ParseJson(Handle<String> script, UC16CharacterStream* source); |
// Parse a single JSON value from input (grammar production JSONValue). |
@@ -794,6 +802,7 @@ |
// Converts the currently parsed literal to a JavaScript String. |
Handle<String> GetString(); |
+ Isolate* isolate_; |
JsonScanner scanner_; |
bool stack_overflow_; |
}; |