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

Unified Diff: test/cctest/test-parsing.cc

Issue 641283003: Support lazy parsing of inner functions (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@bleeding_edge
Patch Set: Track variable declarations in the preparser Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« src/preparser.cc ('K') | « src/vector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 700d104a51a396bfb11ba922e777b373e573fedc..d5c879923b1b759d91d9d57e819a879d330e8f9a 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -157,7 +157,12 @@ TEST(ScanHTMLEndComments) {
i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream);
- i::PreParser preparser(&scanner, &log, stack_limit);
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(
+ &zone, CcTest::i_isolate()->heap()->HashSeed());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
+ stack_limit);
preparser.set_allow_lazy(true);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
@@ -171,7 +176,12 @@ TEST(ScanHTMLEndComments) {
i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream);
- i::PreParser preparser(&scanner, &log, stack_limit);
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(
+ &zone, CcTest::i_isolate()->heap()->HashSeed());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
+ stack_limit);
preparser.set_allow_lazy(true);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
// Even in the case of a syntax error, kPreParseSuccess is returned.
@@ -293,6 +303,7 @@ TEST(PreparseFunctionDataIsUsed) {
TEST(StandAlonePreParser) {
v8::V8::Initialize();
+ v8::HandleScope handles(CcTest::isolate());
CcTest::i_isolate()->stack_guard()->SetStackLimit(
i::GetCurrentStackPosition() - 128 * 1024);
@@ -317,7 +328,12 @@ TEST(StandAlonePreParser) {
i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream);
- i::PreParser preparser(&scanner, &log, stack_limit);
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(
+ &zone, CcTest::i_isolate()->heap()->HashSeed());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
+ stack_limit);
preparser.set_allow_lazy(true);
preparser.set_allow_natives_syntax(true);
preparser.set_allow_arrow_functions(true);
@@ -330,6 +346,7 @@ TEST(StandAlonePreParser) {
TEST(StandAlonePreParserNoNatives) {
v8::V8::Initialize();
+ v8::HandleScope handles(CcTest::isolate());
CcTest::i_isolate()->stack_guard()->SetStackLimit(
i::GetCurrentStackPosition() - 128 * 1024);
@@ -351,7 +368,12 @@ TEST(StandAlonePreParserNoNatives) {
scanner.Initialize(&stream);
// Preparser defaults to disallowing natives syntax.
- i::PreParser preparser(&scanner, &log, stack_limit);
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(
+ &zone, CcTest::i_isolate()->heap()->HashSeed());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
+ stack_limit);
preparser.set_allow_lazy(true);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
@@ -398,6 +420,7 @@ TEST(PreparsingObjectLiterals) {
TEST(RegressChromium62639) {
v8::V8::Initialize();
+ v8::HandleScope handles(CcTest::isolate());
i::Isolate* isolate = CcTest::i_isolate();
isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
@@ -416,7 +439,11 @@ TEST(RegressChromium62639) {
i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream);
- i::PreParser preparser(&scanner, &log,
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(&zone,
+ CcTest::i_isolate()->heap()->HashSeed());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
CcTest::i_isolate()->stack_guard()->real_climit());
preparser.set_allow_lazy(true);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
@@ -448,7 +475,11 @@ TEST(Regress928) {
i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream);
- i::PreParser preparser(&scanner, &log,
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(&zone,
+ CcTest::i_isolate()->heap()->HashSeed());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
CcTest::i_isolate()->stack_guard()->real_climit());
preparser.set_allow_lazy(true);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
@@ -478,6 +509,7 @@ TEST(Regress928) {
TEST(PreParseOverflow) {
v8::V8::Initialize();
+ v8::HandleScope handles(CcTest::isolate());
CcTest::i_isolate()->stack_guard()->SetStackLimit(
i::GetCurrentStackPosition() - 128 * 1024);
@@ -496,7 +528,12 @@ TEST(PreParseOverflow) {
i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream);
- i::PreParser preparser(&scanner, &log, stack_limit);
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(&zone,
+ CcTest::i_isolate()->heap()->HashSeed());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
+ stack_limit);
preparser.set_allow_lazy(true);
preparser.set_allow_arrow_functions(true);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
@@ -1373,7 +1410,13 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
{
i::Scanner scanner(isolate->unicode_cache());
i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
- i::PreParser preparser(&scanner, &log, stack_limit);
+ i::Zone zone(CcTest::i_isolate());
+ i::AstValueFactory ast_value_factory(
+ &zone, CcTest::i_isolate()->heap()->HashSeed());
+ v8::HandleScope handles(CcTest::isolate());
+ ast_value_factory.Internalize(CcTest::i_isolate());
+ i::PreParser preparser(&scanner, &log, &ast_value_factory, &zone,
+ stack_limit);
SetParserFlags(&preparser, flags);
scanner.Initialize(&stream);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
@@ -2389,6 +2432,9 @@ TEST(DontRegressPreParserDataSizes) {
// Functions insize lazy functions are not recorded.
{"function lazy() { function a() {} function b() {} function c() {} }", 1},
{"function lazy() { var x = {get foo(){} } }", 1},
+ // Functions inside eager functions are recorded.
+ {"(function() { function lazy() {} })()", 1},
+ {"(function() { var lazy = function() {} })()", 1},
{NULL, 0}
};
« src/preparser.cc ('K') | « src/vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698