[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 Review-Url: https://codereview.chromium.org/2396963003 Cr-Commit-Position: refs/heads/master@{#40083}
This commit is contained in:
parent
d1545f8ecc
commit
3de42b3f22
@ -892,7 +892,7 @@ MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
|
||||
VMState<COMPILER> state(isolate);
|
||||
PostponeInterruptsScope postpone(isolate);
|
||||
Zone zone(isolate->allocator());
|
||||
ParseInfo parse_info(&zone, function);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
|
||||
// Reset profiler ticks, function is no longer considered hot.
|
||||
@ -1013,7 +1013,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
|
||||
}
|
||||
|
||||
Zone zone(isolate->allocator());
|
||||
ParseInfo parse_info(&zone, function);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
Handle<Code> result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCode(&info), Code);
|
||||
@ -1243,7 +1243,7 @@ bool Compiler::CompileOptimized(Handle<JSFunction> function,
|
||||
function->shared()->ReplaceCode(*code);
|
||||
} else {
|
||||
Zone zone(isolate->allocator());
|
||||
ParseInfo parse_info(&zone, function);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
if (!GetUnoptimizedCode(&info).ToHandle(&code)) {
|
||||
return false;
|
||||
@ -1268,7 +1268,7 @@ bool Compiler::CompileDebugCode(Handle<JSFunction> function) {
|
||||
|
||||
// Start a compilation.
|
||||
Zone zone(isolate->allocator());
|
||||
ParseInfo parse_info(&zone, function);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
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, function);
|
||||
ParseInfo parse_info(&zone, shared_info);
|
||||
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_, function),
|
||||
parse_info_(&zone_, handle(function->shared())),
|
||||
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.
|
||||
ParseInfo parse_info(zone(), target);
|
||||
Handle<SharedFunctionInfo> target_shared(target->shared());
|
||||
ParseInfo parse_info(zone(), target_shared);
|
||||
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_, function),
|
||||
parse_info_(&zone_, handle(function->shared())),
|
||||
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, function));
|
||||
info.reset(new ParseInfo(&zone, shared_info));
|
||||
}
|
||||
if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) {
|
||||
DeclarationScope* scope = info->literal()->scope();
|
||||
|
@ -31,9 +31,6 @@ 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,9 +29,7 @@ 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, location.function())
|
||||
? new ParseInfo(&zone, handle(location.function()->shared()))
|
||||
: 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, function);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
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, function);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
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(), function);
|
||||
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
|
||||
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(), function);
|
||||
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
|
||||
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(), function);
|
||||
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
|
||||
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(), function);
|
||||
ParseInfo parse_info(main_zone(), handle(function->shared()));
|
||||
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_, function);
|
||||
ParseInfo parse_info(zone_, handle(function->shared()));
|
||||
|
||||
CompilationInfo compilation_info(&parse_info, function);
|
||||
compilation_info.SetOptimizing();
|
||||
|
Loading…
Reference in New Issue
Block a user