| Index: src/parser.h
|
| diff --git a/src/parser.h b/src/parser.h
|
| index 4f872a6e0d257429b0088454179ccc452bc315c3..333a8913a5004ecf1e3db0cb1d350d9333119bdc 100644
|
| --- a/src/parser.h
|
| +++ b/src/parser.h
|
| @@ -389,7 +389,7 @@ class ParserTraits {
|
| typedef v8::internal::Zone Zone;
|
|
|
| // Return types for traversing functions.
|
| - typedef Handle<String> Identifier;
|
| + typedef ParserSymbolTable::Symbol* Identifier;
|
| typedef v8::internal::Expression* Expression;
|
| typedef Yield* YieldExpression;
|
| typedef v8::internal::FunctionLiteral* FunctionLiteral;
|
| @@ -421,29 +421,30 @@ class ParserTraits {
|
| }
|
|
|
| // Helper functions for recursive descent.
|
| - bool IsEvalOrArguments(Handle<String> identifier) const;
|
| + bool IsEvalOrArguments(ParserSymbolTable::Symbol* identifier) const;
|
|
|
| // Returns true if the expression is of type "this.foo".
|
| static bool IsThisProperty(Expression* expression);
|
|
|
| static bool IsIdentifier(Expression* expression);
|
|
|
| - static Handle<String> AsIdentifier(Expression* expression) {
|
| + static ParserSymbolTable::Symbol* AsIdentifier(Expression* expression) {
|
| ASSERT(IsIdentifier(expression));
|
| - return expression->AsVariableProxy()->name();
|
| + return expression->AsVariableProxy()->raw_name();
|
| }
|
|
|
| static bool IsBoilerplateProperty(ObjectLiteral::Property* property) {
|
| return ObjectLiteral::IsBoilerplateProperty(property);
|
| }
|
|
|
| - static bool IsArrayIndex(Handle<String> string, uint32_t* index) {
|
| - return !string.is_null() && string->AsArrayIndex(index);
|
| + static bool IsArrayIndex(ParserSymbolTable::Symbol* string, uint32_t* index) {
|
| + return string != NULL && ParserSymbolTable::IsArrayIndexSlow(string, index);
|
| }
|
|
|
| // Functions for encapsulating the differences between parsing and preparsing;
|
| // operations interleaved with the recursive descent.
|
| - static void PushLiteralName(FuncNameInferrer* fni, Handle<String> id) {
|
| + static void PushLiteralName(FuncNameInferrer* fni,
|
| + ParserSymbolTable::Symbol* id) {
|
| fni->PushLiteralName(id);
|
| }
|
| void PushPropertyName(FuncNameInferrer* fni, Expression* expression);
|
| @@ -501,33 +502,37 @@ class ParserTraits {
|
| // type. The first argument may be null (in the handle sense) in
|
| // which case no arguments are passed to the constructor.
|
| Expression* NewThrowSyntaxError(
|
| - const char* type, Handle<Object> arg, int pos);
|
| + const char* type, ParserSymbolTable::Symbol* arg, int pos);
|
|
|
| // Generate AST node that throws a TypeError with the given
|
| // type. Both arguments must be non-null (in the handle sense).
|
| - Expression* NewThrowTypeError(const char* type, Handle<Object> arg, int pos);
|
| + Expression* NewThrowTypeError(const char* type,
|
| + ParserSymbolTable::Symbol* arg, int pos);
|
|
|
| // Generic AST generator for throwing errors from compiled code.
|
| Expression* NewThrowError(
|
| - Handle<String> constructor, const char* type,
|
| - Vector<Handle<Object> > arguments, int pos);
|
| + ParserSymbolTable::Symbol* constructor, const char* type,
|
| + ParserSymbolTable::Symbol* arg, int pos);
|
|
|
| // Reporting errors.
|
| void ReportMessageAt(Scanner::Location source_location,
|
| const char* message,
|
| - const char* arg,
|
| + const char* arg = NULL,
|
| bool is_reference_error = false);
|
| - void ReportMessage(const char* message,
|
| - MaybeHandle<String> arg,
|
| - bool is_reference_error = false);
|
| void ReportMessageAt(Scanner::Location source_location,
|
| const char* message,
|
| - MaybeHandle<String> arg,
|
| + ParserSymbolTable::Symbol* arg,
|
| bool is_reference_error = false);
|
| + void ReportMessage(const char* message,
|
| + const char* char_arg = NULL,
|
| + bool is_reference_error = false);
|
| + void ReportMessage(const char* message,
|
| + ParserSymbolTable::Symbol* arg,
|
| + bool is_reference_error = false);
|
|
|
| // "null" return type creators.
|
| - static Handle<String> EmptyIdentifier() {
|
| - return Handle<String>();
|
| + static ParserSymbolTable::Symbol* EmptyIdentifier() {
|
| + return NULL;
|
| }
|
| static Expression* EmptyExpression() {
|
| return NULL;
|
| @@ -545,16 +550,16 @@ class ParserTraits {
|
| AstNodeFactory<AstConstructionVisitor>* factory);
|
|
|
| // Producing data during the recursive descent.
|
| - Handle<String> GetSymbol(Scanner* scanner = NULL);
|
| - Handle<String> NextLiteralString(Scanner* scanner,
|
| - PretenureFlag tenured);
|
| + ParserSymbolTable::Symbol* GetSymbol(Scanner* scanner);
|
| + ParserSymbolTable::Symbol* GetNextSymbol(Scanner* scanner);
|
| +
|
| Expression* ThisExpression(Scope* scope,
|
| AstNodeFactory<AstConstructionVisitor>* factory);
|
| Literal* ExpressionFromLiteral(
|
| Token::Value token, int pos, Scanner* scanner,
|
| AstNodeFactory<AstConstructionVisitor>* factory);
|
| Expression* ExpressionFromIdentifier(
|
| - Handle<String> name, int pos, Scope* scope,
|
| + ParserSymbolTable::Symbol* name, int pos, Scope* scope,
|
| AstNodeFactory<AstConstructionVisitor>* factory);
|
| Expression* ExpressionFromString(
|
| int pos, Scanner* scanner,
|
| @@ -572,7 +577,7 @@ class ParserTraits {
|
| // Temporary glue; these functions will move to ParserBase.
|
| Expression* ParseV8Intrinsic(bool* ok);
|
| FunctionLiteral* ParseFunctionLiteral(
|
| - Handle<String> name,
|
| + ParserSymbolTable::Symbol* name,
|
| Scanner::Location function_name_location,
|
| bool name_is_strict_reserved,
|
| bool is_generator,
|
| @@ -643,7 +648,7 @@ class Parser : public ParserBase<ParserTraits> {
|
| Handle<String> source);
|
|
|
| // Report syntax error
|
| - void ReportInvalidCachedData(Handle<String> name, bool* ok);
|
| + void ReportInvalidCachedData(ParserSymbolTable::Symbol* name, bool* ok);
|
|
|
| void SetCachedData(ScriptData** data,
|
| CachedDataMode cached_data_mode) {
|
| @@ -670,8 +675,10 @@ class Parser : public ParserBase<ParserTraits> {
|
| // for failure at the call sites.
|
| void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token,
|
| bool is_eval, bool is_global, bool* ok);
|
| - Statement* ParseModuleElement(ZoneStringList* labels, bool* ok);
|
| - Statement* ParseModuleDeclaration(ZoneStringList* names, bool* ok);
|
| + Statement* ParseModuleElement(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
| + Statement* ParseModuleDeclaration(ZoneList<ParserSymbolTable::Symbol*>* names,
|
| + bool* ok);
|
| Module* ParseModule(bool* ok);
|
| Module* ParseModuleLiteral(bool* ok);
|
| Module* ParseModulePath(bool* ok);
|
| @@ -680,38 +687,49 @@ class Parser : public ParserBase<ParserTraits> {
|
| Module* ParseModuleSpecifier(bool* ok);
|
| Block* ParseImportDeclaration(bool* ok);
|
| Statement* ParseExportDeclaration(bool* ok);
|
| - Statement* ParseBlockElement(ZoneStringList* labels, bool* ok);
|
| - Statement* ParseStatement(ZoneStringList* labels, bool* ok);
|
| - Statement* ParseFunctionDeclaration(ZoneStringList* names, bool* ok);
|
| + Statement* ParseBlockElement(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
| + Statement* ParseStatement(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
| + Statement* ParseFunctionDeclaration(
|
| + ZoneList<ParserSymbolTable::Symbol*>* names, bool* ok);
|
| Statement* ParseNativeDeclaration(bool* ok);
|
| - Block* ParseBlock(ZoneStringList* labels, bool* ok);
|
| + Block* ParseBlock(ZoneList<ParserSymbolTable::Symbol*>* labels, bool* ok);
|
| Block* ParseVariableStatement(VariableDeclarationContext var_context,
|
| - ZoneStringList* names,
|
| + ZoneList<ParserSymbolTable::Symbol*>* names,
|
| bool* ok);
|
| Block* ParseVariableDeclarations(VariableDeclarationContext var_context,
|
| VariableDeclarationProperties* decl_props,
|
| - ZoneStringList* names,
|
| - Handle<String>* out,
|
| + ZoneList<ParserSymbolTable::Symbol*>* names,
|
| + ParserSymbolTable::Symbol** out,
|
| bool* ok);
|
| - Statement* ParseExpressionOrLabelledStatement(ZoneStringList* labels,
|
| - bool* ok);
|
| - IfStatement* ParseIfStatement(ZoneStringList* labels, bool* ok);
|
| + Statement* ParseExpressionOrLabelledStatement(
|
| + ZoneList<ParserSymbolTable::Symbol*>* labels, bool* ok);
|
| + IfStatement* ParseIfStatement(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
| Statement* ParseContinueStatement(bool* ok);
|
| - Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok);
|
| + Statement* ParseBreakStatement(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
| Statement* ParseReturnStatement(bool* ok);
|
| - Statement* ParseWithStatement(ZoneStringList* labels, bool* ok);
|
| + Statement* ParseWithStatement(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
| CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok);
|
| - SwitchStatement* ParseSwitchStatement(ZoneStringList* labels, bool* ok);
|
| - DoWhileStatement* ParseDoWhileStatement(ZoneStringList* labels, bool* ok);
|
| - WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok);
|
| - Statement* ParseForStatement(ZoneStringList* labels, bool* ok);
|
| + SwitchStatement* ParseSwitchStatement(
|
| + ZoneList<ParserSymbolTable::Symbol*>* labels, bool* ok);
|
| + DoWhileStatement* ParseDoWhileStatement(
|
| + ZoneList<ParserSymbolTable::Symbol*>* labels, bool* ok);
|
| + WhileStatement* ParseWhileStatement(
|
| + ZoneList<ParserSymbolTable::Symbol*>* labels, bool* ok);
|
| + Statement* ParseForStatement(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
| Statement* ParseThrowStatement(bool* ok);
|
| Expression* MakeCatchContext(Handle<String> id, VariableProxy* value);
|
| TryStatement* ParseTryStatement(bool* ok);
|
| DebuggerStatement* ParseDebuggerStatement(bool* ok);
|
|
|
| // Support for hamony block scoped bindings.
|
| - Block* ParseScopedBlock(ZoneStringList* labels, bool* ok);
|
| + Block* ParseScopedBlock(ZoneList<ParserSymbolTable::Symbol*>* labels,
|
| + bool* ok);
|
|
|
| // Initialize the components of a for-in / for-of statement.
|
| void InitializeForEachStatement(ForEachStatement* stmt,
|
| @@ -720,7 +738,7 @@ class Parser : public ParserBase<ParserTraits> {
|
| Statement* body);
|
|
|
| FunctionLiteral* ParseFunctionLiteral(
|
| - Handle<String> name,
|
| + ParserSymbolTable::Symbol* name,
|
| Scanner::Location function_name_location,
|
| bool name_is_strict_reserved,
|
| bool is_generator,
|
| @@ -748,14 +766,17 @@ class Parser : public ParserBase<ParserTraits> {
|
| void CheckConflictingVarDeclarations(Scope* scope, bool* ok);
|
|
|
| // Parser support
|
| - VariableProxy* NewUnresolved(Handle<String> name,
|
| + template<class SymbolType>
|
| + VariableProxy* NewUnresolved(SymbolType name,
|
| VariableMode mode,
|
| Interface* interface);
|
| void Declare(Declaration* declaration, bool resolve, bool* ok);
|
|
|
| - bool TargetStackContainsLabel(Handle<String> label);
|
| - BreakableStatement* LookupBreakTarget(Handle<String> label, bool* ok);
|
| - IterationStatement* LookupContinueTarget(Handle<String> label, bool* ok);
|
| + bool TargetStackContainsLabel(ParserSymbolTable::Symbol* label);
|
| + BreakableStatement* LookupBreakTarget(ParserSymbolTable::Symbol* label,
|
| + bool* ok);
|
| + IterationStatement* LookupContinueTarget(ParserSymbolTable::Symbol* label,
|
| + bool* ok);
|
|
|
| void RegisterTargetUse(Label* target, Target* stop);
|
|
|
| @@ -765,7 +786,7 @@ class Parser : public ParserBase<ParserTraits> {
|
|
|
| // Skip over a lazy function, either using cached data if we have it, or
|
| // by parsing the function with PreParser. Consumes the ending }.
|
| - void SkipLazyFunctionBody(Handle<String> function_name,
|
| + void SkipLazyFunctionBody(ParserSymbolTable::Symbol* function_name,
|
| int* materialized_literal_count,
|
| int* expected_property_count,
|
| bool* ok);
|
| @@ -774,12 +795,11 @@ class Parser : public ParserBase<ParserTraits> {
|
| SingletonLogger* logger);
|
|
|
| // Consumes the ending }.
|
| - ZoneList<Statement*>* ParseEagerFunctionBody(Handle<String> function_name,
|
| - int pos,
|
| - Variable* fvar,
|
| - Token::Value fvar_init_op,
|
| - bool is_generator,
|
| - bool* ok);
|
| + ZoneList<Statement*>* ParseEagerFunctionBody(
|
| + ParserSymbolTable::Symbol* function_name, int pos, Variable* fvar,
|
| + Token::Value fvar_init_op, bool is_generator, bool* ok);
|
| +
|
| + void CheckPendingError();
|
|
|
| Isolate* isolate_;
|
|
|
| @@ -790,8 +810,17 @@ class Parser : public ParserBase<ParserTraits> {
|
| Target* target_stack_; // for break, continue statements
|
| ScriptData** cached_data_;
|
| CachedDataMode cached_data_mode_;
|
| + ParserSymbolTable* symbol_table_;
|
|
|
| CompilationInfo* info_;
|
| +
|
| + // Pending error
|
| + bool has_pending_error_;
|
| + Scanner::Location pending_location_;
|
| + const char* pending_message_;
|
| + ParserSymbolTable::Symbol* pending_arg_;
|
| + const char* pending_char_arg_;
|
| + bool pending_is_reference_error_;
|
| };
|
|
|
|
|
|
|