Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/preparser.cc

Issue 209863004: PreParser cleanup: no need to track with-ness of scopes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 bool name_is_strict_reserved, 843 bool name_is_strict_reserved,
844 bool is_generator, 844 bool is_generator,
845 int function_token_pos, 845 int function_token_pos,
846 FunctionLiteral::FunctionType function_type, 846 FunctionLiteral::FunctionType function_type,
847 bool* ok) { 847 bool* ok) {
848 // Function :: 848 // Function ::
849 // '(' FormalParameterList? ')' '{' FunctionBody '}' 849 // '(' FormalParameterList? ')' '{' FunctionBody '}'
850 850
851 // Parse function body. 851 // Parse function body.
852 ScopeType outer_scope_type = scope_->type(); 852 ScopeType outer_scope_type = scope_->type();
853 bool inside_with = scope_->inside_with();
854 PreParserScope function_scope(scope_, FUNCTION_SCOPE); 853 PreParserScope function_scope(scope_, FUNCTION_SCOPE);
855 FunctionState function_state(&function_state_, &scope_, &function_scope); 854 FunctionState function_state(&function_state_, &scope_, &function_scope);
856 function_state.set_is_generator(is_generator); 855 function_state.set_is_generator(is_generator);
857 // FormalParameterList :: 856 // FormalParameterList ::
858 // '(' (Identifier)*[','] ')' 857 // '(' (Identifier)*[','] ')'
859 Expect(Token::LPAREN, CHECK_OK); 858 Expect(Token::LPAREN, CHECK_OK);
860 int start_position = position(); 859 int start_position = position();
861 bool done = (peek() == Token::RPAREN); 860 bool done = (peek() == Token::RPAREN);
862 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); 861 DuplicateFinder duplicate_finder(scanner()->unicode_cache());
863 // We don't yet know if the function will be strict, so we cannot yet produce 862 // We don't yet know if the function will be strict, so we cannot yet produce
(...skipping 21 matching lines...) Expand all
885 884
886 done = (peek() == Token::RPAREN); 885 done = (peek() == Token::RPAREN);
887 if (!done) { 886 if (!done) {
888 Expect(Token::COMMA, CHECK_OK); 887 Expect(Token::COMMA, CHECK_OK);
889 } 888 }
890 } 889 }
891 Expect(Token::RPAREN, CHECK_OK); 890 Expect(Token::RPAREN, CHECK_OK);
892 891
893 // See Parser::ParseFunctionLiteral for more information about lazy parsing 892 // See Parser::ParseFunctionLiteral for more information about lazy parsing
894 // and lazy compilation. 893 // and lazy compilation.
895 bool is_lazily_parsed = (outer_scope_type == GLOBAL_SCOPE && 894 bool is_lazily_parsed = (outer_scope_type == GLOBAL_SCOPE && allow_lazy() &&
896 !inside_with && allow_lazy() &&
897 !parenthesized_function_); 895 !parenthesized_function_);
898 parenthesized_function_ = false; 896 parenthesized_function_ = false;
899 897
900 Expect(Token::LBRACE, CHECK_OK); 898 Expect(Token::LBRACE, CHECK_OK);
901 if (is_lazily_parsed) { 899 if (is_lazily_parsed) {
902 ParseLazyFunctionLiteralBody(CHECK_OK); 900 ParseLazyFunctionLiteralBody(CHECK_OK);
903 } else { 901 } else {
904 ParseSourceElements(Token::RBRACE, ok); 902 ParseSourceElements(Token::RBRACE, ok);
905 } 903 }
906 Expect(Token::RBRACE, CHECK_OK); 904 Expect(Token::RBRACE, CHECK_OK);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 977
980 978
981 void PreParser::LogSymbol() { 979 void PreParser::LogSymbol() {
982 if (log_->ShouldLogSymbols()) { 980 if (log_->ShouldLogSymbols()) {
983 scanner()->LogSymbol(log_, position()); 981 scanner()->LogSymbol(log_, position());
984 } 982 }
985 } 983 }
986 984
987 985
988 } } // v8::internal 986 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698