OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 fni_(NULL), | 600 fni_(NULL), |
601 stack_overflow_(false), | 601 stack_overflow_(false), |
602 parenthesized_function_(false), | 602 parenthesized_function_(false), |
603 harmony_scoping_(false) { | 603 harmony_scoping_(false) { |
604 AstNode::ResetIds(); | 604 AstNode::ResetIds(); |
605 } | 605 } |
606 | 606 |
607 | 607 |
608 FunctionLiteral* Parser::ParseProgram(Handle<String> source, | 608 FunctionLiteral* Parser::ParseProgram(Handle<String> source, |
609 bool in_global_context, | 609 bool in_global_context, |
610 StrictModeFlag strict_mode) { | 610 LanguageMode language_mode) { |
611 ZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT); | 611 ZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT); |
612 | 612 |
613 HistogramTimerScope timer(isolate()->counters()->parse()); | 613 HistogramTimerScope timer(isolate()->counters()->parse()); |
614 isolate()->counters()->total_parse_size()->Increment(source->length()); | 614 isolate()->counters()->total_parse_size()->Increment(source->length()); |
615 fni_ = new(zone()) FuncNameInferrer(isolate()); | 615 fni_ = new(zone()) FuncNameInferrer(isolate()); |
616 | 616 |
617 // Initialize parser state. | 617 // Initialize parser state. |
618 source->TryFlatten(); | 618 source->TryFlatten(); |
619 if (source->IsExternalTwoByteString()) { | 619 if (source->IsExternalTwoByteString()) { |
620 // Notice that the stream is destroyed at the end of the branch block. | 620 // Notice that the stream is destroyed at the end of the branch block. |
621 // The last line of the blocks can't be moved outside, even though they're | 621 // The last line of the blocks can't be moved outside, even though they're |
622 // identical calls. | 622 // identical calls. |
623 ExternalTwoByteStringUC16CharacterStream stream( | 623 ExternalTwoByteStringUC16CharacterStream stream( |
624 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); | 624 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); |
625 scanner_.Initialize(&stream); | 625 scanner_.Initialize(&stream); |
626 return DoParseProgram(source, in_global_context, strict_mode, &zone_scope); | 626 return |
| 627 DoParseProgram(source, in_global_context, language_mode, &zone_scope); |
627 } else { | 628 } else { |
628 GenericStringUC16CharacterStream stream(source, 0, source->length()); | 629 GenericStringUC16CharacterStream stream(source, 0, source->length()); |
629 scanner_.Initialize(&stream); | 630 scanner_.Initialize(&stream); |
630 return DoParseProgram(source, in_global_context, strict_mode, &zone_scope); | 631 return |
| 632 DoParseProgram(source, in_global_context, language_mode, &zone_scope); |
631 } | 633 } |
632 } | 634 } |
633 | 635 |
634 | 636 |
635 FunctionLiteral* Parser::DoParseProgram(Handle<String> source, | 637 FunctionLiteral* Parser::DoParseProgram(Handle<String> source, |
636 bool in_global_context, | 638 bool in_global_context, |
637 StrictModeFlag strict_mode, | 639 LanguageMode language_mode, |
638 ZoneScope* zone_scope) { | 640 ZoneScope* zone_scope) { |
639 ASSERT(top_scope_ == NULL); | 641 ASSERT(top_scope_ == NULL); |
640 ASSERT(target_stack_ == NULL); | 642 ASSERT(target_stack_ == NULL); |
641 if (pre_data_ != NULL) pre_data_->Initialize(); | 643 if (pre_data_ != NULL) pre_data_->Initialize(); |
642 | 644 |
643 // Compute the parsing mode. | 645 // Compute the parsing mode. |
644 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY; | 646 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY; |
645 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY; | 647 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY; |
646 | 648 |
647 ScopeType type = in_global_context ? GLOBAL_SCOPE : EVAL_SCOPE; | 649 ScopeType type = in_global_context ? GLOBAL_SCOPE : EVAL_SCOPE; |
648 Handle<String> no_name = isolate()->factory()->empty_symbol(); | 650 Handle<String> no_name = isolate()->factory()->empty_symbol(); |
649 | 651 |
650 FunctionLiteral* result = NULL; | 652 FunctionLiteral* result = NULL; |
651 { Scope* scope = NewScope(top_scope_, type); | 653 { Scope* scope = NewScope(top_scope_, type); |
652 scope->set_start_position(0); | 654 scope->set_start_position(0); |
653 scope->set_end_position(source->length()); | 655 scope->set_end_position(source->length()); |
654 LexicalScope lexical_scope(this, scope, isolate()); | 656 LexicalScope lexical_scope(this, scope, isolate()); |
655 ASSERT(top_scope_->strict_mode_flag() == kNonStrictMode); | 657 ASSERT(top_scope_->language_mode() == CLASSIC_MODE); |
656 top_scope_->SetStrictModeFlag(strict_mode); | 658 top_scope_->SetLanguageMode(language_mode); |
657 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16); | 659 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16); |
658 bool ok = true; | 660 bool ok = true; |
659 int beg_loc = scanner().location().beg_pos; | 661 int beg_loc = scanner().location().beg_pos; |
660 ParseSourceElements(body, Token::EOS, &ok); | 662 ParseSourceElements(body, Token::EOS, &ok); |
661 if (ok && top_scope_->is_strict_mode()) { | 663 if (ok && !top_scope_->is_classic_mode()) { |
662 CheckOctalLiteral(beg_loc, scanner().location().end_pos, &ok); | 664 CheckOctalLiteral(beg_loc, scanner().location().end_pos, &ok); |
663 } | 665 } |
664 | 666 |
665 if (ok && harmony_scoping_) { | 667 if (ok && harmony_scoping_) { |
666 CheckConflictingVarDeclarations(scope, &ok); | 668 CheckConflictingVarDeclarations(scope, &ok); |
667 } | 669 } |
668 | 670 |
669 if (ok) { | 671 if (ok) { |
670 result = new(zone()) FunctionLiteral( | 672 result = new(zone()) FunctionLiteral( |
671 isolate(), | 673 isolate(), |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // Place holder for the result. | 738 // Place holder for the result. |
737 FunctionLiteral* result = NULL; | 739 FunctionLiteral* result = NULL; |
738 | 740 |
739 { | 741 { |
740 // Parse the function literal. | 742 // Parse the function literal. |
741 Scope* scope = NewScope(top_scope_, GLOBAL_SCOPE); | 743 Scope* scope = NewScope(top_scope_, GLOBAL_SCOPE); |
742 if (!info->closure().is_null()) { | 744 if (!info->closure().is_null()) { |
743 scope = Scope::DeserializeScopeChain(info, scope); | 745 scope = Scope::DeserializeScopeChain(info, scope); |
744 } | 746 } |
745 LexicalScope lexical_scope(this, scope, isolate()); | 747 LexicalScope lexical_scope(this, scope, isolate()); |
746 ASSERT(scope->strict_mode_flag() == kNonStrictMode || | 748 ASSERT(scope->language_mode() != STRICT_MODE || !info->is_classic_mode()); |
747 scope->strict_mode_flag() == info->strict_mode_flag()); | 749 ASSERT(scope->language_mode() != EXTENDED_MODE || |
748 ASSERT(info->strict_mode_flag() == shared_info->strict_mode_flag()); | 750 info->is_extended_mode()); |
749 scope->SetStrictModeFlag(shared_info->strict_mode_flag()); | 751 ASSERT(info->language_mode() == shared_info->language_mode()); |
| 752 scope->SetLanguageMode(shared_info->language_mode()); |
750 FunctionLiteral::Type type = shared_info->is_expression() | 753 FunctionLiteral::Type type = shared_info->is_expression() |
751 ? (shared_info->is_anonymous() | 754 ? (shared_info->is_anonymous() |
752 ? FunctionLiteral::ANONYMOUS_EXPRESSION | 755 ? FunctionLiteral::ANONYMOUS_EXPRESSION |
753 : FunctionLiteral::NAMED_EXPRESSION) | 756 : FunctionLiteral::NAMED_EXPRESSION) |
754 : FunctionLiteral::DECLARATION; | 757 : FunctionLiteral::DECLARATION; |
755 bool ok = true; | 758 bool ok = true; |
756 result = ParseFunctionLiteral(name, | 759 result = ParseFunctionLiteral(name, |
757 false, // Strict mode name already checked. | 760 false, // Strict mode name already checked. |
758 RelocInfo::kNoPosition, | 761 RelocInfo::kNoPosition, |
759 type, | 762 type, |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 // A shot at a directive. | 1185 // A shot at a directive. |
1183 ExpressionStatement *e_stat; | 1186 ExpressionStatement *e_stat; |
1184 Literal *literal; | 1187 Literal *literal; |
1185 // Still processing directive prologue? | 1188 // Still processing directive prologue? |
1186 if ((e_stat = stat->AsExpressionStatement()) != NULL && | 1189 if ((e_stat = stat->AsExpressionStatement()) != NULL && |
1187 (literal = e_stat->expression()->AsLiteral()) != NULL && | 1190 (literal = e_stat->expression()->AsLiteral()) != NULL && |
1188 literal->handle()->IsString()) { | 1191 literal->handle()->IsString()) { |
1189 Handle<String> directive = Handle<String>::cast(literal->handle()); | 1192 Handle<String> directive = Handle<String>::cast(literal->handle()); |
1190 | 1193 |
1191 // Check "use strict" directive (ES5 14.1). | 1194 // Check "use strict" directive (ES5 14.1). |
1192 if (!top_scope_->is_strict_mode() && | 1195 if (top_scope_->is_classic_mode() && |
1193 directive->Equals(isolate()->heap()->use_strict()) && | 1196 directive->Equals(isolate()->heap()->use_strict()) && |
1194 token_loc.end_pos - token_loc.beg_pos == | 1197 token_loc.end_pos - token_loc.beg_pos == |
1195 isolate()->heap()->use_strict()->length() + 2) { | 1198 isolate()->heap()->use_strict()->length() + 2) { |
1196 top_scope_->SetStrictModeFlag(kStrictMode); | 1199 top_scope_->SetLanguageMode(harmony_scoping_ |
| 1200 ? EXTENDED_MODE : STRICT_MODE); |
1197 // "use strict" is the only directive for now. | 1201 // "use strict" is the only directive for now. |
1198 directive_prologue = false; | 1202 directive_prologue = false; |
1199 } | 1203 } |
1200 } else { | 1204 } else { |
1201 // End of the directive prologue. | 1205 // End of the directive prologue. |
1202 directive_prologue = false; | 1206 directive_prologue = false; |
1203 } | 1207 } |
1204 } | 1208 } |
1205 | 1209 |
1206 block_finder.Update(stat); | 1210 block_finder.Update(stat); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 } | 1328 } |
1325 | 1329 |
1326 case Token::FUNCTION: { | 1330 case Token::FUNCTION: { |
1327 // FunctionDeclaration is only allowed in the context of SourceElements | 1331 // FunctionDeclaration is only allowed in the context of SourceElements |
1328 // (Ecma 262 5th Edition, clause 14): | 1332 // (Ecma 262 5th Edition, clause 14): |
1329 // SourceElement: | 1333 // SourceElement: |
1330 // Statement | 1334 // Statement |
1331 // FunctionDeclaration | 1335 // FunctionDeclaration |
1332 // Common language extension is to allow function declaration in place | 1336 // Common language extension is to allow function declaration in place |
1333 // of any statement. This language extension is disabled in strict mode. | 1337 // of any statement. This language extension is disabled in strict mode. |
1334 if (top_scope_->is_strict_mode() || harmony_scoping_) { | 1338 if (!top_scope_->is_classic_mode()) { |
1335 ReportMessageAt(scanner().peek_location(), "strict_function", | 1339 ReportMessageAt(scanner().peek_location(), "strict_function", |
1336 Vector<const char*>::empty()); | 1340 Vector<const char*>::empty()); |
1337 *ok = false; | 1341 *ok = false; |
1338 return NULL; | 1342 return NULL; |
1339 } | 1343 } |
1340 return ParseFunctionDeclaration(ok); | 1344 return ParseFunctionDeclaration(ok); |
1341 } | 1345 } |
1342 | 1346 |
1343 case Token::DEBUGGER: | 1347 case Token::DEBUGGER: |
1344 stmt = ParseDebuggerStatement(ok); | 1348 stmt = ParseDebuggerStatement(ok); |
(...skipping 27 matching lines...) Expand all Loading... |
1372 // variable and also set its mode. In any case, a Declaration node | 1376 // variable and also set its mode. In any case, a Declaration node |
1373 // will be added to the scope so that the declaration can be added | 1377 // will be added to the scope so that the declaration can be added |
1374 // to the corresponding activation frame at runtime if necessary. | 1378 // to the corresponding activation frame at runtime if necessary. |
1375 // For instance declarations inside an eval scope need to be added | 1379 // For instance declarations inside an eval scope need to be added |
1376 // to the calling function context. | 1380 // to the calling function context. |
1377 // Similarly, strict mode eval scope does not leak variable declarations to | 1381 // Similarly, strict mode eval scope does not leak variable declarations to |
1378 // the caller's scope so we declare all locals, too. | 1382 // the caller's scope so we declare all locals, too. |
1379 // Also for block scoped let/const bindings the variable can be | 1383 // Also for block scoped let/const bindings the variable can be |
1380 // statically declared. | 1384 // statically declared. |
1381 if (declaration_scope->is_function_scope() || | 1385 if (declaration_scope->is_function_scope() || |
1382 declaration_scope->is_strict_mode_eval_scope() || | 1386 declaration_scope->is_strict_or_extended_eval_scope() || |
1383 declaration_scope->is_block_scope()) { | 1387 declaration_scope->is_block_scope()) { |
1384 // Declare the variable in the function scope. | 1388 // Declare the variable in the function scope. |
1385 var = declaration_scope->LocalLookup(name); | 1389 var = declaration_scope->LocalLookup(name); |
1386 if (var == NULL) { | 1390 if (var == NULL) { |
1387 // Declare the name. | 1391 // Declare the name. |
1388 InitializationFlag init_flag = (fun != NULL || mode == VAR) | 1392 InitializationFlag init_flag = (fun != NULL || mode == VAR) |
1389 ? kCreatedInitialized : kNeedsInitialization; | 1393 ? kCreatedInitialized : kNeedsInitialization; |
1390 var = declaration_scope->DeclareLocal(name, mode, init_flag); | 1394 var = declaration_scope->DeclareLocal(name, mode, init_flag); |
1391 } else { | 1395 } else { |
1392 // The name was declared in this scope before; check for conflicting | 1396 // The name was declared in this scope before; check for conflicting |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 // Even if we're not at the top-level of the global or a function | 1568 // Even if we're not at the top-level of the global or a function |
1565 // scope, we treat is as such and introduce the function with it's | 1569 // scope, we treat is as such and introduce the function with it's |
1566 // initial value upon entering the corresponding scope. | 1570 // initial value upon entering the corresponding scope. |
1567 VariableMode mode = harmony_scoping_ ? LET : VAR; | 1571 VariableMode mode = harmony_scoping_ ? LET : VAR; |
1568 Declare(name, mode, fun, true, CHECK_OK); | 1572 Declare(name, mode, fun, true, CHECK_OK); |
1569 return EmptyStatement(); | 1573 return EmptyStatement(); |
1570 } | 1574 } |
1571 | 1575 |
1572 | 1576 |
1573 Block* Parser::ParseBlock(ZoneStringList* labels, bool* ok) { | 1577 Block* Parser::ParseBlock(ZoneStringList* labels, bool* ok) { |
1574 if (harmony_scoping_) return ParseScopedBlock(labels, ok); | 1578 if (top_scope_->is_extended_mode()) return ParseScopedBlock(labels, ok); |
1575 | 1579 |
1576 // Block :: | 1580 // Block :: |
1577 // '{' Statement* '}' | 1581 // '{' Statement* '}' |
1578 | 1582 |
1579 // Note that a Block does not introduce a new execution scope! | 1583 // Note that a Block does not introduce a new execution scope! |
1580 // (ECMA-262, 3rd, 12.2) | 1584 // (ECMA-262, 3rd, 12.2) |
1581 // | 1585 // |
1582 // Construct block expecting 16 statements. | 1586 // Construct block expecting 16 statements. |
1583 Block* result = new(zone()) Block(isolate(), labels, 16, false); | 1587 Block* result = new(zone()) Block(isolate(), labels, 16, false); |
1584 Target target(&this->target_stack_, result); | 1588 Target target(&this->target_stack_, result); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 // bindings are created uninitialized by their declaration nodes and | 1684 // bindings are created uninitialized by their declaration nodes and |
1681 // need initialization. 'var' declared bindings are always initialized | 1685 // need initialization. 'var' declared bindings are always initialized |
1682 // immediately by their declaration nodes. | 1686 // immediately by their declaration nodes. |
1683 bool needs_init = false; | 1687 bool needs_init = false; |
1684 bool is_const = false; | 1688 bool is_const = false; |
1685 Token::Value init_op = Token::INIT_VAR; | 1689 Token::Value init_op = Token::INIT_VAR; |
1686 if (peek() == Token::VAR) { | 1690 if (peek() == Token::VAR) { |
1687 Consume(Token::VAR); | 1691 Consume(Token::VAR); |
1688 } else if (peek() == Token::CONST) { | 1692 } else if (peek() == Token::CONST) { |
1689 Consume(Token::CONST); | 1693 Consume(Token::CONST); |
1690 if (harmony_scoping_) { | 1694 switch (top_scope_->language_mode()) { |
1691 if (var_context != kSourceElement && | 1695 case CLASSIC_MODE: |
1692 var_context != kForStatement) { | 1696 mode = CONST; |
1693 // In harmony mode 'const' declarations are only allowed in source | 1697 init_op = Token::INIT_CONST; |
1694 // element positions. | 1698 break; |
1695 ReportMessage("unprotected_const", Vector<const char*>::empty()); | 1699 case STRICT_MODE: |
| 1700 ReportMessage("strict_const", Vector<const char*>::empty()); |
1696 *ok = false; | 1701 *ok = false; |
1697 return NULL; | 1702 return NULL; |
1698 } | 1703 case EXTENDED_MODE: |
1699 mode = CONST_HARMONY; | 1704 if (var_context != kSourceElement && |
1700 init_op = Token::INIT_CONST_HARMONY; | 1705 var_context != kForStatement) { |
1701 } else if (top_scope_->is_strict_mode()) { | 1706 // In extended mode 'const' declarations are only allowed in source |
1702 ReportMessage("strict_const", Vector<const char*>::empty()); | 1707 // element positions. |
1703 *ok = false; | 1708 ReportMessage("unprotected_const", Vector<const char*>::empty()); |
1704 return NULL; | 1709 *ok = false; |
1705 } else { | 1710 return NULL; |
1706 mode = CONST; | 1711 } |
1707 init_op = Token::INIT_CONST; | 1712 mode = CONST_HARMONY; |
| 1713 init_op = Token::INIT_CONST_HARMONY; |
1708 } | 1714 } |
1709 is_const = true; | 1715 is_const = true; |
1710 needs_init = true; | 1716 needs_init = true; |
1711 } else if (peek() == Token::LET) { | 1717 } else if (peek() == Token::LET) { |
| 1718 ASSERT(top_scope_->is_extended_mode()); |
1712 Consume(Token::LET); | 1719 Consume(Token::LET); |
1713 if (var_context != kSourceElement && | 1720 if (var_context != kSourceElement && |
1714 var_context != kForStatement) { | 1721 var_context != kForStatement) { |
1715 // Let declarations are only allowed in source element positions. | 1722 // Let declarations are only allowed in source element positions. |
1716 ASSERT(var_context == kStatement); | 1723 ASSERT(var_context == kStatement); |
1717 ReportMessage("unprotected_let", Vector<const char*>::empty()); | 1724 ReportMessage("unprotected_let", Vector<const char*>::empty()); |
1718 *ok = false; | 1725 *ok = false; |
1719 return NULL; | 1726 return NULL; |
1720 } | 1727 } |
1721 mode = LET; | 1728 mode = LET; |
(...skipping 23 matching lines...) Expand all Loading... |
1745 Handle<String> name; | 1752 Handle<String> name; |
1746 do { | 1753 do { |
1747 if (fni_ != NULL) fni_->Enter(); | 1754 if (fni_ != NULL) fni_->Enter(); |
1748 | 1755 |
1749 // Parse variable name. | 1756 // Parse variable name. |
1750 if (nvars > 0) Consume(Token::COMMA); | 1757 if (nvars > 0) Consume(Token::COMMA); |
1751 name = ParseIdentifier(CHECK_OK); | 1758 name = ParseIdentifier(CHECK_OK); |
1752 if (fni_ != NULL) fni_->PushVariableName(name); | 1759 if (fni_ != NULL) fni_->PushVariableName(name); |
1753 | 1760 |
1754 // Strict mode variables may not be named eval or arguments | 1761 // Strict mode variables may not be named eval or arguments |
1755 if (declaration_scope->is_strict_mode() && IsEvalOrArguments(name)) { | 1762 if (!declaration_scope->is_classic_mode() && IsEvalOrArguments(name)) { |
1756 ReportMessage("strict_var_name", Vector<const char*>::empty()); | 1763 ReportMessage("strict_var_name", Vector<const char*>::empty()); |
1757 *ok = false; | 1764 *ok = false; |
1758 return NULL; | 1765 return NULL; |
1759 } | 1766 } |
1760 | 1767 |
1761 // Declare variable. | 1768 // Declare variable. |
1762 // Note that we *always* must treat the initial value via a separate init | 1769 // Note that we *always* must treat the initial value via a separate init |
1763 // assignment for variables and constants because the value must be assigned | 1770 // assignment for variables and constants because the value must be assigned |
1764 // when the variable is encountered in the source. But the variable/constant | 1771 // when the variable is encountered in the source. But the variable/constant |
1765 // is declared (and set to 'undefined') upon entering the function within | 1772 // is declared (and set to 'undefined') upon entering the function within |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 // the number of arguments (1 or 2). | 1881 // the number of arguments (1 or 2). |
1875 initialize = | 1882 initialize = |
1876 new(zone()) CallRuntime( | 1883 new(zone()) CallRuntime( |
1877 isolate(), | 1884 isolate(), |
1878 isolate()->factory()->InitializeConstGlobal_symbol(), | 1885 isolate()->factory()->InitializeConstGlobal_symbol(), |
1879 Runtime::FunctionForId(Runtime::kInitializeConstGlobal), | 1886 Runtime::FunctionForId(Runtime::kInitializeConstGlobal), |
1880 arguments); | 1887 arguments); |
1881 } else { | 1888 } else { |
1882 // Add strict mode. | 1889 // Add strict mode. |
1883 // We may want to pass singleton to avoid Literal allocations. | 1890 // We may want to pass singleton to avoid Literal allocations. |
1884 StrictModeFlag flag = initialization_scope->strict_mode_flag(); | 1891 LanguageMode language_mode = initialization_scope->language_mode(); |
1885 arguments->Add(NewNumberLiteral(flag)); | 1892 arguments->Add(NewNumberLiteral(language_mode)); |
1886 | 1893 |
1887 // Be careful not to assign a value to the global variable if | 1894 // Be careful not to assign a value to the global variable if |
1888 // we're in a with. The initialization value should not | 1895 // we're in a with. The initialization value should not |
1889 // necessarily be stored in the global object in that case, | 1896 // necessarily be stored in the global object in that case, |
1890 // which is why we need to generate a separate assignment node. | 1897 // which is why we need to generate a separate assignment node. |
1891 if (value != NULL && !inside_with()) { | 1898 if (value != NULL && !inside_with()) { |
1892 arguments->Add(value); | 1899 arguments->Add(value); |
1893 value = NULL; // zap the value to avoid the unnecessary assignment | 1900 value = NULL; // zap the value to avoid the unnecessary assignment |
1894 } | 1901 } |
1895 | 1902 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 return new(zone()) ReturnStatement(expr); | 2138 return new(zone()) ReturnStatement(expr); |
2132 } | 2139 } |
2133 | 2140 |
2134 | 2141 |
2135 Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) { | 2142 Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) { |
2136 // WithStatement :: | 2143 // WithStatement :: |
2137 // 'with' '(' Expression ')' Statement | 2144 // 'with' '(' Expression ')' Statement |
2138 | 2145 |
2139 Expect(Token::WITH, CHECK_OK); | 2146 Expect(Token::WITH, CHECK_OK); |
2140 | 2147 |
2141 if (top_scope_->is_strict_mode()) { | 2148 if (!top_scope_->is_classic_mode()) { |
2142 ReportMessage("strict_mode_with", Vector<const char*>::empty()); | 2149 ReportMessage("strict_mode_with", Vector<const char*>::empty()); |
2143 *ok = false; | 2150 *ok = false; |
2144 return NULL; | 2151 return NULL; |
2145 } | 2152 } |
2146 | 2153 |
2147 Expect(Token::LPAREN, CHECK_OK); | 2154 Expect(Token::LPAREN, CHECK_OK); |
2148 Expression* expr = ParseExpression(true, CHECK_OK); | 2155 Expression* expr = ParseExpression(true, CHECK_OK); |
2149 Expect(Token::RPAREN, CHECK_OK); | 2156 Expect(Token::RPAREN, CHECK_OK); |
2150 | 2157 |
2151 top_scope_->DeclarationScope()->RecordWithStatement(); | 2158 top_scope_->DeclarationScope()->RecordWithStatement(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 Block* catch_block = NULL; | 2284 Block* catch_block = NULL; |
2278 Handle<String> name; | 2285 Handle<String> name; |
2279 if (tok == Token::CATCH) { | 2286 if (tok == Token::CATCH) { |
2280 Consume(Token::CATCH); | 2287 Consume(Token::CATCH); |
2281 | 2288 |
2282 Expect(Token::LPAREN, CHECK_OK); | 2289 Expect(Token::LPAREN, CHECK_OK); |
2283 catch_scope = NewScope(top_scope_, CATCH_SCOPE); | 2290 catch_scope = NewScope(top_scope_, CATCH_SCOPE); |
2284 catch_scope->set_start_position(scanner().location().beg_pos); | 2291 catch_scope->set_start_position(scanner().location().beg_pos); |
2285 name = ParseIdentifier(CHECK_OK); | 2292 name = ParseIdentifier(CHECK_OK); |
2286 | 2293 |
2287 if (top_scope_->is_strict_mode() && IsEvalOrArguments(name)) { | 2294 if (!top_scope_->is_classic_mode() && IsEvalOrArguments(name)) { |
2288 ReportMessage("strict_catch_variable", Vector<const char*>::empty()); | 2295 ReportMessage("strict_catch_variable", Vector<const char*>::empty()); |
2289 *ok = false; | 2296 *ok = false; |
2290 return NULL; | 2297 return NULL; |
2291 } | 2298 } |
2292 | 2299 |
2293 Expect(Token::RPAREN, CHECK_OK); | 2300 Expect(Token::RPAREN, CHECK_OK); |
2294 | 2301 |
2295 if (peek() == Token::LBRACE) { | 2302 if (peek() == Token::LBRACE) { |
2296 Target target(&this->target_stack_, &catch_collector); | 2303 Target target(&this->target_stack_, &catch_collector); |
2297 VariableMode mode = harmony_scoping_ ? LET : VAR; | 2304 VariableMode mode = harmony_scoping_ ? LET : VAR; |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 // Signal a reference error if the expression is an invalid left-hand | 2630 // Signal a reference error if the expression is an invalid left-hand |
2624 // side expression. We could report this as a syntax error here but | 2631 // side expression. We could report this as a syntax error here but |
2625 // for compatibility with JSC we choose to report the error at | 2632 // for compatibility with JSC we choose to report the error at |
2626 // runtime. | 2633 // runtime. |
2627 if (expression == NULL || !expression->IsValidLeftHandSide()) { | 2634 if (expression == NULL || !expression->IsValidLeftHandSide()) { |
2628 Handle<String> type = | 2635 Handle<String> type = |
2629 isolate()->factory()->invalid_lhs_in_assignment_symbol(); | 2636 isolate()->factory()->invalid_lhs_in_assignment_symbol(); |
2630 expression = NewThrowReferenceError(type); | 2637 expression = NewThrowReferenceError(type); |
2631 } | 2638 } |
2632 | 2639 |
2633 if (top_scope_->is_strict_mode()) { | 2640 if (!top_scope_->is_classic_mode()) { |
2634 // Assignment to eval or arguments is disallowed in strict mode. | 2641 // Assignment to eval or arguments is disallowed in strict mode. |
2635 CheckStrictModeLValue(expression, "strict_lhs_assignment", CHECK_OK); | 2642 CheckStrictModeLValue(expression, "strict_lhs_assignment", CHECK_OK); |
2636 } | 2643 } |
2637 | 2644 |
2638 Token::Value op = Next(); // Get assignment operator. | 2645 Token::Value op = Next(); // Get assignment operator. |
2639 int pos = scanner().location().beg_pos; | 2646 int pos = scanner().location().beg_pos; |
2640 Expression* right = ParseAssignmentExpression(accept_IN, CHECK_OK); | 2647 Expression* right = ParseAssignmentExpression(accept_IN, CHECK_OK); |
2641 | 2648 |
2642 // TODO(1231235): We try to estimate the set of properties set by | 2649 // TODO(1231235): We try to estimate the set of properties set by |
2643 // constructors. We define a new property whenever there is an | 2650 // constructors. We define a new property whenever there is an |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 return NewNumberLiteral(-value); | 2839 return NewNumberLiteral(-value); |
2833 case Token::BIT_NOT: | 2840 case Token::BIT_NOT: |
2834 return NewNumberLiteral(~DoubleToInt32(value)); | 2841 return NewNumberLiteral(~DoubleToInt32(value)); |
2835 default: | 2842 default: |
2836 break; | 2843 break; |
2837 } | 2844 } |
2838 } | 2845 } |
2839 } | 2846 } |
2840 | 2847 |
2841 // "delete identifier" is a syntax error in strict mode. | 2848 // "delete identifier" is a syntax error in strict mode. |
2842 if (op == Token::DELETE && top_scope_->is_strict_mode()) { | 2849 if (op == Token::DELETE && !top_scope_->is_classic_mode()) { |
2843 VariableProxy* operand = expression->AsVariableProxy(); | 2850 VariableProxy* operand = expression->AsVariableProxy(); |
2844 if (operand != NULL && !operand->is_this()) { | 2851 if (operand != NULL && !operand->is_this()) { |
2845 ReportMessage("strict_delete", Vector<const char*>::empty()); | 2852 ReportMessage("strict_delete", Vector<const char*>::empty()); |
2846 *ok = false; | 2853 *ok = false; |
2847 return NULL; | 2854 return NULL; |
2848 } | 2855 } |
2849 } | 2856 } |
2850 | 2857 |
2851 return new(zone()) UnaryOperation(isolate(), op, expression, position); | 2858 return new(zone()) UnaryOperation(isolate(), op, expression, position); |
2852 | 2859 |
2853 } else if (Token::IsCountOp(op)) { | 2860 } else if (Token::IsCountOp(op)) { |
2854 op = Next(); | 2861 op = Next(); |
2855 Expression* expression = ParseUnaryExpression(CHECK_OK); | 2862 Expression* expression = ParseUnaryExpression(CHECK_OK); |
2856 // Signal a reference error if the expression is an invalid | 2863 // Signal a reference error if the expression is an invalid |
2857 // left-hand side expression. We could report this as a syntax | 2864 // left-hand side expression. We could report this as a syntax |
2858 // error here but for compatibility with JSC we choose to report the | 2865 // error here but for compatibility with JSC we choose to report the |
2859 // error at runtime. | 2866 // error at runtime. |
2860 if (expression == NULL || !expression->IsValidLeftHandSide()) { | 2867 if (expression == NULL || !expression->IsValidLeftHandSide()) { |
2861 Handle<String> type = | 2868 Handle<String> type = |
2862 isolate()->factory()->invalid_lhs_in_prefix_op_symbol(); | 2869 isolate()->factory()->invalid_lhs_in_prefix_op_symbol(); |
2863 expression = NewThrowReferenceError(type); | 2870 expression = NewThrowReferenceError(type); |
2864 } | 2871 } |
2865 | 2872 |
2866 if (top_scope_->is_strict_mode()) { | 2873 if (!top_scope_->is_classic_mode()) { |
2867 // Prefix expression operand in strict mode may not be eval or arguments. | 2874 // Prefix expression operand in strict mode may not be eval or arguments. |
2868 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); | 2875 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); |
2869 } | 2876 } |
2870 | 2877 |
2871 int position = scanner().location().beg_pos; | 2878 int position = scanner().location().beg_pos; |
2872 return new(zone()) CountOperation(isolate(), | 2879 return new(zone()) CountOperation(isolate(), |
2873 op, | 2880 op, |
2874 true /* prefix */, | 2881 true /* prefix */, |
2875 expression, | 2882 expression, |
2876 position); | 2883 position); |
(...skipping 14 matching lines...) Expand all Loading... |
2891 // Signal a reference error if the expression is an invalid | 2898 // Signal a reference error if the expression is an invalid |
2892 // left-hand side expression. We could report this as a syntax | 2899 // left-hand side expression. We could report this as a syntax |
2893 // error here but for compatibility with JSC we choose to report the | 2900 // error here but for compatibility with JSC we choose to report the |
2894 // error at runtime. | 2901 // error at runtime. |
2895 if (expression == NULL || !expression->IsValidLeftHandSide()) { | 2902 if (expression == NULL || !expression->IsValidLeftHandSide()) { |
2896 Handle<String> type = | 2903 Handle<String> type = |
2897 isolate()->factory()->invalid_lhs_in_postfix_op_symbol(); | 2904 isolate()->factory()->invalid_lhs_in_postfix_op_symbol(); |
2898 expression = NewThrowReferenceError(type); | 2905 expression = NewThrowReferenceError(type); |
2899 } | 2906 } |
2900 | 2907 |
2901 if (top_scope_->is_strict_mode()) { | 2908 if (!top_scope_->is_classic_mode()) { |
2902 // Postfix expression operand in strict mode may not be eval or arguments. | 2909 // Postfix expression operand in strict mode may not be eval or arguments. |
2903 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); | 2910 CheckStrictModeLValue(expression, "strict_lhs_prefix", CHECK_OK); |
2904 } | 2911 } |
2905 | 2912 |
2906 Token::Value next = Next(); | 2913 Token::Value next = Next(); |
2907 int position = scanner().location().beg_pos; | 2914 int position = scanner().location().beg_pos; |
2908 expression = | 2915 expression = |
2909 new(zone()) CountOperation(isolate(), | 2916 new(zone()) CountOperation(isolate(), |
2910 next, | 2917 next, |
2911 false /* postfix */, | 2918 false /* postfix */, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 case Token::STRING: | 3129 case Token::STRING: |
3123 return ReportMessage("unexpected_token_string", | 3130 return ReportMessage("unexpected_token_string", |
3124 Vector<const char*>::empty()); | 3131 Vector<const char*>::empty()); |
3125 case Token::IDENTIFIER: | 3132 case Token::IDENTIFIER: |
3126 return ReportMessage("unexpected_token_identifier", | 3133 return ReportMessage("unexpected_token_identifier", |
3127 Vector<const char*>::empty()); | 3134 Vector<const char*>::empty()); |
3128 case Token::FUTURE_RESERVED_WORD: | 3135 case Token::FUTURE_RESERVED_WORD: |
3129 return ReportMessage("unexpected_reserved", | 3136 return ReportMessage("unexpected_reserved", |
3130 Vector<const char*>::empty()); | 3137 Vector<const char*>::empty()); |
3131 case Token::FUTURE_STRICT_RESERVED_WORD: | 3138 case Token::FUTURE_STRICT_RESERVED_WORD: |
3132 return ReportMessage(top_scope_->is_strict_mode() ? | 3139 return ReportMessage(top_scope_->is_classic_mode() ? |
3133 "unexpected_strict_reserved" : | 3140 "unexpected_token_identifier" : |
3134 "unexpected_token_identifier", | 3141 "unexpected_strict_reserved", |
3135 Vector<const char*>::empty()); | 3142 Vector<const char*>::empty()); |
3136 default: | 3143 default: |
3137 const char* name = Token::String(token); | 3144 const char* name = Token::String(token); |
3138 ASSERT(name != NULL); | 3145 ASSERT(name != NULL); |
3139 ReportMessage("unexpected_token", Vector<const char*>(&name, 1)); | 3146 ReportMessage("unexpected_token", Vector<const char*>(&name, 1)); |
3140 } | 3147 } |
3141 } | 3148 } |
3142 | 3149 |
3143 | 3150 |
3144 void Parser::ReportInvalidPreparseData(Handle<String> name, bool* ok) { | 3151 void Parser::ReportInvalidPreparseData(Handle<String> name, bool* ok) { |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3690 // '{' ( | 3697 // '{' ( |
3691 // ((IdentifierName | String | Number) ':' AssignmentExpression) | 3698 // ((IdentifierName | String | Number) ':' AssignmentExpression) |
3692 // | (('get' | 'set') (IdentifierName | String | Number) FunctionLiteral) | 3699 // | (('get' | 'set') (IdentifierName | String | Number) FunctionLiteral) |
3693 // )*[','] '}' | 3700 // )*[','] '}' |
3694 | 3701 |
3695 ZoneList<ObjectLiteral::Property*>* properties = | 3702 ZoneList<ObjectLiteral::Property*>* properties = |
3696 new(zone()) ZoneList<ObjectLiteral::Property*>(4); | 3703 new(zone()) ZoneList<ObjectLiteral::Property*>(4); |
3697 int number_of_boilerplate_properties = 0; | 3704 int number_of_boilerplate_properties = 0; |
3698 bool has_function = false; | 3705 bool has_function = false; |
3699 | 3706 |
3700 ObjectLiteralPropertyChecker checker(this, top_scope_->is_strict_mode()); | 3707 ObjectLiteralPropertyChecker checker( |
| 3708 this, !top_scope_->is_classic_mode()); |
3701 | 3709 |
3702 Expect(Token::LBRACE, CHECK_OK); | 3710 Expect(Token::LBRACE, CHECK_OK); |
3703 | 3711 |
3704 while (peek() != Token::RBRACE) { | 3712 while (peek() != Token::RBRACE) { |
3705 if (fni_ != NULL) fni_->Enter(); | 3713 if (fni_ != NULL) fni_->Enter(); |
3706 | 3714 |
3707 Literal* key = NULL; | 3715 Literal* key = NULL; |
3708 Token::Value next = peek(); | 3716 Token::Value next = peek(); |
3709 | 3717 |
3710 // Location of the property name token | 3718 // Location of the property name token |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4003 if (scope->end_position() <= function_block_pos) { | 4011 if (scope->end_position() <= function_block_pos) { |
4004 // End position greater than end of stream is safe, and hard to check. | 4012 // End position greater than end of stream is safe, and hard to check. |
4005 ReportInvalidPreparseData(function_name, CHECK_OK); | 4013 ReportInvalidPreparseData(function_name, CHECK_OK); |
4006 } | 4014 } |
4007 isolate()->counters()->total_preparse_skipped()->Increment( | 4015 isolate()->counters()->total_preparse_skipped()->Increment( |
4008 scope->end_position() - function_block_pos); | 4016 scope->end_position() - function_block_pos); |
4009 // Seek to position just before terminal '}'. | 4017 // Seek to position just before terminal '}'. |
4010 scanner().SeekForward(scope->end_position() - 1); | 4018 scanner().SeekForward(scope->end_position() - 1); |
4011 materialized_literal_count = entry.literal_count(); | 4019 materialized_literal_count = entry.literal_count(); |
4012 expected_property_count = entry.property_count(); | 4020 expected_property_count = entry.property_count(); |
4013 top_scope_->SetStrictModeFlag(entry.strict_mode_flag()); | 4021 top_scope_->SetLanguageMode(entry.language_mode()); |
4014 only_simple_this_property_assignments = false; | 4022 only_simple_this_property_assignments = false; |
4015 this_property_assignments = isolate()->factory()->empty_fixed_array(); | 4023 this_property_assignments = isolate()->factory()->empty_fixed_array(); |
4016 Expect(Token::RBRACE, CHECK_OK); | 4024 Expect(Token::RBRACE, CHECK_OK); |
4017 } | 4025 } |
4018 } | 4026 } |
4019 | 4027 |
4020 if (!is_lazily_compiled) { | 4028 if (!is_lazily_compiled) { |
4021 ParseSourceElements(body, Token::RBRACE, CHECK_OK); | 4029 ParseSourceElements(body, Token::RBRACE, CHECK_OK); |
4022 | 4030 |
4023 materialized_literal_count = lexical_scope.materialized_literal_count(); | 4031 materialized_literal_count = lexical_scope.materialized_literal_count(); |
4024 expected_property_count = lexical_scope.expected_property_count(); | 4032 expected_property_count = lexical_scope.expected_property_count(); |
4025 only_simple_this_property_assignments = | 4033 only_simple_this_property_assignments = |
4026 lexical_scope.only_simple_this_property_assignments(); | 4034 lexical_scope.only_simple_this_property_assignments(); |
4027 this_property_assignments = lexical_scope.this_property_assignments(); | 4035 this_property_assignments = lexical_scope.this_property_assignments(); |
4028 | 4036 |
4029 Expect(Token::RBRACE, CHECK_OK); | 4037 Expect(Token::RBRACE, CHECK_OK); |
4030 scope->set_end_position(scanner().location().end_pos); | 4038 scope->set_end_position(scanner().location().end_pos); |
4031 } | 4039 } |
4032 | 4040 |
4033 // Validate strict mode. | 4041 // Validate strict mode. |
4034 if (top_scope_->is_strict_mode()) { | 4042 if (!top_scope_->is_classic_mode()) { |
4035 if (IsEvalOrArguments(function_name)) { | 4043 if (IsEvalOrArguments(function_name)) { |
4036 int start_pos = scope->start_position(); | 4044 int start_pos = scope->start_position(); |
4037 int position = function_token_position != RelocInfo::kNoPosition | 4045 int position = function_token_position != RelocInfo::kNoPosition |
4038 ? function_token_position | 4046 ? function_token_position |
4039 : (start_pos > 0 ? start_pos - 1 : start_pos); | 4047 : (start_pos > 0 ? start_pos - 1 : start_pos); |
4040 Scanner::Location location = Scanner::Location(position, start_pos); | 4048 Scanner::Location location = Scanner::Location(position, start_pos); |
4041 ReportMessageAt(location, | 4049 ReportMessageAt(location, |
4042 "strict_function_name", Vector<const char*>::empty()); | 4050 "strict_function_name", Vector<const char*>::empty()); |
4043 *ok = false; | 4051 *ok = false; |
4044 return NULL; | 4052 return NULL; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4209 | 4217 |
4210 | 4218 |
4211 Literal* Parser::GetLiteralNumber(double value) { | 4219 Literal* Parser::GetLiteralNumber(double value) { |
4212 return NewNumberLiteral(value); | 4220 return NewNumberLiteral(value); |
4213 } | 4221 } |
4214 | 4222 |
4215 | 4223 |
4216 // Parses an identifier that is valid for the current scope, in particular it | 4224 // Parses an identifier that is valid for the current scope, in particular it |
4217 // fails on strict mode future reserved keywords in a strict scope. | 4225 // fails on strict mode future reserved keywords in a strict scope. |
4218 Handle<String> Parser::ParseIdentifier(bool* ok) { | 4226 Handle<String> Parser::ParseIdentifier(bool* ok) { |
4219 if (top_scope_->is_strict_mode()) { | 4227 if (!top_scope_->is_classic_mode()) { |
4220 Expect(Token::IDENTIFIER, ok); | 4228 Expect(Token::IDENTIFIER, ok); |
4221 } else if (!Check(Token::IDENTIFIER)) { | 4229 } else if (!Check(Token::IDENTIFIER)) { |
4222 Expect(Token::FUTURE_STRICT_RESERVED_WORD, ok); | 4230 Expect(Token::FUTURE_STRICT_RESERVED_WORD, ok); |
4223 } | 4231 } |
4224 if (!*ok) return Handle<String>(); | 4232 if (!*ok) return Handle<String>(); |
4225 return GetSymbol(ok); | 4233 return GetSymbol(ok); |
4226 } | 4234 } |
4227 | 4235 |
4228 | 4236 |
4229 // Parses and identifier or a strict mode future reserved word, and indicate | 4237 // Parses and identifier or a strict mode future reserved word, and indicate |
(...skipping 22 matching lines...) Expand all Loading... |
4252 } | 4260 } |
4253 return GetSymbol(ok); | 4261 return GetSymbol(ok); |
4254 } | 4262 } |
4255 | 4263 |
4256 | 4264 |
4257 // Checks LHS expression for assignment and prefix/postfix increment/decrement | 4265 // Checks LHS expression for assignment and prefix/postfix increment/decrement |
4258 // in strict mode. | 4266 // in strict mode. |
4259 void Parser::CheckStrictModeLValue(Expression* expression, | 4267 void Parser::CheckStrictModeLValue(Expression* expression, |
4260 const char* error, | 4268 const char* error, |
4261 bool* ok) { | 4269 bool* ok) { |
4262 ASSERT(top_scope_->is_strict_mode()); | 4270 ASSERT(!top_scope_->is_classic_mode()); |
4263 VariableProxy* lhs = expression != NULL | 4271 VariableProxy* lhs = expression != NULL |
4264 ? expression->AsVariableProxy() | 4272 ? expression->AsVariableProxy() |
4265 : NULL; | 4273 : NULL; |
4266 | 4274 |
4267 if (lhs != NULL && !lhs->is_this() && IsEvalOrArguments(lhs->name())) { | 4275 if (lhs != NULL && !lhs->is_this() && IsEvalOrArguments(lhs->name())) { |
4268 ReportMessage(error, Vector<const char*>::empty()); | 4276 ReportMessage(error, Vector<const char*>::empty()); |
4269 *ok = false; | 4277 *ok = false; |
4270 } | 4278 } |
4271 } | 4279 } |
4272 | 4280 |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5415 DeleteArray(message); | 5423 DeleteArray(message); |
5416 for (int i = 0; i < args.length(); i++) { | 5424 for (int i = 0; i < args.length(); i++) { |
5417 DeleteArray(args[i]); | 5425 DeleteArray(args[i]); |
5418 } | 5426 } |
5419 DeleteArray(args.start()); | 5427 DeleteArray(args.start()); |
5420 ASSERT(info->isolate()->has_pending_exception()); | 5428 ASSERT(info->isolate()->has_pending_exception()); |
5421 } else { | 5429 } else { |
5422 Handle<String> source = Handle<String>(String::cast(script->source())); | 5430 Handle<String> source = Handle<String>(String::cast(script->source())); |
5423 result = parser.ParseProgram(source, | 5431 result = parser.ParseProgram(source, |
5424 info->is_global(), | 5432 info->is_global(), |
5425 info->strict_mode_flag()); | 5433 info->language_mode()); |
5426 } | 5434 } |
5427 } | 5435 } |
5428 info->SetFunction(result); | 5436 info->SetFunction(result); |
5429 return (result != NULL); | 5437 return (result != NULL); |
5430 } | 5438 } |
5431 | 5439 |
5432 } } // namespace v8::internal | 5440 } } // namespace v8::internal |
OLD | NEW |