| OLD | NEW |
| 1 |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 2 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 4 // met: | 5 // met: |
| 5 // | 6 // |
| 6 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 11 // disclaimer in the documentation and/or other materials provided |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 case i::Token::LBRACK: | 895 case i::Token::LBRACK: |
| 895 result = ParseArrayLiteral(CHECK_OK); | 896 result = ParseArrayLiteral(CHECK_OK); |
| 896 break; | 897 break; |
| 897 | 898 |
| 898 case i::Token::LBRACE: | 899 case i::Token::LBRACE: |
| 899 result = ParseObjectLiteral(CHECK_OK); | 900 result = ParseObjectLiteral(CHECK_OK); |
| 900 break; | 901 break; |
| 901 | 902 |
| 902 case i::Token::LPAREN: | 903 case i::Token::LPAREN: |
| 903 Consume(i::Token::LPAREN); | 904 Consume(i::Token::LPAREN); |
| 905 parenthesized_function_ = (peek() == i::Token::FUNCTION); |
| 904 result = ParseExpression(true, CHECK_OK); | 906 result = ParseExpression(true, CHECK_OK); |
| 905 Expect(i::Token::RPAREN, CHECK_OK); | 907 Expect(i::Token::RPAREN, CHECK_OK); |
| 906 if (result == kIdentifierExpression) result = kUnknownExpression; | 908 if (result == kIdentifierExpression) result = kUnknownExpression; |
| 907 break; | 909 break; |
| 908 | 910 |
| 909 case i::Token::MOD: | 911 case i::Token::MOD: |
| 910 result = ParseV8Intrinsic(CHECK_OK); | 912 result = ParseV8Intrinsic(CHECK_OK); |
| 911 break; | 913 break; |
| 912 | 914 |
| 913 default: { | 915 default: { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 } | 1073 } |
| 1072 } | 1074 } |
| 1073 Expect(i::Token::RPAREN, CHECK_OK); | 1075 Expect(i::Token::RPAREN, CHECK_OK); |
| 1074 | 1076 |
| 1075 Expect(i::Token::LBRACE, CHECK_OK); | 1077 Expect(i::Token::LBRACE, CHECK_OK); |
| 1076 int function_block_pos = scanner_->location().beg_pos; | 1078 int function_block_pos = scanner_->location().beg_pos; |
| 1077 | 1079 |
| 1078 // Determine if the function will be lazily compiled. | 1080 // Determine if the function will be lazily compiled. |
| 1079 // Currently only happens to top-level functions. | 1081 // Currently only happens to top-level functions. |
| 1080 // Optimistically assume that all top-level functions are lazily compiled. | 1082 // Optimistically assume that all top-level functions are lazily compiled. |
| 1081 bool is_lazily_compiled = | 1083 bool is_lazily_compiled = (outer_scope_type == kTopLevelScope && |
| 1082 (outer_scope_type == kTopLevelScope && !inside_with && allow_lazy_); | 1084 !inside_with && allow_lazy_ && |
| 1085 !parenthesized_function_); |
| 1086 parenthesized_function_ = false; |
| 1083 | 1087 |
| 1084 if (is_lazily_compiled) { | 1088 if (is_lazily_compiled) { |
| 1085 log_->PauseRecording(); | 1089 log_->PauseRecording(); |
| 1086 ParseSourceElements(i::Token::RBRACE, ok); | 1090 ParseSourceElements(i::Token::RBRACE, ok); |
| 1087 log_->ResumeRecording(); | 1091 log_->ResumeRecording(); |
| 1088 if (!*ok) return kUnknownExpression; | 1092 if (!*ok) return kUnknownExpression; |
| 1089 | 1093 |
| 1090 Expect(i::Token::RBRACE, CHECK_OK); | 1094 Expect(i::Token::RBRACE, CHECK_OK); |
| 1091 | 1095 |
| 1092 // Position right after terminal '}'. | 1096 // Position right after terminal '}'. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 if (scanner_->is_literal_ascii() && scanner_->literal_length() == 3) { | 1192 if (scanner_->is_literal_ascii() && scanner_->literal_length() == 3) { |
| 1189 const char* token = scanner_->literal_ascii_string().start(); | 1193 const char* token = scanner_->literal_ascii_string().start(); |
| 1190 *is_get = strncmp(token, "get", 3) == 0; | 1194 *is_get = strncmp(token, "get", 3) == 0; |
| 1191 *is_set = !*is_get && strncmp(token, "set", 3) == 0; | 1195 *is_set = !*is_get && strncmp(token, "set", 3) == 0; |
| 1192 } | 1196 } |
| 1193 return GetIdentifierSymbol(); | 1197 return GetIdentifierSymbol(); |
| 1194 } | 1198 } |
| 1195 | 1199 |
| 1196 #undef CHECK_OK | 1200 #undef CHECK_OK |
| 1197 } } // v8::preparser | 1201 } } // v8::preparser |
| OLD | NEW |