OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 Target** variable_; | 456 Target** variable_; |
457 Target* previous_; | 457 Target* previous_; |
458 }; | 458 }; |
459 | 459 |
460 | 460 |
461 // ---------------------------------------------------------------------------- | 461 // ---------------------------------------------------------------------------- |
462 // LexicalScope is a support class to facilitate manipulation of the | 462 // LexicalScope is a support class to facilitate manipulation of the |
463 // Parser's scope stack. The constructor sets the parser's top scope | 463 // Parser's scope stack. The constructor sets the parser's top scope |
464 // to the incoming scope, and the destructor resets it. | 464 // to the incoming scope, and the destructor resets it. |
465 // | 465 // |
466 // Additionlaly, it stores transient information used during parsing. | 466 // Additionally, it stores transient information used during parsing. |
467 // These scopes are not kept around after parsing or referenced by syntax | 467 // These scopes are not kept around after parsing or referenced by syntax |
468 // trees so they can be stack-allocated and hence used by the pre-parser. | 468 // trees so they can be stack-allocated and hence used by the pre-parser. |
469 | 469 |
470 class LexicalScope BASE_EMBEDDED { | 470 class LexicalScope BASE_EMBEDDED { |
471 public: | 471 public: |
472 LexicalScope(Parser* parser, Scope* scope, Isolate* isolate); | 472 LexicalScope(Parser* parser, Scope* scope, Isolate* isolate); |
473 ~LexicalScope(); | 473 ~LexicalScope(); |
474 | 474 |
475 int NextMaterializedLiteralIndex() { | 475 int NextMaterializedLiteralIndex() { |
476 int next_index = | 476 int next_index = |
(...skipping 13 matching lines...) Expand all Loading... |
490 bool only_simple_this_property_assignments() { | 490 bool only_simple_this_property_assignments() { |
491 return only_simple_this_property_assignments_; | 491 return only_simple_this_property_assignments_; |
492 } | 492 } |
493 Handle<FixedArray> this_property_assignments() { | 493 Handle<FixedArray> this_property_assignments() { |
494 return this_property_assignments_; | 494 return this_property_assignments_; |
495 } | 495 } |
496 | 496 |
497 void AddProperty() { expected_property_count_++; } | 497 void AddProperty() { expected_property_count_++; } |
498 int expected_property_count() { return expected_property_count_; } | 498 int expected_property_count() { return expected_property_count_; } |
499 | 499 |
500 void AddLoop() { loop_count_++; } | |
501 bool ContainsLoops() const { return loop_count_ > 0; } | |
502 | |
503 private: | 500 private: |
504 // Captures the number of literals that need materialization in the | 501 // Captures the number of literals that need materialization in the |
505 // function. Includes regexp literals, and boilerplate for object | 502 // function. Includes regexp literals, and boilerplate for object |
506 // and array literals. | 503 // and array literals. |
507 int materialized_literal_count_; | 504 int materialized_literal_count_; |
508 | 505 |
509 // Properties count estimation. | 506 // Properties count estimation. |
510 int expected_property_count_; | 507 int expected_property_count_; |
511 | 508 |
512 // Keeps track of assignments to properties of this. Used for | 509 // Keeps track of assignments to properties of this. Used for |
513 // optimizing constructors. | 510 // optimizing constructors. |
514 bool only_simple_this_property_assignments_; | 511 bool only_simple_this_property_assignments_; |
515 Handle<FixedArray> this_property_assignments_; | 512 Handle<FixedArray> this_property_assignments_; |
516 | 513 |
517 // Captures the number of loops inside the scope. | |
518 int loop_count_; | |
519 | |
520 // Bookkeeping | 514 // Bookkeeping |
521 Parser* parser_; | 515 Parser* parser_; |
522 // Previous values | 516 // Previous values |
523 LexicalScope* lexical_scope_parent_; | 517 LexicalScope* lexical_scope_parent_; |
524 Scope* previous_scope_; | 518 Scope* previous_scope_; |
525 int previous_with_nesting_level_; | 519 int previous_with_nesting_level_; |
| 520 unsigned previous_ast_node_id_; |
526 }; | 521 }; |
527 | 522 |
528 | 523 |
529 LexicalScope::LexicalScope(Parser* parser, Scope* scope, Isolate* isolate) | 524 LexicalScope::LexicalScope(Parser* parser, Scope* scope, Isolate* isolate) |
530 : materialized_literal_count_(0), | 525 : materialized_literal_count_(0), |
531 expected_property_count_(0), | 526 expected_property_count_(0), |
532 only_simple_this_property_assignments_(false), | 527 only_simple_this_property_assignments_(false), |
533 this_property_assignments_(isolate->factory()->empty_fixed_array()), | 528 this_property_assignments_(isolate->factory()->empty_fixed_array()), |
534 loop_count_(0), | |
535 parser_(parser), | 529 parser_(parser), |
536 lexical_scope_parent_(parser->lexical_scope_), | 530 lexical_scope_parent_(parser->lexical_scope_), |
537 previous_scope_(parser->top_scope_), | 531 previous_scope_(parser->top_scope_), |
538 previous_with_nesting_level_(parser->with_nesting_level_) { | 532 previous_with_nesting_level_(parser->with_nesting_level_), |
| 533 previous_ast_node_id_(isolate->ast_node_id()) { |
539 parser->top_scope_ = scope; | 534 parser->top_scope_ = scope; |
540 parser->lexical_scope_ = this; | 535 parser->lexical_scope_ = this; |
541 parser->with_nesting_level_ = 0; | 536 parser->with_nesting_level_ = 0; |
| 537 isolate->set_ast_node_id(AstNode::kRootAstId + 1); |
542 } | 538 } |
543 | 539 |
544 | 540 |
545 LexicalScope::~LexicalScope() { | 541 LexicalScope::~LexicalScope() { |
546 parser_->top_scope_->Leave(); | 542 parser_->top_scope_->Leave(); |
547 parser_->top_scope_ = previous_scope_; | 543 parser_->top_scope_ = previous_scope_; |
548 parser_->lexical_scope_ = lexical_scope_parent_; | 544 parser_->lexical_scope_ = lexical_scope_parent_; |
549 parser_->with_nesting_level_ = previous_with_nesting_level_; | 545 parser_->with_nesting_level_ = previous_with_nesting_level_; |
| 546 parser_->isolate()->set_ast_node_id(previous_ast_node_id_); |
550 } | 547 } |
551 | 548 |
552 | 549 |
553 // ---------------------------------------------------------------------------- | 550 // ---------------------------------------------------------------------------- |
554 // The CHECK_OK macro is a convenient macro to enforce error | 551 // The CHECK_OK macro is a convenient macro to enforce error |
555 // handling for functions that may fail (by returning !*ok). | 552 // handling for functions that may fail (by returning !*ok). |
556 // | 553 // |
557 // CAUTION: This macro appends extra statements after a call, | 554 // CAUTION: This macro appends extra statements after a call, |
558 // thus it must never be used where only a single statement | 555 // thus it must never be used where only a single statement |
559 // is correct (e.g. an if statement branch w/o braces)! | 556 // is correct (e.g. an if statement branch w/o braces)! |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 no_name, | 654 no_name, |
658 top_scope_, | 655 top_scope_, |
659 body, | 656 body, |
660 lexical_scope.materialized_literal_count(), | 657 lexical_scope.materialized_literal_count(), |
661 lexical_scope.expected_property_count(), | 658 lexical_scope.expected_property_count(), |
662 lexical_scope.only_simple_this_property_assignments(), | 659 lexical_scope.only_simple_this_property_assignments(), |
663 lexical_scope.this_property_assignments(), | 660 lexical_scope.this_property_assignments(), |
664 0, | 661 0, |
665 0, | 662 0, |
666 source->length(), | 663 source->length(), |
667 false, | 664 false); |
668 lexical_scope.ContainsLoops()); | |
669 } else if (stack_overflow_) { | 665 } else if (stack_overflow_) { |
670 isolate()->StackOverflow(); | 666 isolate()->StackOverflow(); |
671 } | 667 } |
672 } | 668 } |
673 | 669 |
674 // Make sure the target stack is empty. | 670 // Make sure the target stack is empty. |
675 ASSERT(target_stack_ == NULL); | 671 ASSERT(target_stack_ == NULL); |
676 | 672 |
677 // If there was a syntax error we have to get rid of the AST | 673 // If there was a syntax error we have to get rid of the AST |
678 // and it is not safe to do so before the scope has been deleted. | 674 // and it is not safe to do so before the scope has been deleted. |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 | 2152 |
2157 return result; | 2153 return result; |
2158 } | 2154 } |
2159 | 2155 |
2160 | 2156 |
2161 DoWhileStatement* Parser::ParseDoWhileStatement(ZoneStringList* labels, | 2157 DoWhileStatement* Parser::ParseDoWhileStatement(ZoneStringList* labels, |
2162 bool* ok) { | 2158 bool* ok) { |
2163 // DoStatement :: | 2159 // DoStatement :: |
2164 // 'do' Statement 'while' '(' Expression ')' ';' | 2160 // 'do' Statement 'while' '(' Expression ')' ';' |
2165 | 2161 |
2166 lexical_scope_->AddLoop(); | |
2167 DoWhileStatement* loop = new(zone()) DoWhileStatement(labels); | 2162 DoWhileStatement* loop = new(zone()) DoWhileStatement(labels); |
2168 Target target(&this->target_stack_, loop); | 2163 Target target(&this->target_stack_, loop); |
2169 | 2164 |
2170 Expect(Token::DO, CHECK_OK); | 2165 Expect(Token::DO, CHECK_OK); |
2171 Statement* body = ParseStatement(NULL, CHECK_OK); | 2166 Statement* body = ParseStatement(NULL, CHECK_OK); |
2172 Expect(Token::WHILE, CHECK_OK); | 2167 Expect(Token::WHILE, CHECK_OK); |
2173 Expect(Token::LPAREN, CHECK_OK); | 2168 Expect(Token::LPAREN, CHECK_OK); |
2174 | 2169 |
2175 if (loop != NULL) { | 2170 if (loop != NULL) { |
2176 int position = scanner().location().beg_pos; | 2171 int position = scanner().location().beg_pos; |
(...skipping 12 matching lines...) Expand all Loading... |
2189 | 2184 |
2190 if (loop != NULL) loop->Initialize(cond, body); | 2185 if (loop != NULL) loop->Initialize(cond, body); |
2191 return loop; | 2186 return loop; |
2192 } | 2187 } |
2193 | 2188 |
2194 | 2189 |
2195 WhileStatement* Parser::ParseWhileStatement(ZoneStringList* labels, bool* ok) { | 2190 WhileStatement* Parser::ParseWhileStatement(ZoneStringList* labels, bool* ok) { |
2196 // WhileStatement :: | 2191 // WhileStatement :: |
2197 // 'while' '(' Expression ')' Statement | 2192 // 'while' '(' Expression ')' Statement |
2198 | 2193 |
2199 lexical_scope_->AddLoop(); | |
2200 WhileStatement* loop = new(zone()) WhileStatement(labels); | 2194 WhileStatement* loop = new(zone()) WhileStatement(labels); |
2201 Target target(&this->target_stack_, loop); | 2195 Target target(&this->target_stack_, loop); |
2202 | 2196 |
2203 Expect(Token::WHILE, CHECK_OK); | 2197 Expect(Token::WHILE, CHECK_OK); |
2204 Expect(Token::LPAREN, CHECK_OK); | 2198 Expect(Token::LPAREN, CHECK_OK); |
2205 Expression* cond = ParseExpression(true, CHECK_OK); | 2199 Expression* cond = ParseExpression(true, CHECK_OK); |
2206 if (cond != NULL) cond->set_is_loop_condition(true); | 2200 if (cond != NULL) cond->set_is_loop_condition(true); |
2207 Expect(Token::RPAREN, CHECK_OK); | 2201 Expect(Token::RPAREN, CHECK_OK); |
2208 Statement* body = ParseStatement(NULL, CHECK_OK); | 2202 Statement* body = ParseStatement(NULL, CHECK_OK); |
2209 | 2203 |
2210 if (loop != NULL) loop->Initialize(cond, body); | 2204 if (loop != NULL) loop->Initialize(cond, body); |
2211 return loop; | 2205 return loop; |
2212 } | 2206 } |
2213 | 2207 |
2214 | 2208 |
2215 Statement* Parser::ParseForStatement(ZoneStringList* labels, bool* ok) { | 2209 Statement* Parser::ParseForStatement(ZoneStringList* labels, bool* ok) { |
2216 // ForStatement :: | 2210 // ForStatement :: |
2217 // 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement | 2211 // 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement |
2218 | 2212 |
2219 lexical_scope_->AddLoop(); | |
2220 Statement* init = NULL; | 2213 Statement* init = NULL; |
2221 | 2214 |
2222 Expect(Token::FOR, CHECK_OK); | 2215 Expect(Token::FOR, CHECK_OK); |
2223 Expect(Token::LPAREN, CHECK_OK); | 2216 Expect(Token::LPAREN, CHECK_OK); |
2224 if (peek() != Token::SEMICOLON) { | 2217 if (peek() != Token::SEMICOLON) { |
2225 if (peek() == Token::VAR || peek() == Token::CONST) { | 2218 if (peek() == Token::VAR || peek() == Token::CONST) { |
2226 Expression* each = NULL; | 2219 Expression* each = NULL; |
2227 Block* variable_statement = | 2220 Block* variable_statement = |
2228 ParseVariableDeclarations(false, &each, CHECK_OK); | 2221 ParseVariableDeclarations(false, &each, CHECK_OK); |
2229 if (peek() == Token::IN && each != NULL) { | 2222 if (peek() == Token::IN && each != NULL) { |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3527 // that case, we don't have a function name (it's empty). | 3520 // that case, we don't have a function name (it's empty). |
3528 Handle<String> name = | 3521 Handle<String> name = |
3529 is_named ? var_name : isolate()->factory()->empty_symbol(); | 3522 is_named ? var_name : isolate()->factory()->empty_symbol(); |
3530 // The function name, if any. | 3523 // The function name, if any. |
3531 Handle<String> function_name = isolate()->factory()->empty_symbol(); | 3524 Handle<String> function_name = isolate()->factory()->empty_symbol(); |
3532 if (is_named && (type == EXPRESSION || type == NESTED)) { | 3525 if (is_named && (type == EXPRESSION || type == NESTED)) { |
3533 function_name = name; | 3526 function_name = name; |
3534 } | 3527 } |
3535 | 3528 |
3536 int num_parameters = 0; | 3529 int num_parameters = 0; |
| 3530 Scope* scope = NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); |
| 3531 ZoneList<Statement*>* body = new ZoneList<Statement*>(8); |
| 3532 int materialized_literal_count; |
| 3533 int expected_property_count; |
| 3534 int start_pos; |
| 3535 int end_pos; |
| 3536 bool only_simple_this_property_assignments; |
| 3537 Handle<FixedArray> this_property_assignments; |
3537 // Parse function body. | 3538 // Parse function body. |
3538 { Scope* scope = | 3539 { LexicalScope lexical_scope(this, scope, isolate()); |
3539 NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); | |
3540 LexicalScope lexical_scope(this, scope, isolate()); | |
3541 top_scope_->SetScopeName(name); | 3540 top_scope_->SetScopeName(name); |
3542 | 3541 |
3543 // FormalParameterList :: | 3542 // FormalParameterList :: |
3544 // '(' (Identifier)*[','] ')' | 3543 // '(' (Identifier)*[','] ')' |
3545 Expect(Token::LPAREN, CHECK_OK); | 3544 Expect(Token::LPAREN, CHECK_OK); |
3546 int start_pos = scanner().location().beg_pos; | 3545 start_pos = scanner().location().beg_pos; |
3547 Scanner::Location name_loc = Scanner::NoLocation(); | 3546 Scanner::Location name_loc = Scanner::NoLocation(); |
3548 Scanner::Location dupe_loc = Scanner::NoLocation(); | 3547 Scanner::Location dupe_loc = Scanner::NoLocation(); |
3549 Scanner::Location reserved_loc = Scanner::NoLocation(); | 3548 Scanner::Location reserved_loc = Scanner::NoLocation(); |
3550 | 3549 |
3551 bool done = (peek() == Token::RPAREN); | 3550 bool done = (peek() == Token::RPAREN); |
3552 while (!done) { | 3551 while (!done) { |
3553 bool is_reserved = false; | 3552 bool is_reserved = false; |
3554 Handle<String> param_name = | 3553 Handle<String> param_name = |
3555 ParseIdentifierOrReservedWord(&is_reserved, CHECK_OK); | 3554 ParseIdentifierOrReservedWord(&is_reserved, CHECK_OK); |
3556 | 3555 |
(...skipping 16 matching lines...) Expand all Loading... |
3573 Vector<const char*>::empty()); | 3572 Vector<const char*>::empty()); |
3574 *ok = false; | 3573 *ok = false; |
3575 return NULL; | 3574 return NULL; |
3576 } | 3575 } |
3577 done = (peek() == Token::RPAREN); | 3576 done = (peek() == Token::RPAREN); |
3578 if (!done) Expect(Token::COMMA, CHECK_OK); | 3577 if (!done) Expect(Token::COMMA, CHECK_OK); |
3579 } | 3578 } |
3580 Expect(Token::RPAREN, CHECK_OK); | 3579 Expect(Token::RPAREN, CHECK_OK); |
3581 | 3580 |
3582 Expect(Token::LBRACE, CHECK_OK); | 3581 Expect(Token::LBRACE, CHECK_OK); |
3583 ZoneList<Statement*>* body = new ZoneList<Statement*>(8); | |
3584 | 3582 |
3585 // If we have a named function expression, we add a local variable | 3583 // If we have a named function expression, we add a local variable |
3586 // declaration to the body of the function with the name of the | 3584 // declaration to the body of the function with the name of the |
3587 // function and let it refer to the function itself (closure). | 3585 // function and let it refer to the function itself (closure). |
3588 // NOTE: We create a proxy and resolve it here so that in the | 3586 // NOTE: We create a proxy and resolve it here so that in the |
3589 // future we can change the AST to only refer to VariableProxies | 3587 // future we can change the AST to only refer to VariableProxies |
3590 // instead of Variables and Proxis as is the case now. | 3588 // instead of Variables and Proxis as is the case now. |
3591 if (!function_name.is_null() && function_name->length() > 0) { | 3589 if (!function_name.is_null() && function_name->length() > 0) { |
3592 Variable* fvar = top_scope_->DeclareFunctionVar(function_name); | 3590 Variable* fvar = top_scope_->DeclareFunctionVar(function_name); |
3593 VariableProxy* fproxy = | 3591 VariableProxy* fproxy = |
3594 top_scope_->NewUnresolved(function_name, inside_with()); | 3592 top_scope_->NewUnresolved(function_name, inside_with()); |
3595 fproxy->BindTo(fvar); | 3593 fproxy->BindTo(fvar); |
3596 body->Add(new(zone()) ExpressionStatement( | 3594 body->Add(new(zone()) ExpressionStatement( |
3597 new(zone()) Assignment(Token::INIT_CONST, fproxy, | 3595 new(zone()) Assignment(Token::INIT_CONST, fproxy, |
3598 new(zone()) ThisFunction(), | 3596 new(zone()) ThisFunction(), |
3599 RelocInfo::kNoPosition))); | 3597 RelocInfo::kNoPosition))); |
3600 } | 3598 } |
3601 | 3599 |
3602 // Determine if the function will be lazily compiled. The mode can | 3600 // Determine if the function will be lazily compiled. The mode can |
3603 // only be PARSE_LAZILY if the --lazy flag is true. | 3601 // only be PARSE_LAZILY if the --lazy flag is true. |
3604 bool is_lazily_compiled = (mode() == PARSE_LAZILY && | 3602 bool is_lazily_compiled = (mode() == PARSE_LAZILY && |
3605 top_scope_->outer_scope()->is_global_scope() && | 3603 top_scope_->outer_scope()->is_global_scope() && |
3606 top_scope_->HasTrivialOuterContext() && | 3604 top_scope_->HasTrivialOuterContext() && |
3607 !parenthesized_function_); | 3605 !parenthesized_function_); |
3608 parenthesized_function_ = false; // The bit was set for this function only. | 3606 parenthesized_function_ = false; // The bit was set for this function only. |
3609 | 3607 |
3610 int function_block_pos = scanner().location().beg_pos; | 3608 int function_block_pos = scanner().location().beg_pos; |
3611 int materialized_literal_count; | |
3612 int expected_property_count; | |
3613 int end_pos; | |
3614 bool only_simple_this_property_assignments; | |
3615 Handle<FixedArray> this_property_assignments; | |
3616 if (is_lazily_compiled && pre_data() != NULL) { | 3609 if (is_lazily_compiled && pre_data() != NULL) { |
3617 FunctionEntry entry = pre_data()->GetFunctionEntry(function_block_pos); | 3610 FunctionEntry entry = pre_data()->GetFunctionEntry(function_block_pos); |
3618 if (!entry.is_valid()) { | 3611 if (!entry.is_valid()) { |
3619 ReportInvalidPreparseData(name, CHECK_OK); | 3612 ReportInvalidPreparseData(name, CHECK_OK); |
3620 } | 3613 } |
3621 end_pos = entry.end_pos(); | 3614 end_pos = entry.end_pos(); |
3622 if (end_pos <= function_block_pos) { | 3615 if (end_pos <= function_block_pos) { |
3623 // End position greater than end of stream is safe, and hard to check. | 3616 // End position greater than end of stream is safe, and hard to check. |
3624 ReportInvalidPreparseData(name, CHECK_OK); | 3617 ReportInvalidPreparseData(name, CHECK_OK); |
3625 } | 3618 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3680 return NULL; | 3673 return NULL; |
3681 } | 3674 } |
3682 if (reserved_loc.IsValid()) { | 3675 if (reserved_loc.IsValid()) { |
3683 ReportMessageAt(reserved_loc, "strict_reserved_word", | 3676 ReportMessageAt(reserved_loc, "strict_reserved_word", |
3684 Vector<const char*>::empty()); | 3677 Vector<const char*>::empty()); |
3685 *ok = false; | 3678 *ok = false; |
3686 return NULL; | 3679 return NULL; |
3687 } | 3680 } |
3688 CheckOctalLiteral(start_pos, end_pos, CHECK_OK); | 3681 CheckOctalLiteral(start_pos, end_pos, CHECK_OK); |
3689 } | 3682 } |
| 3683 } |
3690 | 3684 |
3691 FunctionLiteral* function_literal = | 3685 FunctionLiteral* function_literal = |
3692 new(zone()) FunctionLiteral(name, | 3686 new(zone()) FunctionLiteral(name, |
3693 top_scope_, | 3687 scope, |
3694 body, | 3688 body, |
3695 materialized_literal_count, | 3689 materialized_literal_count, |
3696 expected_property_count, | 3690 expected_property_count, |
3697 only_simple_this_property_assignments, | 3691 only_simple_this_property_assignments, |
3698 this_property_assignments, | 3692 this_property_assignments, |
3699 num_parameters, | 3693 num_parameters, |
3700 start_pos, | 3694 start_pos, |
3701 end_pos, | 3695 end_pos, |
3702 function_name->length() > 0, | 3696 (function_name->length() > 0)); |
3703 lexical_scope.ContainsLoops()); | 3697 function_literal->set_function_token_position(function_token_position); |
3704 function_literal->set_function_token_position(function_token_position); | |
3705 | 3698 |
3706 if (fni_ != NULL && !is_named) fni_->AddFunction(function_literal); | 3699 if (fni_ != NULL && !is_named) fni_->AddFunction(function_literal); |
3707 return function_literal; | 3700 return function_literal; |
3708 } | |
3709 } | 3701 } |
3710 | 3702 |
3711 | 3703 |
3712 Expression* Parser::ParseV8Intrinsic(bool* ok) { | 3704 Expression* Parser::ParseV8Intrinsic(bool* ok) { |
3713 // CallRuntime :: | 3705 // CallRuntime :: |
3714 // '%' Identifier Arguments | 3706 // '%' Identifier Arguments |
3715 | 3707 |
3716 Expect(Token::MOD, CHECK_OK); | 3708 Expect(Token::MOD, CHECK_OK); |
3717 Handle<String> name = ParseIdentifier(CHECK_OK); | 3709 Handle<String> name = ParseIdentifier(CHECK_OK); |
3718 ZoneList<Expression*>* args = ParseArguments(CHECK_OK); | 3710 ZoneList<Expression*>* args = ParseArguments(CHECK_OK); |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5161 info->is_global(), | 5153 info->is_global(), |
5162 info->StrictMode()); | 5154 info->StrictMode()); |
5163 } | 5155 } |
5164 } | 5156 } |
5165 | 5157 |
5166 info->SetFunction(result); | 5158 info->SetFunction(result); |
5167 return (result != NULL); | 5159 return (result != NULL); |
5168 } | 5160 } |
5169 | 5161 |
5170 } } // namespace v8::internal | 5162 } } // namespace v8::internal |
OLD | NEW |