Commit 234f1a84 authored by hablich's avatar hablich Committed by Commit bot

Revert of [parser] Deprecate ParseInfo constructor taking closure. (patchset...

Revert of [parser] Deprecate ParseInfo constructor taking closure. (patchset #2 id:20001 of https://codereview.chromium.org/2396963003/ )

Reason for revert:
Needed to revert https://codereview.chromium.org/2400343002/

Original issue's description:
> [parser] Deprecate ParseInfo constructor taking closure.
>
> This removes the {ParseInfo} constructor consuming a closure, replacing
> all uses to pass only the shared function info. The goal is to make the
> fact that parsing is independent of a concrete closure explicit.
>
> R=jochen@chromium.org
> BUG=v8:2206
>
> Committed: https://crrev.com/3de42b3f224217ec88e4c609d3cf23fe06806dca
> Cr-Commit-Position: refs/heads/master@{#40083}

TBR=jochen@chromium.org,bmeurer@chromium.org,marja@chromium.org,yangguo@chromium.org,mstarzinger@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:2206

Review-Url: https://codereview.chromium.org/2406623002
Cr-Commit-Position: refs/heads/master@{#40097}
parent 57ba0ae1
......@@ -880,7 +880,7 @@ MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
VMState<COMPILER> state(isolate);
PostponeInterruptsScope postpone(isolate);
Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, handle(function->shared()));
ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info, function);
// Reset profiler ticks, function is no longer considered hot.
......@@ -1001,7 +1001,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
}
Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, handle(function->shared()));
ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info, function);
Handle<Code> result;
ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCode(&info), Code);
......@@ -1227,7 +1227,7 @@ bool Compiler::CompileOptimized(Handle<JSFunction> function,
function->shared()->ReplaceCode(*code);
} else {
Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, handle(function->shared()));
ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info, function);
if (!GetUnoptimizedCode(&info).ToHandle(&code)) {
return false;
......@@ -1252,7 +1252,7 @@ bool Compiler::CompileDebugCode(Handle<JSFunction> function) {
// Start a compilation.
Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, handle(function->shared()));
ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
if (IsEvalToplevel(handle(function->shared()))) {
parse_info.set_eval();
......
......@@ -472,7 +472,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
}
Zone zone(info_->isolate()->allocator());
ParseInfo parse_info(&zone, shared_info);
ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info, function);
if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled();
if (info_->is_type_feedback_enabled()) info.MarkAsTypeFeedbackEnabled();
......
......@@ -570,7 +570,7 @@ class PipelineCompilationJob final : public CompilationJob {
: CompilationJob(isolate, &info_, "TurboFan"),
zone_(isolate->allocator()),
zone_stats_(isolate->allocator()),
parse_info_(&zone_, handle(function->shared())),
parse_info_(&zone_, function),
info_(&parse_info_, function),
pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)),
data_(&zone_stats_, info(), pipeline_statistics_.get()),
......
......@@ -8238,13 +8238,13 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
// Parse and allocate variables.
// Use the same AstValueFactory for creating strings in the sub-compilation
// step, but don't transfer ownership to target_info.
Handle<SharedFunctionInfo> target_shared(target->shared());
ParseInfo parse_info(zone(), target_shared);
ParseInfo parse_info(zone(), target);
parse_info.set_ast_value_factory(
top_info()->parse_info()->ast_value_factory());
parse_info.set_ast_value_factory_owned(false);
CompilationInfo target_info(&parse_info, target);
Handle<SharedFunctionInfo> target_shared(target->shared());
if (inlining_kind != CONSTRUCT_CALL_RETURN &&
IsClassConstructor(target_shared->kind())) {
......
......@@ -38,7 +38,7 @@ class HCompilationJob final : public CompilationJob {
explicit HCompilationJob(Handle<JSFunction> function)
: CompilationJob(function->GetIsolate(), &info_, "Crankshaft"),
zone_(function->GetIsolate()->allocator()),
parse_info_(&zone_, handle(function->shared())),
parse_info_(&zone_, function),
info_(&parse_info_, function),
graph_(nullptr),
chunk_(nullptr) {}
......
......@@ -107,7 +107,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
}
} else {
// Inner function.
info.reset(new ParseInfo(&zone, shared_info));
info.reset(new ParseInfo(&zone, function));
}
if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) {
DeclarationScope* scope = info->literal()->scope();
......
......@@ -31,6 +31,9 @@ ParseInfo::ParseInfo(Zone* zone)
function_name_(nullptr),
literal_(nullptr) {}
ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function)
: ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {}
ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
: ParseInfo(zone) {
isolate_ = shared->GetIsolate();
......
......@@ -29,7 +29,9 @@ class Zone;
class ParseInfo {
public:
explicit ParseInfo(Zone* zone);
ParseInfo(Zone* zone, Handle<JSFunction> function);
ParseInfo(Zone* zone, Handle<Script> script);
// TODO(all) Only used via Debug::FindSharedFunctionInfoInScript, remove?
ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared);
~ParseInfo();
......
......@@ -450,7 +450,7 @@ Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
Zone zone(isolate->allocator());
std::unique_ptr<ParseInfo> info(
location.function()->shared()->is_function()
? new ParseInfo(&zone, handle(location.function()->shared()))
? new ParseInfo(&zone, location.function())
: new ParseInfo(&zone, location.script()));
if (Parser::ParseStatic(info.get())) {
CallPrinter printer(isolate, location.function()->shared()->IsBuiltin());
......
......@@ -159,7 +159,7 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph,
Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
Zone zone(function->GetIsolate()->allocator());
ParseInfo parse_info(&zone, handle(function->shared()));
ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info, function);
info.SetOptimizing();
......@@ -190,7 +190,7 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
// and replace the JSFunction's code with the result.
Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
Zone zone(function->GetIsolate()->allocator());
ParseInfo parse_info(&zone, handle(function->shared()));
ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info, function);
CHECK(Parser::ParseStatic(info.parse_info()));
......
......@@ -43,7 +43,7 @@ static Handle<JSFunction> Compile(const char* source) {
TEST(TestLinkageCreate) {
HandleAndZoneScope handles;
Handle<JSFunction> function = Compile("a + b");
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
ParseInfo parse_info(handles.main_zone(), function);
CompilationInfo info(&parse_info, function);
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
CHECK(descriptor);
......@@ -59,7 +59,7 @@ TEST(TestLinkageJSFunctionIncoming) {
Handle<JSFunction> function =
Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Local<v8::Function>::Cast(CompileRun(sources[i]))));
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
ParseInfo parse_info(handles.main_zone(), function);
CompilationInfo info(&parse_info, function);
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
CHECK(descriptor);
......@@ -75,7 +75,7 @@ TEST(TestLinkageJSFunctionIncoming) {
TEST(TestLinkageJSCall) {
HandleAndZoneScope handles;
Handle<JSFunction> function = Compile("a + c");
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
ParseInfo parse_info(handles.main_zone(), function);
CompilationInfo info(&parse_info, function);
for (int i = 0; i < 32; i++) {
......
......@@ -32,7 +32,7 @@ struct TestHelper : public HandleAndZoneScope {
void CheckLoopAssignedCount(int expected, const char* var_name) {
// TODO(titzer): don't scope analyze every single time.
ParseInfo parse_info(main_zone(), handle(function->shared()));
ParseInfo parse_info(main_zone(), function);
CompilationInfo info(&parse_info, function);
CHECK(Parser::ParseStatic(&parse_info));
......
......@@ -124,7 +124,7 @@ class BytecodeGraphTester {
// TODO(mstarzinger): We should be able to prime CompilationInfo without
// having to instantiate a ParseInfo first. Fix this!
ParseInfo parse_info(zone_, handle(function->shared()));
ParseInfo parse_info(zone_, function);
CompilationInfo compilation_info(&parse_info, function);
compilation_info.SetOptimizing();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment