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

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

Issue 544043002: Next base/macros.h cleanup step. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/utils.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 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 "x --> is eol-comment\nvar y = 37;\n", 138 "x --> is eol-comment\nvar y = 37;\n",
139 "\"\\n\" --> is eol-comment\nvar y = 37;\n", 139 "\"\\n\" --> is eol-comment\nvar y = 37;\n",
140 "x/* precomment */ --> is eol-comment\nvar y = 37;\n", 140 "x/* precomment */ --> is eol-comment\nvar y = 37;\n",
141 "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n", 141 "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n",
142 "var x = 42; --> is eol-comment\nvar y = 37;\n", 142 "var x = 42; --> is eol-comment\nvar y = 37;\n",
143 "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n", 143 "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n",
144 NULL 144 NULL
145 }; 145 };
146 146
147 // Parser/Scanner needs a stack limit. 147 // Parser/Scanner needs a stack limit.
148 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 148 CcTest::i_isolate()->stack_guard()->SetStackLimit(
149 128 * 1024); 149 i::GetCurrentStackPosition() - 128 * 1024);
150 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); 150 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit();
151 for (int i = 0; tests[i]; i++) { 151 for (int i = 0; tests[i]; i++) {
152 const i::byte* source = 152 const i::byte* source =
153 reinterpret_cast<const i::byte*>(tests[i]); 153 reinterpret_cast<const i::byte*>(tests[i]);
154 i::Utf8ToUtf16CharacterStream stream(source, i::StrLength(tests[i])); 154 i::Utf8ToUtf16CharacterStream stream(source, i::StrLength(tests[i]));
155 i::CompleteParserRecorder log; 155 i::CompleteParserRecorder log;
156 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); 156 i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
157 scanner.Initialize(&stream); 157 scanner.Initialize(&stream);
158 i::PreParser preparser(&scanner, &log, stack_limit); 158 i::PreParser preparser(&scanner, &log, stack_limit);
159 preparser.set_allow_lazy(true); 159 preparser.set_allow_lazy(true);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 const char* data_; 191 const char* data_;
192 size_t length_; 192 size_t length_;
193 }; 193 };
194 194
195 195
196 TEST(UsingCachedData) { 196 TEST(UsingCachedData) {
197 v8::Isolate* isolate = CcTest::isolate(); 197 v8::Isolate* isolate = CcTest::isolate();
198 v8::HandleScope handles(isolate); 198 v8::HandleScope handles(isolate);
199 v8::Local<v8::Context> context = v8::Context::New(isolate); 199 v8::Local<v8::Context> context = v8::Context::New(isolate);
200 v8::Context::Scope context_scope(context); 200 v8::Context::Scope context_scope(context);
201 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 201 CcTest::i_isolate()->stack_guard()->SetStackLimit(
202 128 * 1024); 202 i::GetCurrentStackPosition() - 128 * 1024);
203 203
204 // Source containing functions that might be lazily compiled and all types 204 // Source containing functions that might be lazily compiled and all types
205 // of symbols (string, propertyName, regexp). 205 // of symbols (string, propertyName, regexp).
206 const char* source = 206 const char* source =
207 "var x = 42;" 207 "var x = 42;"
208 "function foo(a) { return function nolazy(b) { return a + b; } }" 208 "function foo(a) { return function nolazy(b) { return a + b; } }"
209 "function bar(a) { if (a) return function lazy(b) { return b; } }" 209 "function bar(a) { if (a) return function lazy(b) { return b; } }"
210 "var z = {'string': 'string literal', bareword: 'propertyName', " 210 "var z = {'string': 'string literal', bareword: 'propertyName', "
211 " 42: 'number literal', for: 'keyword as propertyName', " 211 " 42: 'number literal', for: 'keyword as propertyName', "
212 " f\\u006fr: 'keyword propertyname with escape'};" 212 " f\\u006fr: 'keyword propertyname with escape'};"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // preparser. 244 // preparser.
245 245
246 // Make preparsing work for short scripts. 246 // Make preparsing work for short scripts.
247 i::FLAG_min_preparse_length = 0; 247 i::FLAG_min_preparse_length = 0;
248 i::FLAG_harmony_arrow_functions = true; 248 i::FLAG_harmony_arrow_functions = true;
249 249
250 v8::Isolate* isolate = CcTest::isolate(); 250 v8::Isolate* isolate = CcTest::isolate();
251 v8::HandleScope handles(isolate); 251 v8::HandleScope handles(isolate);
252 v8::Local<v8::Context> context = v8::Context::New(isolate); 252 v8::Local<v8::Context> context = v8::Context::New(isolate);
253 v8::Context::Scope context_scope(context); 253 v8::Context::Scope context_scope(context);
254 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 254 CcTest::i_isolate()->stack_guard()->SetStackLimit(
255 128 * 1024); 255 i::GetCurrentStackPosition() - 128 * 1024);
256 256
257 const char* good_code[] = { 257 const char* good_code[] = {
258 "function this_is_lazy() { var a; } function foo() { return 25; } foo();", 258 "function this_is_lazy() { var a; } function foo() { return 25; } foo();",
259 "var this_is_lazy = () => { var a; }; var foo = () => 25; foo();", 259 "var this_is_lazy = () => { var a; }; var foo = () => 25; foo();",
260 }; 260 };
261 261
262 // Insert a syntax error inside the lazy function. 262 // Insert a syntax error inside the lazy function.
263 const char* bad_code[] = { 263 const char* bad_code[] = {
264 "function this_is_lazy() { if ( } function foo() { return 25; } foo();", 264 "function this_is_lazy() { if ( } function foo() { return 25; } foo();",
265 "var this_is_lazy = () => { if ( }; var foo = () => 25; foo();", 265 "var this_is_lazy = () => { if ( }; var foo = () => 25; foo();",
(...skipping 19 matching lines...) Expand all
285 v8::ScriptCompiler::Compile(isolate, &bad_source)->Run(); 285 v8::ScriptCompiler::Compile(isolate, &bad_source)->Run();
286 CHECK(result->IsInt32()); 286 CHECK(result->IsInt32());
287 CHECK_EQ(25, result->Int32Value()); 287 CHECK_EQ(25, result->Int32Value());
288 } 288 }
289 } 289 }
290 290
291 291
292 TEST(StandAlonePreParser) { 292 TEST(StandAlonePreParser) {
293 v8::V8::Initialize(); 293 v8::V8::Initialize();
294 294
295 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 295 CcTest::i_isolate()->stack_guard()->SetStackLimit(
296 128 * 1024); 296 i::GetCurrentStackPosition() - 128 * 1024);
297 297
298 const char* programs[] = { 298 const char* programs[] = {
299 "{label: 42}", 299 "{label: 42}",
300 "var x = 42;", 300 "var x = 42;",
301 "function foo(x, y) { return x + y; }", 301 "function foo(x, y) { return x + y; }",
302 "%ArgleBargle(glop);", 302 "%ArgleBargle(glop);",
303 "var x = new new Function('this.x = 42');", 303 "var x = new new Function('this.x = 42');",
304 "var f = (x, y) => x + y;", 304 "var f = (x, y) => x + y;",
305 NULL 305 NULL
306 }; 306 };
(...skipping 15 matching lines...) Expand all
322 i::PreParser::PreParseResult result = preparser.PreParseProgram(); 322 i::PreParser::PreParseResult result = preparser.PreParseProgram();
323 CHECK_EQ(i::PreParser::kPreParseSuccess, result); 323 CHECK_EQ(i::PreParser::kPreParseSuccess, result);
324 CHECK(!log.HasError()); 324 CHECK(!log.HasError());
325 } 325 }
326 } 326 }
327 327
328 328
329 TEST(StandAlonePreParserNoNatives) { 329 TEST(StandAlonePreParserNoNatives) {
330 v8::V8::Initialize(); 330 v8::V8::Initialize();
331 331
332 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 332 CcTest::i_isolate()->stack_guard()->SetStackLimit(
333 128 * 1024); 333 i::GetCurrentStackPosition() - 128 * 1024);
334 334
335 const char* programs[] = { 335 const char* programs[] = {
336 "%ArgleBargle(glop);", 336 "%ArgleBargle(glop);",
337 "var x = %_IsSmi(42);", 337 "var x = %_IsSmi(42);",
338 NULL 338 NULL
339 }; 339 };
340 340
341 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); 341 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit();
342 for (int i = 0; programs[i]; i++) { 342 for (int i = 0; programs[i]; i++) {
343 const char* program = programs[i]; 343 const char* program = programs[i];
(...skipping 14 matching lines...) Expand all
358 } 358 }
359 359
360 360
361 TEST(PreparsingObjectLiterals) { 361 TEST(PreparsingObjectLiterals) {
362 // Regression test for a bug where the symbol stream produced by PreParser 362 // Regression test for a bug where the symbol stream produced by PreParser
363 // didn't match what Parser wanted to consume. 363 // didn't match what Parser wanted to consume.
364 v8::Isolate* isolate = CcTest::isolate(); 364 v8::Isolate* isolate = CcTest::isolate();
365 v8::HandleScope handles(isolate); 365 v8::HandleScope handles(isolate);
366 v8::Local<v8::Context> context = v8::Context::New(isolate); 366 v8::Local<v8::Context> context = v8::Context::New(isolate);
367 v8::Context::Scope context_scope(context); 367 v8::Context::Scope context_scope(context);
368 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 368 CcTest::i_isolate()->stack_guard()->SetStackLimit(
369 128 * 1024); 369 i::GetCurrentStackPosition() - 128 * 1024);
370 370
371 { 371 {
372 const char* source = "var myo = {if: \"foo\"}; myo.if;"; 372 const char* source = "var myo = {if: \"foo\"}; myo.if;";
373 v8::Local<v8::Value> result = ParserCacheCompileRun(source); 373 v8::Local<v8::Value> result = ParserCacheCompileRun(source);
374 CHECK(result->IsString()); 374 CHECK(result->IsString());
375 v8::String::Utf8Value utf8(result); 375 v8::String::Utf8Value utf8(result);
376 CHECK_EQ("foo", *utf8); 376 CHECK_EQ("foo", *utf8);
377 } 377 }
378 378
379 { 379 {
(...skipping 11 matching lines...) Expand all
391 v8::String::Utf8Value utf8(result); 391 v8::String::Utf8Value utf8(result);
392 CHECK_EQ("foo", *utf8); 392 CHECK_EQ("foo", *utf8);
393 } 393 }
394 } 394 }
395 395
396 396
397 TEST(RegressChromium62639) { 397 TEST(RegressChromium62639) {
398 v8::V8::Initialize(); 398 v8::V8::Initialize();
399 i::Isolate* isolate = CcTest::i_isolate(); 399 i::Isolate* isolate = CcTest::i_isolate();
400 400
401 isolate->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 128 * 1024); 401 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
402 128 * 1024);
402 403
403 const char* program = "var x = 'something';\n" 404 const char* program = "var x = 'something';\n"
404 "escape: function() {}"; 405 "escape: function() {}";
405 // Fails parsing expecting an identifier after "function". 406 // Fails parsing expecting an identifier after "function".
406 // Before fix, didn't check *ok after Expect(Token::Identifier, ok), 407 // Before fix, didn't check *ok after Expect(Token::Identifier, ok),
407 // and then used the invalid currently scanned literal. This always 408 // and then used the invalid currently scanned literal. This always
408 // failed in debug mode, and sometimes crashed in release mode. 409 // failed in debug mode, and sometimes crashed in release mode.
409 410
410 i::Utf8ToUtf16CharacterStream stream( 411 i::Utf8ToUtf16CharacterStream stream(
411 reinterpret_cast<const i::byte*>(program), 412 reinterpret_cast<const i::byte*>(program),
(...skipping 13 matching lines...) Expand all
425 426
426 TEST(Regress928) { 427 TEST(Regress928) {
427 v8::V8::Initialize(); 428 v8::V8::Initialize();
428 i::Isolate* isolate = CcTest::i_isolate(); 429 i::Isolate* isolate = CcTest::i_isolate();
429 i::Factory* factory = isolate->factory(); 430 i::Factory* factory = isolate->factory();
430 431
431 // Preparsing didn't consider the catch clause of a try statement 432 // Preparsing didn't consider the catch clause of a try statement
432 // as with-content, which made it assume that a function inside 433 // as with-content, which made it assume that a function inside
433 // the block could be lazily compiled, and an extra, unexpected, 434 // the block could be lazily compiled, and an extra, unexpected,
434 // entry was added to the data. 435 // entry was added to the data.
435 isolate->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 128 * 1024); 436 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
437 128 * 1024);
436 438
437 const char* program = 439 const char* program =
438 "try { } catch (e) { var foo = function () { /* first */ } }" 440 "try { } catch (e) { var foo = function () { /* first */ } }"
439 "var bar = function () { /* second */ }"; 441 "var bar = function () { /* second */ }";
440 442
441 v8::HandleScope handles(CcTest::isolate()); 443 v8::HandleScope handles(CcTest::isolate());
442 i::Handle<i::String> source = factory->NewStringFromAsciiChecked(program); 444 i::Handle<i::String> source = factory->NewStringFromAsciiChecked(program);
443 i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); 445 i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
444 i::CompleteParserRecorder log; 446 i::CompleteParserRecorder log;
445 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); 447 i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
(...skipping 22 matching lines...) Expand all
468 i::FunctionEntry entry2 = pd.GetFunctionEntry(second_lbrace); 470 i::FunctionEntry entry2 = pd.GetFunctionEntry(second_lbrace);
469 CHECK(entry2.is_valid()); 471 CHECK(entry2.is_valid());
470 CHECK_EQ('}', program[entry2.end_pos() - 1]); 472 CHECK_EQ('}', program[entry2.end_pos() - 1]);
471 delete sd; 473 delete sd;
472 } 474 }
473 475
474 476
475 TEST(PreParseOverflow) { 477 TEST(PreParseOverflow) {
476 v8::V8::Initialize(); 478 v8::V8::Initialize();
477 479
478 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 480 CcTest::i_isolate()->stack_guard()->SetStackLimit(
479 128 * 1024); 481 i::GetCurrentStackPosition() - 128 * 1024);
480 482
481 size_t kProgramSize = 1024 * 1024; 483 size_t kProgramSize = 1024 * 1024;
482 i::SmartArrayPointer<char> program(i::NewArray<char>(kProgramSize + 1)); 484 i::SmartArrayPointer<char> program(i::NewArray<char>(kProgramSize + 1));
483 memset(program.get(), '(', kProgramSize); 485 memset(program.get(), '(', kProgramSize);
484 program[kProgramSize] = '\0'; 486 program[kProgramSize] = '\0';
485 487
486 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); 488 uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit();
487 489
488 i::Utf8ToUtf16CharacterStream stream( 490 i::Utf8ToUtf16CharacterStream stream(
489 reinterpret_cast<const i::byte*>(program.get()), 491 reinterpret_cast<const i::byte*>(program.get()),
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 { NULL, NULL, NULL, i::EVAL_SCOPE, i::SLOPPY } 1100 { NULL, NULL, NULL, i::EVAL_SCOPE, i::SLOPPY }
1099 }; 1101 };
1100 1102
1101 i::Isolate* isolate = CcTest::i_isolate(); 1103 i::Isolate* isolate = CcTest::i_isolate();
1102 i::Factory* factory = isolate->factory(); 1104 i::Factory* factory = isolate->factory();
1103 1105
1104 v8::HandleScope handles(CcTest::isolate()); 1106 v8::HandleScope handles(CcTest::isolate());
1105 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate()); 1107 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
1106 v8::Context::Scope context_scope(context); 1108 v8::Context::Scope context_scope(context);
1107 1109
1108 isolate->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 128 * 1024); 1110 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
1111 128 * 1024);
1109 1112
1110 for (int i = 0; source_data[i].outer_prefix; i++) { 1113 for (int i = 0; source_data[i].outer_prefix; i++) {
1111 int kPrefixLen = Utf8LengthHelper(source_data[i].outer_prefix); 1114 int kPrefixLen = Utf8LengthHelper(source_data[i].outer_prefix);
1112 int kInnerLen = Utf8LengthHelper(source_data[i].inner_source); 1115 int kInnerLen = Utf8LengthHelper(source_data[i].inner_source);
1113 int kSuffixLen = Utf8LengthHelper(source_data[i].outer_suffix); 1116 int kSuffixLen = Utf8LengthHelper(source_data[i].outer_suffix);
1114 int kPrefixByteLen = i::StrLength(source_data[i].outer_prefix); 1117 int kPrefixByteLen = i::StrLength(source_data[i].outer_prefix);
1115 int kInnerByteLen = i::StrLength(source_data[i].inner_source); 1118 int kInnerByteLen = i::StrLength(source_data[i].inner_source);
1116 int kSuffixByteLen = i::StrLength(source_data[i].outer_suffix); 1119 int kSuffixByteLen = i::StrLength(source_data[i].outer_suffix);
1117 int kProgramSize = kPrefixLen + kInnerLen + kSuffixLen; 1120 int kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
1118 int kProgramByteSize = kPrefixByteLen + kInnerByteLen + kSuffixByteLen; 1121 int kProgramByteSize = kPrefixByteLen + kInnerByteLen + kSuffixByteLen;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 "\n", 1436 "\n",
1434 ";\n", 1437 ";\n",
1435 "\n;", 1438 "\n;",
1436 NULL 1439 NULL
1437 }; 1440 };
1438 1441
1439 v8::HandleScope handles(CcTest::isolate()); 1442 v8::HandleScope handles(CcTest::isolate());
1440 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate()); 1443 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
1441 v8::Context::Scope context_scope(context); 1444 v8::Context::Scope context_scope(context);
1442 1445
1443 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 1446 CcTest::i_isolate()->stack_guard()->SetStackLimit(
1444 128 * 1024); 1447 i::GetCurrentStackPosition() - 128 * 1024);
1445 1448
1446 static const ParserFlag flags1[] = {kAllowLazy, kAllowHarmonyScoping, 1449 static const ParserFlag flags1[] = {kAllowLazy, kAllowHarmonyScoping,
1447 kAllowModules, kAllowGenerators, 1450 kAllowModules, kAllowGenerators,
1448 kAllowArrowFunctions}; 1451 kAllowArrowFunctions};
1449 for (int i = 0; context_data[i][0] != NULL; ++i) { 1452 for (int i = 0; context_data[i][0] != NULL; ++i) {
1450 for (int j = 0; statement_data[j] != NULL; ++j) { 1453 for (int j = 0; statement_data[j] != NULL; ++j) {
1451 for (int k = 0; termination_data[k] != NULL; ++k) { 1454 for (int k = 0; termination_data[k] != NULL; ++k) {
1452 int kPrefixLen = i::StrLength(context_data[i][0]); 1455 int kPrefixLen = i::StrLength(context_data[i][0]);
1453 int kStatementLen = i::StrLength(statement_data[j]); 1456 int kStatementLen = i::StrLength(statement_data[j]);
1454 int kTerminationLen = i::StrLength(termination_data[k]); 1457 int kTerminationLen = i::StrLength(termination_data[k]);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 const char* statement_data[], 1512 const char* statement_data[],
1510 ParserSyncTestResult result, 1513 ParserSyncTestResult result,
1511 const ParserFlag* flags = NULL, 1514 const ParserFlag* flags = NULL,
1512 int flags_len = 0, 1515 int flags_len = 0,
1513 const ParserFlag* always_true_flags = NULL, 1516 const ParserFlag* always_true_flags = NULL,
1514 int always_true_flags_len = 0) { 1517 int always_true_flags_len = 0) {
1515 v8::HandleScope handles(CcTest::isolate()); 1518 v8::HandleScope handles(CcTest::isolate());
1516 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate()); 1519 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
1517 v8::Context::Scope context_scope(context); 1520 v8::Context::Scope context_scope(context);
1518 1521
1519 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 1522 CcTest::i_isolate()->stack_guard()->SetStackLimit(
1520 128 * 1024); 1523 i::GetCurrentStackPosition() - 128 * 1024);
1521 1524
1522 static const ParserFlag default_flags[] = { 1525 static const ParserFlag default_flags[] = {
1523 kAllowLazy, kAllowHarmonyScoping, kAllowModules, 1526 kAllowLazy, kAllowHarmonyScoping, kAllowModules,
1524 kAllowGenerators, kAllowNativesSyntax, kAllowArrowFunctions, 1527 kAllowGenerators, kAllowNativesSyntax, kAllowArrowFunctions,
1525 kAllowClasses}; 1528 kAllowClasses};
1526 ParserFlag* generated_flags = NULL; 1529 ParserFlag* generated_flags = NULL;
1527 if (flags == NULL) { 1530 if (flags == NULL) {
1528 flags = default_flags; 1531 flags = default_flags;
1529 flags_len = arraysize(default_flags); 1532 flags_len = arraysize(default_flags);
1530 if (always_true_flags != NULL) { 1533 if (always_true_flags != NULL) {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 } 2247 }
2245 2248
2246 2249
2247 TEST(DontRegressPreParserDataSizes) { 2250 TEST(DontRegressPreParserDataSizes) {
2248 // These tests make sure that Parser doesn't start producing less "preparse 2251 // These tests make sure that Parser doesn't start producing less "preparse
2249 // data" (data which the embedder can cache). 2252 // data" (data which the embedder can cache).
2250 v8::V8::Initialize(); 2253 v8::V8::Initialize();
2251 v8::Isolate* isolate = CcTest::isolate(); 2254 v8::Isolate* isolate = CcTest::isolate();
2252 v8::HandleScope handles(isolate); 2255 v8::HandleScope handles(isolate);
2253 2256
2254 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 2257 CcTest::i_isolate()->stack_guard()->SetStackLimit(
2255 128 * 1024); 2258 i::GetCurrentStackPosition() - 128 * 1024);
2256 2259
2257 struct TestCase { 2260 struct TestCase {
2258 const char* program; 2261 const char* program;
2259 int functions; 2262 int functions;
2260 } test_cases[] = { 2263 } test_cases[] = {
2261 // No functions. 2264 // No functions.
2262 {"var x = 42;", 0}, 2265 {"var x = 42;", 0},
2263 // Functions. 2266 // Functions.
2264 {"function foo() {}", 1}, {"function foo() {} function bar() {}", 2}, 2267 {"function foo() {}", 1}, {"function foo() {} function bar() {}", 2},
2265 // Getter / setter functions are recorded as functions if they're on the top 2268 // Getter / setter functions are recorded as functions if they're on the top
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3382 const char* statement_data[] = { 3385 const char* statement_data[] = {
3383 "super = x", 3386 "super = x",
3384 "y = super", 3387 "y = super",
3385 "f(super)", 3388 "f(super)",
3386 NULL}; 3389 NULL};
3387 3390
3388 static const ParserFlag always_flags[] = {kAllowClasses}; 3391 static const ParserFlag always_flags[] = {kAllowClasses};
3389 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, 3392 RunParserSyncTest(context_data, statement_data, kError, NULL, 0,
3390 always_flags, arraysize(always_flags)); 3393 always_flags, arraysize(always_flags));
3391 } 3394 }
OLDNEW
« no previous file with comments | « src/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698