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

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

Issue 2679303003: Reland of land: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/parsing/test-preparser.cc ('k') | test/fuzzer/parser.cc » ('j') | 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 00b07328e588e2e19847022cb92cf4e9c6015c87..290b3e39b3c6c88ba475d2dc9f29f7de8a0e1079 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -804,8 +804,7 @@
factory->NewStringFromUtf8(i::CStrVector(program.start()))
.ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
// The information we're checking is only produced when eager parsing.
info.set_allow_lazy_parsing(false);
CHECK(i::parsing::ParseProgram(&info));
@@ -861,7 +860,7 @@
i::Handle<i::Script> script = factory->NewScript(source_code);
- i::ParseInfo info(handles.main_zone(), script);
+ i::ParseInfo info(script);
i::Parser parser(&info);
info.set_allow_lazy_parsing(false);
info.set_toplevel(true);
@@ -1159,8 +1158,7 @@
i::CStrVector(program.start())).ToHandleChecked();
CHECK_EQ(source->length(), kProgramSize);
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
info.set_language_mode(source_data[i].language_mode);
i::parsing::ParseProgram(&info);
CHECK_NOT_NULL(info.literal());
@@ -1206,8 +1204,7 @@
i::Handle<i::String> source_code =
factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source_code);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
i::parsing::ParseProgram(&info);
function = info.literal();
CHECK_NOT_NULL(function);
@@ -1337,8 +1334,7 @@
i::FunctionLiteral* function;
{
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
info.set_allow_lazy_parsing(flags.Contains(kAllowLazy));
SetGlobalFlags(flags);
if (is_module) info.set_module();
@@ -2465,8 +2461,7 @@
i::Handle<i::String> source =
factory->NewStringFromUtf8(i::CStrVector(program)).ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
i::ScriptData* sd = NULL;
info.set_cached_data(&sd);
info.set_compile_options(v8::ScriptCompiler::kProduceParserCache);
@@ -3353,7 +3348,6 @@
i::SNPrintF(program, "%s%s%s%s%s", prefix, outer, midfix, inner,
suffix);
- i::Zone zone(isolate->allocator(), ZONE_NAME);
std::unique_ptr<i::ParseInfo> info;
if (lazy) {
printf("%s\n", program.start());
@@ -3361,7 +3355,7 @@
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, shared));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared));
CHECK(i::parsing::ParseFunction(info.get()));
} else {
i::Handle<i::String> source =
@@ -3369,7 +3363,7 @@
source->PrintOn(stdout);
printf("\n");
i::Handle<i::Script> script = factory->NewScript(source);
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
info->set_allow_lazy_parsing(false);
CHECK(i::parsing::ParseProgram(info.get()));
}
@@ -3468,14 +3462,13 @@
i::ScopedVector<char> program(Utf8LengthHelper(source) +
Utf8LengthHelper(suffix) + 1);
i::SNPrintF(program, "%s%s", source, suffix);
- i::Zone zone(isolate->allocator(), ZONE_NAME);
std::unique_ptr<i::ParseInfo> info;
printf("%s\n", program.start());
v8::Local<v8::Value> v = CompileRun(program.start());
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, shared));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared));
info->set_allow_lazy_parsing(allow_lazy);
CHECK(i::parsing::ParseFunction(info.get()));
CHECK(i::Compiler::Analyze(info.get()));
@@ -3501,8 +3494,8 @@
std::vector<unsigned> location; // "Directions" to the relevant scope.
};
-static void TestMaybeAssigned(i::Zone* zone, Input input, const char* variable,
- bool module, bool allow_lazy_parsing) {
+static void TestMaybeAssigned(Input input, const char* variable, bool module,
+ bool allow_lazy_parsing) {
i::Factory* factory = CcTest::i_isolate()->factory();
i::Handle<i::String> string =
factory->InternalizeUtf8String(input.source.c_str());
@@ -3511,7 +3504,7 @@
i::Handle<i::Script> script = factory->NewScript(string);
std::unique_ptr<i::ParseInfo> info;
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(zone, script));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
info->set_module(module);
info->set_allow_lazy_parsing(allow_lazy_parsing);
@@ -3560,7 +3553,6 @@
i::Isolate* isolate = CcTest::i_isolate();
i::HandleScope scope(isolate);
LocalContext env;
- i::Zone zone(isolate->allocator(), ZONE_NAME);
std::vector<unsigned> top; // Can't use {} in initializers below.
@@ -3838,9 +3830,9 @@
for (unsigned module = 0; module <= 1; ++module) {
for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1;
++allow_lazy_parsing) {
- TestMaybeAssigned(&zone, input, "foo", module, allow_lazy_parsing);
+ TestMaybeAssigned(input, "foo", module, allow_lazy_parsing);
}
- TestMaybeAssigned(&zone, wrap(input), "foo", module, false);
+ TestMaybeAssigned(wrap(input), "foo", module, false);
}
}
@@ -3848,9 +3840,9 @@
Input input = script_only_tests[i];
for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1;
++allow_lazy_parsing) {
- TestMaybeAssigned(&zone, input, "foo", false, allow_lazy_parsing);
+ TestMaybeAssigned(input, "foo", false, allow_lazy_parsing);
}
- TestMaybeAssigned(&zone, wrap(input), "foo", false, false);
+ TestMaybeAssigned(wrap(input), "foo", false, false);
}
}
@@ -3882,7 +3874,6 @@
i::ScopedVector<char> program(Utf8LengthHelper(prefix) +
Utf8LengthHelper(source) + 1);
i::SNPrintF(program, "%s%s", prefix, source);
- i::Zone zone(isolate->allocator(), ZONE_NAME);
i::Handle<i::String> string =
factory->InternalizeUtf8String(program.start());
@@ -3893,7 +3884,7 @@
for (unsigned allow_lazy = 0; allow_lazy < 2; ++allow_lazy) {
for (unsigned module = 0; module < 2; ++module) {
std::unique_ptr<i::ParseInfo> info;
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
info->set_module(module);
info->set_allow_lazy_parsing(allow_lazy);
@@ -6346,8 +6337,7 @@
// Show that parsing as a module works
{
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
info.set_module();
if (!i::parsing::ParseProgram(&info)) {
i::Handle<i::JSObject> exception_handle(
@@ -6371,8 +6361,7 @@
// And that parsing a script does not.
{
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
CHECK(!i::parsing::ParseProgram(&info));
isolate->clear_pending_exception();
}
@@ -6462,8 +6451,7 @@
factory->NewStringFromAsciiChecked(kErrorSources[i]);
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
info.set_module();
CHECK(!i::parsing::ParseProgram(&info));
isolate->clear_pending_exception();
@@ -6499,8 +6487,7 @@
factory->NewStringFromAsciiChecked(kErrorSources[i]);
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
info.set_module();
CHECK(!i::parsing::ParseProgram(&info));
isolate->clear_pending_exception();
@@ -6697,8 +6684,7 @@
"export {foob};";
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
info.set_module();
CHECK(i::parsing::ParseProgram(&info));
CHECK(i::Compiler::Analyze(&info));
@@ -6957,8 +6943,7 @@
i::Handle<i::Script> script =
factory->NewScript(factory->NewStringFromAsciiChecked(source));
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
i::parsing::ParseProgram(&info);
CHECK(info.literal() != NULL);
CHECK_EQ(expected_language_mode, info.literal()->language_mode());
@@ -9432,8 +9417,7 @@
printf("\n");
i::Handle<i::Script> script = factory->NewScript(source);
- i::Zone zone(isolate->allocator(), ZONE_NAME);
- i::ParseInfo info(&zone, script);
+ i::ParseInfo info(script);
CHECK(i::parsing::ParseProgram(&info));
CHECK(i::Compiler::Analyze(&info));
« no previous file with comments | « test/cctest/parsing/test-preparser.cc ('k') | test/fuzzer/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698