From a93aab375a0ecf938128fe097b8b6abd429bb364 Mon Sep 17 00:00:00 2001 From: mvstanton Date: Fri, 30 Dec 2016 06:03:54 -0800 Subject: [PATCH] [Turbofan] Make GenericLowering operate concurrently. R=epertoso@chromium.org BUG=5428 Review-Url: https://codereview.chromium.org/2607243002 Cr-Commit-Position: refs/heads/master@{#42003} --- src/compiler/js-graph.cc | 23 +++++++++++++++++++---- src/compiler/js-graph.h | 6 ++++-- src/compiler/js-operator.cc | 2 +- src/compiler/pipeline.cc | 20 +++++++++++++++++--- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/compiler/js-graph.cc b/src/compiler/js-graph.cc index 8626cd1821..0dfb6a61de 100644 --- a/src/compiler/js-graph.cc +++ b/src/compiler/js-graph.cc @@ -31,11 +31,26 @@ Node* JSGraph::ToNumberBuiltinConstant() { Node* JSGraph::CEntryStubConstant(int result_size, SaveFPRegsMode save_doubles, ArgvMode argv_mode, bool builtin_exit_frame) { - if (save_doubles == kDontSaveFPRegs && argv_mode == kArgvOnStack && - result_size == 1) { + if (save_doubles == kDontSaveFPRegs && argv_mode == kArgvOnStack) { + DCHECK(result_size >= 1 && result_size <= 3); + if (!builtin_exit_frame) { + CachedNode key; + if (result_size == 1) { + key = kCEntryStub1Constant; + } else if (result_size == 2) { + key = kCEntryStub2Constant; + } else { + DCHECK(result_size == 3); + key = kCEntryStub3Constant; + } + return CACHED( + key, HeapConstant(CEntryStub(isolate(), result_size, save_doubles, + argv_mode, builtin_exit_frame) + .GetCode())); + } CachedNode key = builtin_exit_frame - ? kCEntryStubWithBuiltinExitFrameConstant - : kCEntryStubConstant; + ? kCEntryStub1WithBuiltinExitFrameConstant + : kCEntryStub1Constant; return CACHED(key, HeapConstant(CEntryStub(isolate(), result_size, save_doubles, argv_mode, builtin_exit_frame) diff --git a/src/compiler/js-graph.h b/src/compiler/js-graph.h index c2c0c77f42..e10591998c 100644 --- a/src/compiler/js-graph.h +++ b/src/compiler/js-graph.h @@ -162,8 +162,10 @@ class V8_EXPORT_PRIVATE JSGraph : public NON_EXPORTED_BASE(ZoneObject) { kAllocateInNewSpaceStubConstant, kAllocateInOldSpaceStubConstant, kToNumberBuiltinConstant, - kCEntryStubConstant, - kCEntryStubWithBuiltinExitFrameConstant, + kCEntryStub1Constant, + kCEntryStub2Constant, + kCEntryStub3Constant, + kCEntryStub1WithBuiltinExitFrameConstant, kEmptyFixedArrayConstant, kEmptyLiteralsArrayConstant, kEmptyStringConstant, diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc index 72f5e8d15b..5a7fc63ea0 100644 --- a/src/compiler/js-operator.cc +++ b/src/compiler/js-operator.cc @@ -20,7 +20,7 @@ VectorSlotPair::VectorSlotPair() {} int VectorSlotPair::index() const { - return vector_.is_null() ? -1 : vector_->GetIndex(slot_); + return vector_.is_null() ? -1 : TypeFeedbackVector::GetIndex(slot_); } diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc index 1202a0c9f0..10daaefc49 100644 --- a/src/compiler/pipeline.cc +++ b/src/compiler/pipeline.cc @@ -979,6 +979,17 @@ struct LoopExitEliminationPhase { } }; +struct GenericLoweringPrepPhase { + static const char* phase_name() { return "generic lowering prep"; } + + void Run(PipelineData* data, Zone* temp_zone) { + // Make sure we cache these code stubs. + data->jsgraph()->CEntryStubConstant(1); + data->jsgraph()->CEntryStubConstant(2); + data->jsgraph()->CEntryStubConstant(3); + } +}; + struct GenericLoweringPhase { static const char* phase_name() { return "generic lowering"; } @@ -1565,9 +1576,8 @@ bool PipelineImpl::CreateGraph() { RunPrintAndVerify("Untyped", true); #endif - // Run generic lowering pass. - Run(); - RunPrintAndVerify("Generic lowering", true); + // Do some hacky things to prepare generic lowering. + Run(); data->EndPhaseKind(); @@ -1577,6 +1587,10 @@ bool PipelineImpl::CreateGraph() { bool PipelineImpl::OptimizeGraph(Linkage* linkage) { PipelineData* data = this->data_; + // Run generic lowering pass. + Run(); + RunPrintAndVerify("Generic lowering", true); + data->BeginPhaseKind("block building"); // Run early optimization pass.