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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 658423002: Unship ES6 iteration and unscopables on 3.28 (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.28
Patch Set: Created 6 years, 2 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/unscopables.js ('k') | test/cctest/test-unscopables-hidden-prototype.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 return i::Handle<i::String>::cast(result); 1201 return i::Handle<i::String>::cast(result);
1202 } 1202 }
1203 1203
1204 1204
1205 enum ParserFlag { 1205 enum ParserFlag {
1206 kAllowLazy, 1206 kAllowLazy,
1207 kAllowNativesSyntax, 1207 kAllowNativesSyntax,
1208 kAllowHarmonyScoping, 1208 kAllowHarmonyScoping,
1209 kAllowModules, 1209 kAllowModules,
1210 kAllowGenerators, 1210 kAllowGenerators,
1211 kAllowForOf,
1211 kAllowHarmonyNumericLiterals, 1212 kAllowHarmonyNumericLiterals,
1212 kAllowArrowFunctions 1213 kAllowArrowFunctions
1213 }; 1214 };
1214 1215
1215 1216
1216 enum ParserSyncTestResult { 1217 enum ParserSyncTestResult {
1217 kSuccessOrError, 1218 kSuccessOrError,
1218 kSuccess, 1219 kSuccess,
1219 kError 1220 kError
1220 }; 1221 };
1221 1222
1222 template <typename Traits> 1223 template <typename Traits>
1223 void SetParserFlags(i::ParserBase<Traits>* parser, 1224 void SetParserFlags(i::ParserBase<Traits>* parser,
1224 i::EnumSet<ParserFlag> flags) { 1225 i::EnumSet<ParserFlag> flags) {
1225 parser->set_allow_lazy(flags.Contains(kAllowLazy)); 1226 parser->set_allow_lazy(flags.Contains(kAllowLazy));
1226 parser->set_allow_natives_syntax(flags.Contains(kAllowNativesSyntax)); 1227 parser->set_allow_natives_syntax(flags.Contains(kAllowNativesSyntax));
1227 parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping)); 1228 parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping));
1228 parser->set_allow_modules(flags.Contains(kAllowModules)); 1229 parser->set_allow_modules(flags.Contains(kAllowModules));
1229 parser->set_allow_generators(flags.Contains(kAllowGenerators)); 1230 parser->set_allow_generators(flags.Contains(kAllowGenerators));
1231 parser->set_allow_for_of(flags.Contains(kAllowForOf));
1230 parser->set_allow_harmony_numeric_literals( 1232 parser->set_allow_harmony_numeric_literals(
1231 flags.Contains(kAllowHarmonyNumericLiterals)); 1233 flags.Contains(kAllowHarmonyNumericLiterals));
1232 parser->set_allow_arrow_functions(flags.Contains(kAllowArrowFunctions)); 1234 parser->set_allow_arrow_functions(flags.Contains(kAllowArrowFunctions));
1233 } 1235 }
1234 1236
1235 1237
1236 void TestParserSyncWithFlags(i::Handle<i::String> source, 1238 void TestParserSyncWithFlags(i::Handle<i::String> source,
1237 i::EnumSet<ParserFlag> flags, 1239 i::EnumSet<ParserFlag> flags,
1238 ParserSyncTestResult result) { 1240 ParserSyncTestResult result) {
1239 i::Isolate* isolate = CcTest::i_isolate(); 1241 i::Isolate* isolate = CcTest::i_isolate();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 NULL 1429 NULL
1428 }; 1430 };
1429 1431
1430 v8::HandleScope handles(CcTest::isolate()); 1432 v8::HandleScope handles(CcTest::isolate());
1431 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate()); 1433 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
1432 v8::Context::Scope context_scope(context); 1434 v8::Context::Scope context_scope(context);
1433 1435
1434 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 1436 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
1435 128 * 1024); 1437 128 * 1024);
1436 1438
1437 static const ParserFlag flags1[] = {kAllowLazy, kAllowHarmonyScoping, 1439 static const ParserFlag flags1[] = {
1438 kAllowModules, kAllowGenerators, 1440 kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators,
1439 kAllowArrowFunctions}; 1441 kAllowForOf, kAllowArrowFunctions
1442 };
1440 for (int i = 0; context_data[i][0] != NULL; ++i) { 1443 for (int i = 0; context_data[i][0] != NULL; ++i) {
1441 for (int j = 0; statement_data[j] != NULL; ++j) { 1444 for (int j = 0; statement_data[j] != NULL; ++j) {
1442 for (int k = 0; termination_data[k] != NULL; ++k) { 1445 for (int k = 0; termination_data[k] != NULL; ++k) {
1443 int kPrefixLen = i::StrLength(context_data[i][0]); 1446 int kPrefixLen = i::StrLength(context_data[i][0]);
1444 int kStatementLen = i::StrLength(statement_data[j]); 1447 int kStatementLen = i::StrLength(statement_data[j]);
1445 int kTerminationLen = i::StrLength(termination_data[k]); 1448 int kTerminationLen = i::StrLength(termination_data[k]);
1446 int kSuffixLen = i::StrLength(context_data[i][1]); 1449 int kSuffixLen = i::StrLength(context_data[i][1]);
1447 int kProgramSize = kPrefixLen + kStatementLen + kTerminationLen 1450 int kProgramSize = kPrefixLen + kStatementLen + kTerminationLen
1448 + kSuffixLen + i::StrLength("label: for (;;) { }"); 1451 + kSuffixLen + i::StrLength("label: for (;;) { }");
1449 1452
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 const ParserFlag* always_true_flags = NULL, 1507 const ParserFlag* always_true_flags = NULL,
1505 int always_true_flags_len = 0) { 1508 int always_true_flags_len = 0) {
1506 v8::HandleScope handles(CcTest::isolate()); 1509 v8::HandleScope handles(CcTest::isolate());
1507 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate()); 1510 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
1508 v8::Context::Scope context_scope(context); 1511 v8::Context::Scope context_scope(context);
1509 1512
1510 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 1513 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
1511 128 * 1024); 1514 128 * 1024);
1512 1515
1513 static const ParserFlag default_flags[] = { 1516 static const ParserFlag default_flags[] = {
1514 kAllowLazy, kAllowHarmonyScoping, kAllowModules, 1517 kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators,
1515 kAllowGenerators, kAllowNativesSyntax, kAllowArrowFunctions}; 1518 kAllowForOf, kAllowNativesSyntax, kAllowArrowFunctions
1519 };
1516 ParserFlag* generated_flags = NULL; 1520 ParserFlag* generated_flags = NULL;
1517 if (flags == NULL) { 1521 if (flags == NULL) {
1518 flags = default_flags; 1522 flags = default_flags;
1519 flags_len = ARRAY_SIZE(default_flags); 1523 flags_len = ARRAY_SIZE(default_flags);
1520 if (always_true_flags != NULL) { 1524 if (always_true_flags != NULL) {
1521 // Remove always_true_flags from default_flags. 1525 // Remove always_true_flags from default_flags.
1522 CHECK(always_true_flags_len < flags_len); 1526 CHECK(always_true_flags_len < flags_len);
1523 generated_flags = new ParserFlag[flags_len - always_true_flags_len]; 1527 generated_flags = new ParserFlag[flags_len - always_true_flags_len];
1524 int flag_index = 0; 1528 int flag_index = 0;
1525 for (int i = 0; i < flags_len; ++i) { 1529 for (int i = 0; i < flags_len; ++i) {
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 3340
3337 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {}) 3341 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {})
3338 "foo ? bar : baz => {}", 3342 "foo ? bar : baz => {}",
3339 NULL 3343 NULL
3340 }; 3344 };
3341 3345
3342 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 3346 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
3343 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 3347 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
3344 always_flags, ARRAY_SIZE(always_flags)); 3348 always_flags, ARRAY_SIZE(always_flags));
3345 } 3349 }
OLDNEW
« no previous file with comments | « src/unscopables.js ('k') | test/cctest/test-unscopables-hidden-prototype.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698