OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 int pos) { | 1333 int pos) { |
1334 return PreParserExpression::Default(); | 1334 return PreParserExpression::Default(); |
1335 } | 1335 } |
1336 PreParserExpression NewNumberLiteral(double number, | 1336 PreParserExpression NewNumberLiteral(double number, |
1337 int pos) { | 1337 int pos) { |
1338 return PreParserExpression::Default(); | 1338 return PreParserExpression::Default(); |
1339 } | 1339 } |
1340 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, | 1340 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, |
1341 PreParserIdentifier js_flags, | 1341 PreParserIdentifier js_flags, |
1342 int literal_index, | 1342 int literal_index, |
| 1343 bool is_strong, |
1343 int pos) { | 1344 int pos) { |
1344 return PreParserExpression::Default(); | 1345 return PreParserExpression::Default(); |
1345 } | 1346 } |
1346 PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 1347 PreParserExpression NewArrayLiteral(PreParserExpressionList values, |
1347 int literal_index, | 1348 int literal_index, |
| 1349 bool is_strong, |
1348 int pos) { | 1350 int pos) { |
1349 return PreParserExpression::Default(); | 1351 return PreParserExpression::Default(); |
1350 } | 1352 } |
1351 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1353 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, |
1352 PreParserExpression value, | 1354 PreParserExpression value, |
1353 ObjectLiteralProperty::Kind kind, | 1355 ObjectLiteralProperty::Kind kind, |
1354 bool is_static, | 1356 bool is_static, |
1355 bool is_computed_name) { | 1357 bool is_computed_name) { |
1356 return PreParserExpression::Default(); | 1358 return PreParserExpression::Default(); |
1357 } | 1359 } |
1358 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1360 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, |
1359 PreParserExpression value, | 1361 PreParserExpression value, |
1360 bool is_static, | 1362 bool is_static, |
1361 bool is_computed_name) { | 1363 bool is_computed_name) { |
1362 return PreParserExpression::Default(); | 1364 return PreParserExpression::Default(); |
1363 } | 1365 } |
1364 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, | 1366 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, |
1365 int literal_index, | 1367 int literal_index, |
1366 int boilerplate_properties, | 1368 int boilerplate_properties, |
1367 bool has_function, | 1369 bool has_function, |
| 1370 bool is_strong, |
1368 int pos) { | 1371 int pos) { |
1369 return PreParserExpression::Default(); | 1372 return PreParserExpression::Default(); |
1370 } | 1373 } |
1371 PreParserExpression NewVariableProxy(void* variable) { | 1374 PreParserExpression NewVariableProxy(void* variable) { |
1372 return PreParserExpression::Default(); | 1375 return PreParserExpression::Default(); |
1373 } | 1376 } |
1374 PreParserExpression NewProperty(PreParserExpression obj, | 1377 PreParserExpression NewProperty(PreParserExpression obj, |
1375 PreParserExpression key, | 1378 PreParserExpression key, |
1376 int pos) { | 1379 int pos) { |
1377 if (obj.IsThis()) { | 1380 if (obj.IsThis()) { |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2203 | 2206 |
2204 IdentifierT js_pattern = this->GetNextSymbol(scanner()); | 2207 IdentifierT js_pattern = this->GetNextSymbol(scanner()); |
2205 if (!scanner()->ScanRegExpFlags()) { | 2208 if (!scanner()->ScanRegExpFlags()) { |
2206 Next(); | 2209 Next(); |
2207 ReportMessage("malformed_regexp_flags"); | 2210 ReportMessage("malformed_regexp_flags"); |
2208 *ok = false; | 2211 *ok = false; |
2209 return Traits::EmptyExpression(); | 2212 return Traits::EmptyExpression(); |
2210 } | 2213 } |
2211 IdentifierT js_flags = this->GetNextSymbol(scanner()); | 2214 IdentifierT js_flags = this->GetNextSymbol(scanner()); |
2212 Next(); | 2215 Next(); |
2213 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, pos); | 2216 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, |
| 2217 is_strong(language_mode()), pos); |
2214 } | 2218 } |
2215 | 2219 |
2216 | 2220 |
2217 #define CHECK_OK ok); \ | 2221 #define CHECK_OK ok); \ |
2218 if (!*ok) return this->EmptyExpression(); \ | 2222 if (!*ok) return this->EmptyExpression(); \ |
2219 ((void)0 | 2223 ((void)0 |
2220 #define DUMMY ) // to make indentation work | 2224 #define DUMMY ) // to make indentation work |
2221 #undef DUMMY | 2225 #undef DUMMY |
2222 | 2226 |
2223 // Used in functions where the return type is not ExpressionT. | 2227 // Used in functions where the return type is not ExpressionT. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 values->Add(elem, zone_); | 2472 values->Add(elem, zone_); |
2469 if (peek() != Token::RBRACK) { | 2473 if (peek() != Token::RBRACK) { |
2470 Expect(Token::COMMA, CHECK_OK); | 2474 Expect(Token::COMMA, CHECK_OK); |
2471 } | 2475 } |
2472 } | 2476 } |
2473 Expect(Token::RBRACK, CHECK_OK); | 2477 Expect(Token::RBRACK, CHECK_OK); |
2474 | 2478 |
2475 // Update the scope information before the pre-parsing bailout. | 2479 // Update the scope information before the pre-parsing bailout. |
2476 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2480 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
2477 | 2481 |
2478 return factory()->NewArrayLiteral(values, literal_index, pos); | 2482 return factory()->NewArrayLiteral(values, literal_index, |
| 2483 is_strong(language_mode()), pos); |
2479 } | 2484 } |
2480 | 2485 |
2481 | 2486 |
2482 template <class Traits> | 2487 template <class Traits> |
2483 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( | 2488 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( |
2484 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, | 2489 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, |
2485 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { | 2490 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { |
2486 Token::Value token = peek(); | 2491 Token::Value token = peek(); |
2487 int pos = peek_position(); | 2492 int pos = peek_position(); |
2488 | 2493 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 } | 2729 } |
2725 Expect(Token::RBRACE, CHECK_OK); | 2730 Expect(Token::RBRACE, CHECK_OK); |
2726 | 2731 |
2727 // Computation of literal_index must happen before pre parse bailout. | 2732 // Computation of literal_index must happen before pre parse bailout. |
2728 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2733 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
2729 | 2734 |
2730 return factory()->NewObjectLiteral(properties, | 2735 return factory()->NewObjectLiteral(properties, |
2731 literal_index, | 2736 literal_index, |
2732 number_of_boilerplate_properties, | 2737 number_of_boilerplate_properties, |
2733 has_function, | 2738 has_function, |
| 2739 is_strong(language_mode()), |
2734 pos); | 2740 pos); |
2735 } | 2741 } |
2736 | 2742 |
2737 | 2743 |
2738 template <class Traits> | 2744 template <class Traits> |
2739 typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments( | 2745 typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments( |
2740 Scanner::Location* first_spread_arg_loc, ExpressionClassifier* classifier, | 2746 Scanner::Location* first_spread_arg_loc, ExpressionClassifier* classifier, |
2741 bool* ok) { | 2747 bool* ok) { |
2742 // Arguments :: | 2748 // Arguments :: |
2743 // '(' (AssignmentExpression)*[','] ')' | 2749 // '(' (AssignmentExpression)*[','] ')' |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3923 *ok = false; | 3929 *ok = false; |
3924 return; | 3930 return; |
3925 } | 3931 } |
3926 has_seen_constructor_ = true; | 3932 has_seen_constructor_ = true; |
3927 return; | 3933 return; |
3928 } | 3934 } |
3929 } | 3935 } |
3930 } } // v8::internal | 3936 } } // v8::internal |
3931 | 3937 |
3932 #endif // V8_PREPARSER_H | 3938 #endif // V8_PREPARSER_H |
OLD | NEW |