From eeec886e5f5893fef86e9be08990de5b1272ea46 Mon Sep 17 00:00:00 2001 From: bmeurer Date: Tue, 23 Dec 2014 04:50:43 -0800 Subject: [PATCH] [turbofan] Deinlinify OperatorProperties implementation. TEST=cctest,unittests R=jochen@chromium.org Review URL: https://codereview.chromium.org/821913002 Cr-Commit-Position: refs/heads/master@{#25935} --- BUILD.gn | 2 +- src/compiler/basic-block-instrumentor.cc | 3 +- src/compiler/graph-builder.cc | 2 +- src/compiler/graph-replay.cc | 2 +- src/compiler/graph.cc | 1 - src/compiler/js-context-specialization.cc | 5 ++-- src/compiler/node-properties-inl.h | 1 - ...tor-properties-inl.h => operator-properties.cc} | 34 ++++++++-------------- src/compiler/operator-properties.h | 25 +++++++++++----- src/compiler/simplified-lowering.cc | 1 + test/cctest/compiler/simplified-graph-builder.cc | 1 - .../compiler/test-machine-operator-reducer.cc | 1 - test/cctest/compiler/test-typer.cc | 1 + .../unittests/compiler/change-lowering-unittest.cc | 1 + .../unittests/compiler/common-operator-unittest.cc | 7 +++-- .../compiler/control-equivalence-unittest.cc | 1 + test/unittests/compiler/js-operator-unittest.cc | 4 ++- test/unittests/compiler/node-test-utils.cc | 1 + .../compiler/simplified-operator-unittest.cc | 6 ++-- tools/gyp/v8.gyp | 2 +- 20 files changed, 55 insertions(+), 46 deletions(-) rename src/compiler/{operator-properties-inl.h => operator-properties.cc} (71%) diff --git a/BUILD.gn b/BUILD.gn index 728b06f..28695dd 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -564,7 +564,7 @@ source_set("v8_base") { "src/compiler/node.cc", "src/compiler/node.h", "src/compiler/opcodes.h", - "src/compiler/operator-properties-inl.h", + "src/compiler/operator-properties.cc", "src/compiler/operator-properties.h", "src/compiler/operator.cc", "src/compiler/operator.h", diff --git a/src/compiler/basic-block-instrumentor.cc b/src/compiler/basic-block-instrumentor.cc index 59bb7f4..d7d3ade 100644 --- a/src/compiler/basic-block-instrumentor.cc +++ b/src/compiler/basic-block-instrumentor.cc @@ -6,10 +6,11 @@ #include +#include "src/compiler.h" #include "src/compiler/common-operator.h" #include "src/compiler/graph.h" #include "src/compiler/machine-operator.h" -#include "src/compiler/operator-properties-inl.h" +#include "src/compiler/operator-properties.h" #include "src/compiler/schedule.h" namespace v8 { diff --git a/src/compiler/graph-builder.cc b/src/compiler/graph-builder.cc index 0e460aa..6321aaa 100644 --- a/src/compiler/graph-builder.cc +++ b/src/compiler/graph-builder.cc @@ -4,13 +4,13 @@ #include "src/compiler/graph-builder.h" +#include "src/bit-vector.h" #include "src/compiler.h" #include "src/compiler/graph-visualizer.h" #include "src/compiler/node.h" #include "src/compiler/node-properties.h" #include "src/compiler/node-properties-inl.h" #include "src/compiler/operator-properties.h" -#include "src/compiler/operator-properties-inl.h" namespace v8 { namespace internal { diff --git a/src/compiler/graph-replay.cc b/src/compiler/graph-replay.cc index 25a62f3..3a0b783 100644 --- a/src/compiler/graph-replay.cc +++ b/src/compiler/graph-replay.cc @@ -9,7 +9,7 @@ #include "src/compiler/graph-inl.h" #include "src/compiler/node.h" #include "src/compiler/operator.h" -#include "src/compiler/operator-properties-inl.h" +#include "src/compiler/operator-properties.h" namespace v8 { namespace internal { diff --git a/src/compiler/graph.cc b/src/compiler/graph.cc index 619a8de..995046b 100644 --- a/src/compiler/graph.cc +++ b/src/compiler/graph.cc @@ -12,7 +12,6 @@ #include "src/compiler/node-properties-inl.h" #include "src/compiler/opcodes.h" #include "src/compiler/operator-properties.h" -#include "src/compiler/operator-properties-inl.h" namespace v8 { namespace internal { diff --git a/src/compiler/js-context-specialization.cc b/src/compiler/js-context-specialization.cc index b2a234b..a700b47 100644 --- a/src/compiler/js-context-specialization.cc +++ b/src/compiler/js-context-specialization.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/compiler/js-context-specialization.h" + +#include "src/compiler.h" #include "src/compiler/common-operator.h" #include "src/compiler/graph-inl.h" -#include "src/compiler/js-context-specialization.h" #include "src/compiler/js-operator.h" #include "src/compiler/node-matchers.h" #include "src/compiler/node-properties-inl.h" @@ -13,7 +15,6 @@ namespace v8 { namespace internal { namespace compiler { - Reduction JSContextSpecializer::Reduce(Node* node) { if (node == context_) { Node* constant = jsgraph_->Constant(info_->context()); diff --git a/src/compiler/node-properties-inl.h b/src/compiler/node-properties-inl.h index 1ff0938..0d29614 100644 --- a/src/compiler/node-properties-inl.h +++ b/src/compiler/node-properties-inl.h @@ -11,7 +11,6 @@ #include "src/compiler/node-properties.h" #include "src/compiler/opcodes.h" #include "src/compiler/operator.h" -#include "src/compiler/operator-properties-inl.h" #include "src/compiler/operator-properties.h" namespace v8 { diff --git a/src/compiler/operator-properties-inl.h b/src/compiler/operator-properties.cc similarity index 71% rename from src/compiler/operator-properties-inl.h rename to src/compiler/operator-properties.cc index f958e74..abfc5fd 100644 --- a/src/compiler/operator-properties-inl.h +++ b/src/compiler/operator-properties.cc @@ -1,30 +1,29 @@ -// Copyright 2013 the V8 project authors. All rights reserved. +// Copyright 2014 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ -#define V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ +#include "src/compiler/operator-properties.h" -#include "src/compiler/common-operator.h" #include "src/compiler/js-operator.h" #include "src/compiler/linkage.h" #include "src/compiler/opcodes.h" -#include "src/compiler/operator-properties.h" namespace v8 { namespace internal { namespace compiler { -inline bool OperatorProperties::HasContextInput(const Operator* op) { +// static +bool OperatorProperties::HasContextInput(const Operator* op) { IrOpcode::Value opcode = static_cast(op->opcode()); return IrOpcode::IsJsOpcode(opcode); } -inline bool OperatorProperties::HasFrameStateInput(const Operator* op) { + +// static +bool OperatorProperties::HasFrameStateInput(const Operator* op) { if (!FLAG_turbo_deoptimization) { return false; } - switch (op->opcode()) { case IrOpcode::kFrameState: return true; @@ -81,25 +80,18 @@ inline bool OperatorProperties::HasFrameStateInput(const Operator* op) { } } -inline int OperatorProperties::GetContextInputCount(const Operator* op) { - return OperatorProperties::HasContextInput(op) ? 1 : 0; -} - -inline int OperatorProperties::GetFrameStateInputCount(const Operator* op) { - return OperatorProperties::HasFrameStateInput(op) ? 1 : 0; -} -inline int OperatorProperties::GetTotalInputCount(const Operator* op) { +// static +int OperatorProperties::GetTotalInputCount(const Operator* op) { return op->ValueInputCount() + GetContextInputCount(op) + GetFrameStateInputCount(op) + op->EffectInputCount() + op->ControlInputCount(); } -// ----------------------------------------------------------------------------- -// Output properties. -inline bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { - uint8_t opcode = op->opcode(); +// static +bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { + Operator::Opcode const opcode = op->opcode(); return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || @@ -109,5 +101,3 @@ inline bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { } // namespace compiler } // namespace internal } // namespace v8 - -#endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ diff --git a/src/compiler/operator-properties.h b/src/compiler/operator-properties.h index 70186c9..37c9755 100644 --- a/src/compiler/operator-properties.h +++ b/src/compiler/operator-properties.h @@ -5,22 +5,33 @@ #ifndef V8_COMPILER_OPERATOR_PROPERTIES_H_ #define V8_COMPILER_OPERATOR_PROPERTIES_H_ +#include "src/base/macros.h" + namespace v8 { namespace internal { namespace compiler { +// Forward declarations. class Operator; -class OperatorProperties { + +class OperatorProperties FINAL { public: - static inline bool HasContextInput(const Operator* op); - static inline bool HasFrameStateInput(const Operator* op); + static bool HasContextInput(const Operator* op); + static bool HasFrameStateInput(const Operator* op); + + static int GetContextInputCount(const Operator* op) { + return HasContextInput(op) ? 1 : 0; + } + static int GetFrameStateInputCount(const Operator* op) { + return HasFrameStateInput(op) ? 1 : 0; + } + static int GetTotalInputCount(const Operator* op); - static inline int GetContextInputCount(const Operator* op); - static inline int GetFrameStateInputCount(const Operator* op); - static inline int GetTotalInputCount(const Operator* op); + static bool IsBasicBlockBegin(const Operator* op); - static inline bool IsBasicBlockBegin(const Operator* op); + private: + DISALLOW_COPY_AND_ASSIGN(OperatorProperties); }; } // namespace compiler diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 74ddb53..89c6bce 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -11,6 +11,7 @@ #include "src/compiler/common-operator.h" #include "src/compiler/diamond.h" #include "src/compiler/graph-inl.h" +#include "src/compiler/linkage.h" #include "src/compiler/node-matchers.h" #include "src/compiler/node-properties-inl.h" #include "src/compiler/representation-change.h" diff --git a/test/cctest/compiler/simplified-graph-builder.cc b/test/cctest/compiler/simplified-graph-builder.cc index 4e8a5e3..baa03fb 100644 --- a/test/cctest/compiler/simplified-graph-builder.cc +++ b/test/cctest/compiler/simplified-graph-builder.cc @@ -5,7 +5,6 @@ #include "test/cctest/compiler/simplified-graph-builder.h" #include "src/compiler/operator-properties.h" -#include "src/compiler/operator-properties-inl.h" namespace v8 { namespace internal { diff --git a/test/cctest/compiler/test-machine-operator-reducer.cc b/test/cctest/compiler/test-machine-operator-reducer.cc index b538fb7..648e1b9 100644 --- a/test/cctest/compiler/test-machine-operator-reducer.cc +++ b/test/cctest/compiler/test-machine-operator-reducer.cc @@ -10,7 +10,6 @@ #include "src/compiler/js-graph.h" #include "src/compiler/machine-operator-reducer.h" #include "src/compiler/operator-properties.h" -#include "src/compiler/operator-properties-inl.h" #include "src/compiler/typer.h" #include "test/cctest/compiler/value-helper.h" diff --git a/test/cctest/compiler/test-typer.cc b/test/cctest/compiler/test-typer.cc index 2b9d91a..5f7f55a 100644 --- a/test/cctest/compiler/test-typer.cc +++ b/test/cctest/compiler/test-typer.cc @@ -5,6 +5,7 @@ #include #include "src/codegen.h" +#include "src/compiler/js-operator.h" #include "src/compiler/node-properties-inl.h" #include "src/compiler/typer.h" #include "test/cctest/cctest.h" diff --git a/test/unittests/compiler/change-lowering-unittest.cc b/test/unittests/compiler/change-lowering-unittest.cc index 199fb30..763a443 100644 --- a/test/unittests/compiler/change-lowering-unittest.cc +++ b/test/unittests/compiler/change-lowering-unittest.cc @@ -5,6 +5,7 @@ #include "src/code-stubs.h" #include "src/compiler/change-lowering.h" #include "src/compiler/js-graph.h" +#include "src/compiler/linkage.h" #include "src/compiler/node-properties-inl.h" #include "src/compiler/simplified-operator.h" #include "test/unittests/compiler/compiler-test-utils.h" diff --git a/test/unittests/compiler/common-operator-unittest.cc b/test/unittests/compiler/common-operator-unittest.cc index b4bd799..d0ac145 100644 --- a/test/unittests/compiler/common-operator-unittest.cc +++ b/test/unittests/compiler/common-operator-unittest.cc @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/compiler/common-operator.h" - #include -#include "src/compiler/operator-properties-inl.h" +#include "src/compiler/common-operator.h" +#include "src/compiler/opcodes.h" +#include "src/compiler/operator.h" +#include "src/compiler/operator-properties.h" #include "test/unittests/test-utils.h" namespace v8 { diff --git a/test/unittests/compiler/control-equivalence-unittest.cc b/test/unittests/compiler/control-equivalence-unittest.cc index b44f671..56b4a2b 100644 --- a/test/unittests/compiler/control-equivalence-unittest.cc +++ b/test/unittests/compiler/control-equivalence-unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/bit-vector.h" #include "src/compiler/control-equivalence.h" #include "src/compiler/graph-visualizer.h" #include "src/compiler/node-properties-inl.h" diff --git a/test/unittests/compiler/js-operator-unittest.cc b/test/unittests/compiler/js-operator-unittest.cc index 828db80..7aa0c64 100644 --- a/test/unittests/compiler/js-operator-unittest.cc +++ b/test/unittests/compiler/js-operator-unittest.cc @@ -3,7 +3,9 @@ // found in the LICENSE file. #include "src/compiler/js-operator.h" -#include "src/compiler/operator-properties-inl.h" +#include "src/compiler/opcodes.h" +#include "src/compiler/operator.h" +#include "src/compiler/operator-properties.h" #include "test/unittests/test-utils.h" namespace v8 { diff --git a/test/unittests/compiler/node-test-utils.cc b/test/unittests/compiler/node-test-utils.cc index 90d4889..3162c54 100644 --- a/test/unittests/compiler/node-test-utils.cc +++ b/test/unittests/compiler/node-test-utils.cc @@ -4,6 +4,7 @@ #include "test/unittests/compiler/node-test-utils.h" +#include "src/assembler.h" #include "src/compiler/node-properties-inl.h" #include "src/compiler/simplified-operator.h" diff --git a/test/unittests/compiler/simplified-operator-unittest.cc b/test/unittests/compiler/simplified-operator-unittest.cc index b65c0b4..e7fceba 100644 --- a/test/unittests/compiler/simplified-operator-unittest.cc +++ b/test/unittests/compiler/simplified-operator-unittest.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/compiler/opcodes.h" +#include "src/compiler/operator.h" +#include "src/compiler/operator-properties.h" #include "src/compiler/simplified-operator.h" - -#include "src/compiler/operator-properties-inl.h" +#include "src/types-inl.h" #include "test/unittests/test-utils.h" namespace v8 { diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index 388c10f..8901681 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -491,7 +491,7 @@ '../../src/compiler/node.cc', '../../src/compiler/node.h', '../../src/compiler/opcodes.h', - '../../src/compiler/operator-properties-inl.h', + '../../src/compiler/operator-properties.cc', '../../src/compiler/operator-properties.h', '../../src/compiler/operator.cc', '../../src/compiler/operator.h', -- 2.7.4