Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 5e37d632fdb8bffbf9e767da466a1eff34ec3c1e..882d77f465ef7b6eaaa8a5fde75dd155531d4d6a 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -68,9 +68,9 @@ class ParserBase : public Traits { |
typedef typename Traits::Type::Literal LiteralT; |
typedef typename Traits::Type::ObjectLiteralProperty ObjectLiteralPropertyT; |
- ParserBase(Scanner* scanner, uintptr_t stack_limit, v8::Extension* extension, |
- ParserRecorder* log, typename Traits::Type::Zone* zone, |
- typename Traits::Type::Parser this_object) |
+ ParserBase(Isolate* isolate, typename Traits::Type::Zone* zone, |
+ Scanner* scanner, uintptr_t stack_limit, v8::Extension* extension, |
+ ParserRecorder* log, typename Traits::Type::Parser this_object) |
: Traits(this_object), |
parenthesized_function_(false), |
scope_(NULL), |
@@ -80,6 +80,8 @@ class ParserBase : public Traits { |
log_(log), |
mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly. |
stack_limit_(stack_limit), |
+ isolate_(isolate), |
+ zone_(zone), |
scanner_(scanner), |
stack_overflow_(false), |
allow_lazy_(false), |
@@ -87,8 +89,7 @@ class ParserBase : public Traits { |
allow_harmony_arrow_functions_(false), |
allow_harmony_object_literals_(false), |
allow_harmony_sloppy_(false), |
- allow_harmony_computed_property_names_(false), |
- zone_(zone) {} |
+ allow_harmony_computed_property_names_(false) {} |
// Getters that indicate whether certain syntactical constructs are |
// allowed to be parsed by this instance of the parser. |
@@ -593,6 +594,8 @@ class ParserBase : public Traits { |
StrictMode strict_mode_; |
}; |
+ Isolate* isolate() const { return isolate_; } |
Michael Starzinger
2015/01/23 14:21:11
nit: Could we move this up to around line 300 near
danno
2015/01/23 14:45:20
Done.
|
+ |
// If true, the next (and immediately following) function literal is |
// preceded by a parenthesis. |
// Heuristically that means that the function will be called immediately, |
@@ -608,6 +611,9 @@ class ParserBase : public Traits { |
uintptr_t stack_limit_; |
private: |
+ Isolate* isolate_; |
+ typename Traits::Type::Zone* zone_; // Only used by Parser. |
+ |
Scanner* scanner_; |
bool stack_overflow_; |
@@ -617,8 +623,6 @@ class ParserBase : public Traits { |
bool allow_harmony_object_literals_; |
bool allow_harmony_sloppy_; |
bool allow_harmony_computed_property_names_; |
- |
- typename Traits::Type::Zone* zone_; // Only used by Parser. |
}; |
@@ -1029,7 +1033,7 @@ class PreParserScope { |
class PreParserFactory { |
public: |
- explicit PreParserFactory(void* unused_value_factory) {} |
+ explicit PreParserFactory(Isolate* isolate, void* unused_value_factory) {} |
PreParserExpression NewStringLiteral(PreParserIdentifier identifier, |
int pos) { |
return PreParserExpression::Default(); |
@@ -1494,9 +1498,10 @@ class PreParser : public ParserBase<PreParserTraits> { |
kPreParseSuccess |
}; |
- PreParser(Scanner* scanner, ParserRecorder* log, uintptr_t stack_limit) |
- : ParserBase<PreParserTraits>(scanner, stack_limit, NULL, log, NULL, |
- this) {} |
+ PreParser(Isolate* isolate, Scanner* scanner, ParserRecorder* log, |
+ uintptr_t stack_limit) |
+ : ParserBase<PreParserTraits>(isolate, NULL, scanner, stack_limit, NULL, |
+ log, this) {} |
// Pre-parse the program from the character stream; returns true on |
// success (even if parsing failed, the pre-parse data successfully |
@@ -1504,7 +1509,7 @@ class PreParser : public ParserBase<PreParserTraits> { |
// during parsing. |
PreParseResult PreParseProgram(int* materialized_literals = 0) { |
PreParserScope scope(scope_, SCRIPT_SCOPE); |
- PreParserFactory factory(NULL); |
+ PreParserFactory factory(NULL, NULL); |
FunctionState top_scope(&function_state_, &scope_, &scope, &factory); |
bool ok = true; |
int start_position = scanner()->peek_location().beg_pos; |
@@ -2807,9 +2812,10 @@ ParserBase<Traits>::ParseMemberExpressionContinuation(ExpressionT expression, |
template <class Traits> |
-typename ParserBase<Traits>::ExpressionT ParserBase< |
- Traits>::ParseArrowFunctionLiteral(int start_pos, ExpressionT params_ast, |
- bool* ok) { |
+typename ParserBase<Traits>::ExpressionT |
+ParserBase<Traits>::ParseArrowFunctionLiteral(int start_pos, |
+ ExpressionT params_ast, |
+ bool* ok) { |
typename Traits::Type::ScopePtr scope = this->NewScope(scope_, ARROW_SCOPE); |
typename Traits::Type::StatementList body; |
int num_parameters = -1; |
@@ -2818,7 +2824,8 @@ typename ParserBase<Traits>::ExpressionT ParserBase< |
int handler_count = 0; |
{ |
- typename Traits::Type::Factory function_factory(this->ast_value_factory()); |
+ typename Traits::Type::Factory function_factory(isolate(), |
+ this->ast_value_factory()); |
FunctionState function_state(&function_state_, &scope_, |
Traits::Type::ptr_to_scope(scope), |
&function_factory); |