diff --git a/src/compiler.cc b/src/compiler.cc index ba8aca0e77..6ef5a1c50d 100755 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -377,20 +377,12 @@ bool Compiler::CompileLazy(CompilationInfo* info) { // Compute name, source code and script data. Handle shared = info->shared_info(); - Handle name(String::cast(shared->name())); - - int start_position = shared->start_position(); - int end_position = shared->end_position(); - bool is_expression = shared->is_expression(); - Counters::total_compile_size.Increment(end_position - start_position); + int compiled_size = shared->end_position() - shared->start_position(); + Counters::total_compile_size.Increment(compiled_size); // Generate the AST for the lazily compiled function. The AST may be // NULL in case of parser stack overflow. - FunctionLiteral* lit = MakeLazyAST(info->script(), - name, - start_position, - end_position, - is_expression); + FunctionLiteral* lit = MakeLazyAST(shared); // Check for parse errors. if (lit == NULL) { @@ -414,9 +406,9 @@ bool Compiler::CompileLazy(CompilationInfo* info) { } RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, - name, + Handle(String::cast(shared->name())), Handle(shared->inferred_name()), - start_position, + shared->start_position(), info->script(), code); diff --git a/src/parser.cc b/src/parser.cc index 1486e9b2b3..a386848d33 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -115,11 +115,7 @@ class Parser { // Returns NULL if parsing failed. FunctionLiteral* ParseProgram(Handle source, bool in_global_context); - FunctionLiteral* ParseLazy(Handle source, - Handle name, - int start_position, - int end_position, - bool is_expression); + FunctionLiteral* ParseLazy(Handle info); FunctionLiteral* ParseJson(Handle source); // The minimum number of contiguous assignment that will @@ -1587,21 +1583,20 @@ FunctionLiteral* Parser::ParseProgram(Handle source, } -FunctionLiteral* Parser::ParseLazy(Handle source, - Handle name, - int start_position, - int end_position, - bool is_expression) { +FunctionLiteral* Parser::ParseLazy(Handle info) { CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); HistogramTimerScope timer(&Counters::parse_lazy); + Handle source(String::cast(script_->source())); Counters::total_parse_size.Increment(source->length()); + Handle name(String::cast(info->name())); fni_ = new FuncNameInferrer(); fni_->PushEnclosingName(name); // Initialize parser state. source->TryFlatten(); - scanner_.Initialize(source, start_position, end_position, JAVASCRIPT); + scanner_.Initialize(source, info->start_position(), info->end_position(), + JAVASCRIPT); ASSERT(target_stack_ == NULL); mode_ = PARSE_EAGERLY; @@ -1616,7 +1611,8 @@ FunctionLiteral* Parser::ParseLazy(Handle source, LexicalScope lexical_scope(this, scope); TemporaryScope temp_scope(this); - FunctionLiteralType type = is_expression ? EXPRESSION : DECLARATION; + FunctionLiteralType type = + info->is_expression() ? EXPRESSION : DECLARATION; bool ok = true; result = ParseFunctionLiteral(name, RelocInfo::kNoPosition, type, &ok); // Make sure the results agree. @@ -1637,6 +1633,7 @@ FunctionLiteral* Parser::ParseLazy(Handle source, return result; } + FunctionLiteral* Parser::ParseJson(Handle source) { CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); @@ -5475,12 +5472,6 @@ RegExpTree* RegExpParser::ParseCharacterClass() { // ---------------------------------------------------------------------------- // The Parser interface. -// MakeAST() is just a wrapper for the corresponding Parser calls -// so we don't have to expose the entire Parser class in the .h file. - -static bool always_allow_natives_syntax = false; - - ParserMessage::~ParserMessage() { for (int i = 0; i < args().length(); i++) DeleteArray(args()[i]); @@ -5515,9 +5506,7 @@ ScriptDataImpl* PartialPreParse(Handle source, v8::Extension* extension) { Handle