OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 kAllowLazy, | 1351 kAllowLazy, |
1352 kAllowNatives, | 1352 kAllowNatives, |
1353 kAllowHarmonyScoping, | 1353 kAllowHarmonyScoping, |
1354 kAllowHarmonyModules, | 1354 kAllowHarmonyModules, |
1355 kAllowHarmonyNumericLiterals, | 1355 kAllowHarmonyNumericLiterals, |
1356 kAllowHarmonyArrowFunctions, | 1356 kAllowHarmonyArrowFunctions, |
1357 kAllowHarmonyClasses, | 1357 kAllowHarmonyClasses, |
1358 kAllowHarmonyObjectLiterals, | 1358 kAllowHarmonyObjectLiterals, |
1359 kAllowHarmonyTemplates, | 1359 kAllowHarmonyTemplates, |
1360 kAllowHarmonySloppy, | 1360 kAllowHarmonySloppy, |
1361 kAllowHarmonyUnicode | 1361 kAllowHarmonyUnicode, |
| 1362 kAllowHarmonyComputedPropertyNames |
1362 }; | 1363 }; |
1363 | 1364 |
1364 | 1365 |
1365 enum ParserSyncTestResult { | 1366 enum ParserSyncTestResult { |
1366 kSuccessOrError, | 1367 kSuccessOrError, |
1367 kSuccess, | 1368 kSuccess, |
1368 kError | 1369 kError |
1369 }; | 1370 }; |
1370 | 1371 |
1371 template <typename Traits> | 1372 template <typename Traits> |
1372 void SetParserFlags(i::ParserBase<Traits>* parser, | 1373 void SetParserFlags(i::ParserBase<Traits>* parser, |
1373 i::EnumSet<ParserFlag> flags) { | 1374 i::EnumSet<ParserFlag> flags) { |
1374 parser->set_allow_lazy(flags.Contains(kAllowLazy)); | 1375 parser->set_allow_lazy(flags.Contains(kAllowLazy)); |
1375 parser->set_allow_natives(flags.Contains(kAllowNatives)); | 1376 parser->set_allow_natives(flags.Contains(kAllowNatives)); |
1376 parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping)); | 1377 parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping)); |
1377 parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules)); | 1378 parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules)); |
1378 parser->set_allow_harmony_numeric_literals( | 1379 parser->set_allow_harmony_numeric_literals( |
1379 flags.Contains(kAllowHarmonyNumericLiterals)); | 1380 flags.Contains(kAllowHarmonyNumericLiterals)); |
1380 parser->set_allow_harmony_object_literals( | 1381 parser->set_allow_harmony_object_literals( |
1381 flags.Contains(kAllowHarmonyObjectLiterals)); | 1382 flags.Contains(kAllowHarmonyObjectLiterals)); |
1382 parser->set_allow_harmony_arrow_functions( | 1383 parser->set_allow_harmony_arrow_functions( |
1383 flags.Contains(kAllowHarmonyArrowFunctions)); | 1384 flags.Contains(kAllowHarmonyArrowFunctions)); |
1384 parser->set_allow_harmony_classes(flags.Contains(kAllowHarmonyClasses)); | 1385 parser->set_allow_harmony_classes(flags.Contains(kAllowHarmonyClasses)); |
1385 parser->set_allow_harmony_templates(flags.Contains(kAllowHarmonyTemplates)); | 1386 parser->set_allow_harmony_templates(flags.Contains(kAllowHarmonyTemplates)); |
1386 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); | 1387 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); |
1387 parser->set_allow_harmony_unicode(flags.Contains(kAllowHarmonyUnicode)); | 1388 parser->set_allow_harmony_unicode(flags.Contains(kAllowHarmonyUnicode)); |
| 1389 parser->set_allow_harmony_computed_property_names( |
| 1390 flags.Contains(kAllowHarmonyComputedPropertyNames)); |
1388 } | 1391 } |
1389 | 1392 |
1390 | 1393 |
1391 void TestParserSyncWithFlags(i::Handle<i::String> source, | 1394 void TestParserSyncWithFlags(i::Handle<i::String> source, |
1392 i::EnumSet<ParserFlag> flags, | 1395 i::EnumSet<ParserFlag> flags, |
1393 ParserSyncTestResult result) { | 1396 ParserSyncTestResult result) { |
1394 i::Isolate* isolate = CcTest::i_isolate(); | 1397 i::Isolate* isolate = CcTest::i_isolate(); |
1395 i::Factory* factory = isolate->factory(); | 1398 i::Factory* factory = isolate->factory(); |
1396 | 1399 |
1397 uintptr_t stack_limit = isolate->stack_guard()->real_climit(); | 1400 uintptr_t stack_limit = isolate->stack_guard()->real_climit(); |
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4531 always_false_flags, arraysize(always_false_flags)); | 4534 always_false_flags, arraysize(always_false_flags)); |
4532 | 4535 |
4533 const char* good_data[] = { | 4536 const char* good_data[] = { |
4534 "let = 1;", | 4537 "let = 1;", |
4535 "for(let = 1;;){}", | 4538 "for(let = 1;;){}", |
4536 NULL}; | 4539 NULL}; |
4537 RunParserSyncTest(context_data, good_data, kSuccess, NULL, 0, | 4540 RunParserSyncTest(context_data, good_data, kSuccess, NULL, 0, |
4538 always_true_flags, arraysize(always_true_flags), | 4541 always_true_flags, arraysize(always_true_flags), |
4539 always_false_flags, arraysize(always_false_flags)); | 4542 always_false_flags, arraysize(always_false_flags)); |
4540 } | 4543 } |
OLD | NEW |