| Index: src/parser.h
|
| diff --git a/src/parser.h b/src/parser.h
|
| index 216ee66e2985dddbd4346d9e3b2831fd48bbab6c..30a9f327df899e7ae068d6387d213c04d1f817e1 100644
|
| --- a/src/parser.h
|
| +++ b/src/parser.h
|
| @@ -413,9 +413,15 @@ class ParserTraits {
|
|
|
| // Used by FunctionState and BlockState.
|
| typedef v8::internal::Scope Scope;
|
| + typedef v8::internal::Scope* ScopePtr;
|
| typedef Variable GeneratorVariable;
|
| typedef v8::internal::Zone Zone;
|
|
|
| + typedef v8::internal::AstProperties AstProperties;
|
| + typedef v8::internal::DeferredFeedbackSlotProcessor
|
| + DeferredFeedbackSlotProcessor;
|
| + typedef Vector<VariableProxy*> ParameterIdentifierVector;
|
| +
|
| // Return types for traversing functions.
|
| typedef Handle<String> Identifier;
|
| typedef v8::internal::Expression* Expression;
|
| @@ -425,6 +431,7 @@ class ParserTraits {
|
| typedef ObjectLiteral::Property* ObjectLiteralProperty;
|
| typedef ZoneList<v8::internal::Expression*>* ExpressionList;
|
| typedef ZoneList<ObjectLiteral::Property*>* PropertyList;
|
| + typedef ZoneList<v8::internal::Statement*>* StatementList;
|
|
|
| // For constructing objects returned by the traversing functions.
|
| typedef AstNodeFactory<AstConstructionVisitor> Factory;
|
| @@ -474,6 +481,10 @@ class ParserTraits {
|
| fni->PushLiteralName(id);
|
| }
|
| void PushPropertyName(FuncNameInferrer* fni, Expression* expression);
|
| + static void InferFunctionName(FuncNameInferrer* fni,
|
| + FunctionLiteral* func_to_infer) {
|
| + fni->AddFunction(func_to_infer);
|
| + }
|
|
|
| static void CheckFunctionLiteralInsideTopLevelObjectLiteral(
|
| Scope* scope, Expression* value, bool* has_function) {
|
| @@ -562,11 +573,15 @@ class ParserTraits {
|
| static Literal* EmptyLiteral() {
|
| return NULL;
|
| }
|
| +
|
| // Used in error return values.
|
| static ZoneList<Expression*>* NullExpressionList() {
|
| return NULL;
|
| }
|
|
|
| + // Non-"null" empty string.
|
| + V8_INLINE Handle<String> EmptyIdentifierString();
|
| +
|
| // Odd-ball literal creators.
|
| Literal* GetLiteralTheHole(int position,
|
| AstNodeFactory<AstConstructionVisitor>* factory);
|
| @@ -576,7 +591,8 @@ class ParserTraits {
|
| Handle<String> NextLiteralString(Scanner* scanner,
|
| PretenureFlag tenured);
|
| Expression* ThisExpression(Scope* scope,
|
| - AstNodeFactory<AstConstructionVisitor>* factory);
|
| + AstNodeFactory<AstConstructionVisitor>* factory,
|
| + int pos = RelocInfo::kNoPosition);
|
| Literal* ExpressionFromLiteral(
|
| Token::Value token, int pos, Scanner* scanner,
|
| AstNodeFactory<AstConstructionVisitor>* factory);
|
| @@ -592,6 +608,15 @@ class ParserTraits {
|
| ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) {
|
| return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone);
|
| }
|
| + ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) {
|
| + return new(zone) ZoneList<v8::internal::Statement*>(size, zone);
|
| + }
|
| + V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type);
|
| +
|
| + // Utility functions
|
| + Vector<VariableProxy*> ParameterListFromExpression(
|
| + Expression* expression, bool* ok);
|
| + void InferFunctionName(FunctionLiteral* func_to_infer);
|
|
|
| // Temporary glue; these functions will move to ParserBase.
|
| Expression* ParseV8Intrinsic(bool* ok);
|
| @@ -603,6 +628,21 @@ class ParserTraits {
|
| int function_token_position,
|
| FunctionLiteral::FunctionType type,
|
| bool* ok);
|
| + V8_INLINE void SkipLazyFunctionBody(
|
| + Handle<String> function_name,
|
| + int* materialized_literal_count,
|
| + int* expected_property_count,
|
| + bool* ok);
|
| + V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody(
|
| + Handle<String> function_name,
|
| + int pos,
|
| + Variable* fvar,
|
| + Token::Value fvar_init_op,
|
| + bool is_generator,
|
| + bool* ok);
|
| + V8_INLINE void CheckConflictingVarDeclarations(
|
| + v8::internal::Scope* scope,
|
| + bool* ok);
|
|
|
| private:
|
| Parser* parser_;
|
| @@ -784,6 +824,9 @@ class Parser : public ParserBase<ParserTraits> {
|
|
|
| void RegisterTargetUse(Label* target, Target* stop);
|
|
|
| + Vector<VariableProxy*> ParameterListFromExpression(Expression* expression,
|
| + bool* ok);
|
| +
|
| // Factory methods.
|
|
|
| Scope* NewScope(Scope* parent, ScopeType type);
|
| @@ -823,6 +866,42 @@ class Parser : public ParserBase<ParserTraits> {
|
| };
|
|
|
|
|
| +Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type) {
|
| + return parser_->NewScope(parent_scope, scope_type);
|
| +}
|
| +
|
| +
|
| +Handle<String> ParserTraits::EmptyIdentifierString() {
|
| + return parser_->isolate()->factory()->empty_string();
|
| +}
|
| +
|
| +
|
| +void ParserTraits::SkipLazyFunctionBody(
|
| + Handle<String> function_name,
|
| + int* materialized_literal_count,
|
| + int* expected_property_count,
|
| + bool* ok) {
|
| + return parser_->SkipLazyFunctionBody(function_name,
|
| + materialized_literal_count, expected_property_count, ok);
|
| +}
|
| +
|
| +
|
| +ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody(
|
| + Handle<String> function_name,
|
| + int pos,
|
| + Variable* fvar,
|
| + Token::Value fvar_init_op,
|
| + bool is_generator,
|
| + bool* ok) {
|
| + return parser_->ParseEagerFunctionBody(function_name, pos,
|
| + fvar, fvar_init_op, is_generator, ok);
|
| +}
|
| +
|
| +void ParserTraits::CheckConflictingVarDeclarations(
|
| + v8::internal::Scope* scope, bool* ok) {
|
| + parser_->CheckConflictingVarDeclarations(scope, ok);
|
| +}
|
| +
|
| // Support for handling complex values (array and object literals) that
|
| // can be fully handled at compile time.
|
| class CompileTimeValue: public AllStatic {
|
|
|