Commit 00227e7f authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Introduce experimental --concurrent-inlining flag.

For now, all it does is control when the heap broker starts
serializing. Eventually it will do what its name suggests.

I'm also renaming --concurrent-compiler-frontend to the more
accurate --concurrent-typed-lowering. Note that it's forceably
implied by --concurrent-inlining.

Bug: v8:7790
Change-Id: I55c1d8f1538146e89f3e166cb9165f6f38447146
Reviewed-on: https://chromium-review.googlesource.com/c/1270839Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56557}
parent b7f1334e
...@@ -2333,6 +2333,12 @@ void MapRef::SerializeOwnDescriptors() { ...@@ -2333,6 +2333,12 @@ void MapRef::SerializeOwnDescriptors() {
data()->AsMap()->SerializeOwnDescriptors(broker()); data()->AsMap()->SerializeOwnDescriptors(broker());
} }
void MapRef::SerializePrototype() {
if (broker()->mode() == JSHeapBroker::kDisabled) return;
CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing);
data()->AsMap()->SerializePrototype(broker());
}
void ModuleRef::Serialize() { void ModuleRef::Serialize() {
if (broker()->mode() == JSHeapBroker::kDisabled) return; if (broker()->mode() == JSHeapBroker::kDisabled) return;
CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing); CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing);
......
...@@ -359,6 +359,8 @@ class MapRef : public HeapObjectRef { ...@@ -359,6 +359,8 @@ class MapRef : public HeapObjectRef {
bool is_callable() const; bool is_callable() const;
ObjectRef constructor_or_backpointer() const; ObjectRef constructor_or_backpointer() const;
void SerializePrototype();
ObjectRef prototype() const; ObjectRef prototype() const;
OddballType oddball_type() const; OddballType oddball_type() const;
......
...@@ -359,6 +359,8 @@ Reduction JSNativeContextSpecialization::ReduceJSGetSuperConstructor( ...@@ -359,6 +359,8 @@ Reduction JSNativeContextSpecialization::ReduceJSGetSuperConstructor(
if (!m.HasValue()) return NoChange(); if (!m.HasValue()) return NoChange();
JSFunctionRef function = m.Ref(js_heap_broker()).AsJSFunction(); JSFunctionRef function = m.Ref(js_heap_broker()).AsJSFunction();
MapRef function_map = function.map(); MapRef function_map = function.map();
// TODO(neis): Remove SerializePrototype call once brokerization is complete.
function_map.SerializePrototype();
ObjectRef function_prototype = function_map.prototype(); ObjectRef function_prototype = function_map.prototype();
// We can constant-fold the super constructor access if the // We can constant-fold the super constructor access if the
......
...@@ -2008,6 +2008,12 @@ bool PipelineImpl::CreateGraph() { ...@@ -2008,6 +2008,12 @@ bool PipelineImpl::CreateGraph() {
Run<GraphBuilderPhase>(); Run<GraphBuilderPhase>();
RunPrintAndVerify(GraphBuilderPhase::phase_name(), true); RunPrintAndVerify(GraphBuilderPhase::phase_name(), true);
if (FLAG_concurrent_inlining) {
data->js_heap_broker()->StartSerializing();
Run<SerializeStandardObjectsPhase>();
Run<CopyMetadataForConcurrentCompilePhase>();
}
// Perform function context specialization and inlining (if enabled). // Perform function context specialization and inlining (if enabled).
Run<InliningPhase>(); Run<InliningPhase>();
RunPrintAndVerify(InliningPhase::phase_name(), true); RunPrintAndVerify(InliningPhase::phase_name(), true);
...@@ -2031,7 +2037,12 @@ bool PipelineImpl::CreateGraph() { ...@@ -2031,7 +2037,12 @@ bool PipelineImpl::CreateGraph() {
// Run the type-sensitive lowerings and optimizations on the graph. // Run the type-sensitive lowerings and optimizations on the graph.
{ {
if (FLAG_concurrent_compiler_frontend) { if (FLAG_concurrent_inlining) {
// TODO(neis): Remove CopyMetadataForConcurrentCompilePhase call once
// brokerization of JSNativeContextSpecialization is complete.
Run<CopyMetadataForConcurrentCompilePhase>();
data->js_heap_broker()->StopSerializing();
} else if (FLAG_concurrent_typed_lowering) {
data->js_heap_broker()->StartSerializing(); data->js_heap_broker()->StartSerializing();
Run<SerializeStandardObjectsPhase>(); Run<SerializeStandardObjectsPhase>();
Run<CopyMetadataForConcurrentCompilePhase>(); Run<CopyMetadataForConcurrentCompilePhase>();
...@@ -2058,7 +2069,7 @@ bool PipelineImpl::OptimizeGraph(Linkage* linkage) { ...@@ -2058,7 +2069,7 @@ bool PipelineImpl::OptimizeGraph(Linkage* linkage) {
data->BeginPhaseKind("lowering"); data->BeginPhaseKind("lowering");
if (FLAG_concurrent_compiler_frontend) { if (FLAG_concurrent_typed_lowering) {
// Type the graph and keep the Typer running such that new nodes get // Type the graph and keep the Typer running such that new nodes get
// automatically typed when they are created. // automatically typed when they are created.
Run<TyperPhase>(data->CreateTyper()); Run<TyperPhase>(data->CreateTyper());
...@@ -2574,7 +2585,7 @@ std::ostream& operator<<(std::ostream& out, const BlockStartsAsJSON& s) { ...@@ -2574,7 +2585,7 @@ std::ostream& operator<<(std::ostream& out, const BlockStartsAsJSON& s) {
MaybeHandle<Code> PipelineImpl::FinalizeCode() { MaybeHandle<Code> PipelineImpl::FinalizeCode() {
PipelineData* data = this->data_; PipelineData* data = this->data_;
if (data->js_heap_broker() && FLAG_concurrent_compiler_frontend) { if (data->js_heap_broker() && FLAG_concurrent_typed_lowering) {
data->js_heap_broker()->Retire(); data->js_heap_broker()->Retire();
} }
Run<FinalizeCodePhase>(); Run<FinalizeCodePhase>();
......
...@@ -402,9 +402,13 @@ DEFINE_INT(concurrent_recompilation_delay, 0, ...@@ -402,9 +402,13 @@ DEFINE_INT(concurrent_recompilation_delay, 0,
"artificial compilation delay in ms") "artificial compilation delay in ms")
DEFINE_BOOL(block_concurrent_recompilation, false, DEFINE_BOOL(block_concurrent_recompilation, false,
"block queued jobs until released") "block queued jobs until released")
DEFINE_BOOL(concurrent_compiler_frontend, false, DEFINE_BOOL(
"run optimizing compiler's frontend phases on a separate thread") concurrent_typed_lowering, false,
DEFINE_IMPLICATION(future, concurrent_compiler_frontend) "run optimizing compiler's typed lowering phase on a separate thread")
DEFINE_IMPLICATION(future, concurrent_typed_lowering)
DEFINE_BOOL(concurrent_inlining, false,
"run optimizing compiler's inlining phase on a separate thread")
DEFINE_IMPLICATION(concurrent_inlining, concurrent_typed_lowering)
DEFINE_BOOL(strict_heap_broker, false, "fail on incomplete serialization") DEFINE_BOOL(strict_heap_broker, false, "fail on incomplete serialization")
DEFINE_BOOL(trace_heap_broker, false, "trace the heap broker") DEFINE_BOOL(trace_heap_broker, false, "trace the heap broker")
......
...@@ -110,8 +110,8 @@ static const int slot_index = Context::NATIVE_CONTEXT_INDEX; ...@@ -110,8 +110,8 @@ static const int slot_index = Context::NATIVE_CONTEXT_INDEX;
TEST(ReduceJSLoadContext0) { TEST(ReduceJSLoadContext0) {
// TODO(neis): The native context below does not have all the fields // TODO(neis): The native context below does not have all the fields
// initialized that the heap broker wants to serialize. // initialized that the heap broker wants to serialize.
bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend; bool concurrent_typed_lowering = FLAG_concurrent_typed_lowering;
FLAG_concurrent_compiler_frontend = false; FLAG_concurrent_typed_lowering = false;
ContextSpecializationTester t(Nothing<OuterContext>()); ContextSpecializationTester t(Nothing<OuterContext>());
...@@ -178,7 +178,7 @@ TEST(ReduceJSLoadContext0) { ...@@ -178,7 +178,7 @@ TEST(ReduceJSLoadContext0) {
CHECK_EQ(*expected, *match.Value()); CHECK_EQ(*expected, *match.Value());
} }
FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend; FLAG_concurrent_typed_lowering = concurrent_typed_lowering;
} }
TEST(ReduceJSLoadContext1) { TEST(ReduceJSLoadContext1) {
...@@ -258,8 +258,8 @@ TEST(ReduceJSLoadContext2) { ...@@ -258,8 +258,8 @@ TEST(ReduceJSLoadContext2) {
// TODO(neis): The native context below does not have all the fields // TODO(neis): The native context below does not have all the fields
// initialized that the heap broker wants to serialize. // initialized that the heap broker wants to serialize.
bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend; bool concurrent_typed_lowering = FLAG_concurrent_typed_lowering;
FLAG_concurrent_compiler_frontend = false; FLAG_concurrent_typed_lowering = false;
ContextSpecializationTester t(Nothing<OuterContext>()); ContextSpecializationTester t(Nothing<OuterContext>());
...@@ -332,7 +332,7 @@ TEST(ReduceJSLoadContext2) { ...@@ -332,7 +332,7 @@ TEST(ReduceJSLoadContext2) {
t.CheckChangesToValue(load, slot_value0); t.CheckChangesToValue(load, slot_value0);
} }
FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend; FLAG_concurrent_typed_lowering = concurrent_typed_lowering;
} }
TEST(ReduceJSLoadContext3) { TEST(ReduceJSLoadContext3) {
...@@ -344,8 +344,8 @@ TEST(ReduceJSLoadContext3) { ...@@ -344,8 +344,8 @@ TEST(ReduceJSLoadContext3) {
// TODO(neis): The native context below does not have all the fields // TODO(neis): The native context below does not have all the fields
// initialized that the heap broker wants to serialize. // initialized that the heap broker wants to serialize.
bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend; bool concurrent_typed_lowering = FLAG_concurrent_typed_lowering;
FLAG_concurrent_compiler_frontend = false; FLAG_concurrent_typed_lowering = false;
HandleAndZoneScope handle_zone_scope; HandleAndZoneScope handle_zone_scope;
auto factory = handle_zone_scope.main_isolate()->factory(); auto factory = handle_zone_scope.main_isolate()->factory();
...@@ -422,14 +422,14 @@ TEST(ReduceJSLoadContext3) { ...@@ -422,14 +422,14 @@ TEST(ReduceJSLoadContext3) {
t.CheckChangesToValue(load, slot_value0); t.CheckChangesToValue(load, slot_value0);
} }
FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend; FLAG_concurrent_typed_lowering = concurrent_typed_lowering;
} }
TEST(ReduceJSStoreContext0) { TEST(ReduceJSStoreContext0) {
// TODO(neis): The native context below does not have all the fields // TODO(neis): The native context below does not have all the fields
// initialized that the heap broker wants to serialize. // initialized that the heap broker wants to serialize.
bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend; bool concurrent_typed_lowering = FLAG_concurrent_typed_lowering;
FLAG_concurrent_compiler_frontend = false; FLAG_concurrent_typed_lowering = false;
ContextSpecializationTester t(Nothing<OuterContext>()); ContextSpecializationTester t(Nothing<OuterContext>());
...@@ -491,7 +491,7 @@ TEST(ReduceJSStoreContext0) { ...@@ -491,7 +491,7 @@ TEST(ReduceJSStoreContext0) {
CHECK_EQ(false, access.immutable()); CHECK_EQ(false, access.immutable());
} }
FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend; FLAG_concurrent_typed_lowering = concurrent_typed_lowering;
} }
TEST(ReduceJSStoreContext1) { TEST(ReduceJSStoreContext1) {
...@@ -541,8 +541,8 @@ TEST(ReduceJSStoreContext1) { ...@@ -541,8 +541,8 @@ TEST(ReduceJSStoreContext1) {
TEST(ReduceJSStoreContext2) { TEST(ReduceJSStoreContext2) {
// TODO(neis): The native context below does not have all the fields // TODO(neis): The native context below does not have all the fields
// initialized that the heap broker wants to serialize. // initialized that the heap broker wants to serialize.
bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend; bool concurrent_typed_lowering = FLAG_concurrent_typed_lowering;
FLAG_concurrent_compiler_frontend = false; FLAG_concurrent_typed_lowering = false;
ContextSpecializationTester t(Nothing<OuterContext>()); ContextSpecializationTester t(Nothing<OuterContext>());
...@@ -595,14 +595,14 @@ TEST(ReduceJSStoreContext2) { ...@@ -595,14 +595,14 @@ TEST(ReduceJSStoreContext2) {
t.CheckContextInputAndDepthChanges(store, context_object0, 0); t.CheckContextInputAndDepthChanges(store, context_object0, 0);
} }
FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend; FLAG_concurrent_typed_lowering = concurrent_typed_lowering;
} }
TEST(ReduceJSStoreContext3) { TEST(ReduceJSStoreContext3) {
// TODO(neis): The native context below does not have all the fields // TODO(neis): The native context below does not have all the fields
// initialized that the heap broker wants to serialize. // initialized that the heap broker wants to serialize.
bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend; bool concurrent_typed_lowering = FLAG_concurrent_typed_lowering;
FLAG_concurrent_compiler_frontend = false; FLAG_concurrent_typed_lowering = false;
HandleAndZoneScope handle_zone_scope; HandleAndZoneScope handle_zone_scope;
auto factory = handle_zone_scope.main_isolate()->factory(); auto factory = handle_zone_scope.main_isolate()->factory();
...@@ -659,7 +659,7 @@ TEST(ReduceJSStoreContext3) { ...@@ -659,7 +659,7 @@ TEST(ReduceJSStoreContext3) {
t.CheckContextInputAndDepthChanges(store, context_object0, 0); t.CheckContextInputAndDepthChanges(store, context_object0, 0);
} }
FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend; FLAG_concurrent_typed_lowering = concurrent_typed_lowering;
} }
TEST(SpecializeJSFunction_ToConstant1) { TEST(SpecializeJSFunction_ToConstant1) {
......
...@@ -22,7 +22,7 @@ class JSCallReducerTest : public TypedGraphTest { ...@@ -22,7 +22,7 @@ class JSCallReducerTest : public TypedGraphTest {
public: public:
JSCallReducerTest() JSCallReducerTest()
: TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) { : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) {
if (FLAG_concurrent_compiler_frontend) { if (FLAG_concurrent_typed_lowering) {
js_heap_broker()->SerializeStandardObjects(); js_heap_broker()->SerializeStandardObjects();
} }
} }
......
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