Remove inline header includes from non-inline headers (1).

This tries to remove includes of "-inl.h" headers from normal ".h"
headers, thereby reducing the chance of any cyclic dependencies and
decreasing the average size of our compilation units.

Note that this change still leaves 7 violations of that rule in the
code. However there now is the "tools/check-inline-includes.sh" tool
detecting such violations.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/1283033003

Cr-Commit-Position: refs/heads/master@{#30125}
This commit is contained in:
mstarzinger 2015-08-12 00:32:36 -07:00 committed by Commit bot
parent c1d20f831b
commit 00a07bc1b7
46 changed files with 85 additions and 57 deletions

View File

@ -6,7 +6,7 @@
#include "src/allocation-tracker.h" #include "src/allocation-tracker.h"
#include "src/frames-inl.h" #include "src/frames-inl.h"
#include "src/heap-snapshot-generator.h" #include "src/heap-snapshot-generator-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -20,6 +20,7 @@
#include "src/base/platform/time.h" #include "src/base/platform/time.h"
#include "src/base/utils/random-number-generator.h" #include "src/base/utils/random-number-generator.h"
#include "src/bootstrapper.h" #include "src/bootstrapper.h"
#include "src/char-predicates-inl.h"
#include "src/code-stubs.h" #include "src/code-stubs.h"
#include "src/compiler.h" #include "src/compiler.h"
#include "src/context-measure.h" #include "src/context-measure.h"

View File

@ -9,7 +9,7 @@
#include "src/contexts.h" #include "src/contexts.h"
#include "src/factory.h" #include "src/factory.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/list-inl.h" #include "src/list.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
namespace v8 { namespace v8 {

View File

@ -6,7 +6,6 @@
#define V8_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ #define V8_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_
#include "src/arm/assembler-arm.h" #include "src/arm/assembler-arm.h"
#include "src/arm/assembler-arm-inl.h"
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
namespace v8 { namespace v8 {

View File

@ -7,11 +7,10 @@
#include <vector> #include <vector>
#include "src/arm64/assembler-arm64.h"
#include "src/bailout-reason.h" #include "src/bailout-reason.h"
#include "src/globals.h"
#include "src/arm64/assembler-arm64-inl.h"
#include "src/base/bits.h" #include "src/base/bits.h"
#include "src/globals.h"
// Simulator specific helpers. // Simulator specific helpers.
#if USE_SIMULATOR #if USE_SIMULATOR

View File

@ -5,10 +5,8 @@
#ifndef V8_ARM64_REGEXP_MACRO_ASSEMBLER_ARM64_H_ #ifndef V8_ARM64_REGEXP_MACRO_ASSEMBLER_ARM64_H_
#define V8_ARM64_REGEXP_MACRO_ASSEMBLER_ARM64_H_ #define V8_ARM64_REGEXP_MACRO_ASSEMBLER_ARM64_H_
#include "src/macro-assembler.h"
#include "src/arm64/assembler-arm64.h" #include "src/arm64/assembler-arm64.h"
#include "src/arm64/assembler-arm64-inl.h" #include "src/macro-assembler.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -38,17 +38,19 @@
#include "src/allocation.h" #include "src/allocation.h"
#include "src/builtins.h" #include "src/builtins.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/runtime/runtime.h" #include "src/runtime/runtime.h"
#include "src/token.h" #include "src/token.h"
namespace v8 { namespace v8 {
// Forward declarations.
class ApiFunction; class ApiFunction;
namespace internal { namespace internal {
// Forward declarations.
class StatsCounter; class StatsCounter;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Platform independent assembler base class. // Platform independent assembler base class.

View File

@ -13,7 +13,7 @@
#include "src/factory.h" #include "src/factory.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/jsregexp.h" #include "src/jsregexp.h"
#include "src/list-inl.h" #include "src/list.h"
#include "src/modules.h" #include "src/modules.h"
#include "src/runtime/runtime.h" #include "src/runtime/runtime.h"
#include "src/small-pointer-list.h" #include "src/small-pointer-list.h"

View File

@ -13,6 +13,7 @@ namespace internal {
// Unicode character predicates as defined by ECMA-262, 3rd, // Unicode character predicates as defined by ECMA-262, 3rd,
// used for lexical analysis. // used for lexical analysis.
inline int AsciiAlphaToLower(uc32 c);
inline bool IsCarriageReturn(uc32 c); inline bool IsCarriageReturn(uc32 c);
inline bool IsLineFeed(uc32 c); inline bool IsLineFeed(uc32 c);
inline bool IsAsciiIdentifier(uc32 c); inline bool IsAsciiIdentifier(uc32 c);

View File

@ -5,6 +5,7 @@
#include "src/compiler/common-node-cache.h" #include "src/compiler/common-node-cache.h"
#include "src/assembler.h" #include "src/assembler.h"
#include "src/compiler/node.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -4,6 +4,7 @@
#include "src/base/functional.h" #include "src/base/functional.h"
#include "src/compiler/frame-states.h" #include "src/compiler/frame-states.h"
#include "src/handles-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -5,10 +5,15 @@
#ifndef V8_COMPILER_FRAME_STATES_H_ #ifndef V8_COMPILER_FRAME_STATES_H_
#define V8_COMPILER_FRAME_STATES_H_ #define V8_COMPILER_FRAME_STATES_H_
#include "src/handles-inl.h" #include "src/handles.h"
#include "src/utils.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
// Forward declarations.
class SharedFunctionInfo;
namespace compiler { namespace compiler {
// Flag that describes how to combine the current environment with // Flag that describes how to combine the current environment with

View File

@ -33,6 +33,9 @@ ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator,
last_processed_code_event_id_(0) {} last_processed_code_event_id_(0) {}
ProfilerEventsProcessor::~ProfilerEventsProcessor() {}
void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) { void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) {
event.generic.order = ++last_code_event_id_; event.generic.order = ++last_code_event_id_;
events_buffer_.Enqueue(event); events_buffer_.Enqueue(event);

View File

@ -11,7 +11,7 @@
#include "src/circular-queue.h" #include "src/circular-queue.h"
#include "src/compiler.h" #include "src/compiler.h"
#include "src/sampler.h" #include "src/sampler.h"
#include "src/unbound-queue-inl.h" #include "src/unbound-queue.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
@ -129,7 +129,7 @@ class ProfilerEventsProcessor : public base::Thread {
ProfilerEventsProcessor(ProfileGenerator* generator, ProfilerEventsProcessor(ProfileGenerator* generator,
Sampler* sampler, Sampler* sampler,
base::TimeDelta period); base::TimeDelta period);
virtual ~ProfilerEventsProcessor() {} virtual ~ProfilerEventsProcessor();
// Thread control. // Thread control.
virtual void Run(); virtual void Run();

View File

@ -15,6 +15,10 @@
#include "src/d8.h" #include "src/d8.h"
#ifndef V8_SHARED
#include "src/list-inl.h"
#endif
#if !V8_OS_NACL #if !V8_OS_NACL
#include <sys/select.h> #include <sys/select.h>
#endif #endif

View File

@ -7,9 +7,9 @@
#ifndef V8_SHARED #ifndef V8_SHARED
#include "src/allocation.h" #include "src/allocation.h"
#include "src/base/platform/time.h"
#include "src/hashmap.h" #include "src/hashmap.h"
#include "src/list.h" #include "src/list.h"
#include "src/objects-inl.h"
#else #else
#include "include/v8.h" #include "include/v8.h"
#include "src/base/compiler-specific.h" #include "src/base/compiler-specific.h"

View File

@ -5,6 +5,7 @@
#ifndef V8_DATEPARSER_INL_H_ #ifndef V8_DATEPARSER_INL_H_
#define V8_DATEPARSER_INL_H_ #define V8_DATEPARSER_INL_H_
#include "src/char-predicates-inl.h"
#include "src/dateparser.h" #include "src/dateparser.h"
namespace v8 { namespace v8 {

View File

@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "src/v8.h"
#include "src/dateparser.h" #include "src/dateparser.h"
#include "src/char-predicates-inl.h"
#include "src/objects-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -6,7 +6,8 @@
#define V8_DATEPARSER_H_ #define V8_DATEPARSER_H_
#include "src/allocation.h" #include "src/allocation.h"
#include "src/char-predicates-inl.h" #include "src/char-predicates.h"
#include "src/scanner.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -16,6 +16,7 @@
#include "src/objects.h" #include "src/objects.h"
#include "src/ostreams.h" #include "src/ostreams.h"
#include "src/snapshot/natives.h" #include "src/snapshot/natives.h"
#include "src/splay-tree-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -186,5 +186,8 @@ void HeapProfiler::ClearHeapObjectMap() {
} }
Heap* HeapProfiler::heap() const { return ids_->heap(); }
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -6,13 +6,16 @@
#define V8_HEAP_PROFILER_H_ #define V8_HEAP_PROFILER_H_
#include "src/base/smart-pointers.h" #include "src/base/smart-pointers.h"
#include "src/heap-snapshot-generator-inl.h"
#include "src/isolate.h" #include "src/isolate.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
// Forward declarations.
class AllocationTracker;
class HeapObjectsMap;
class HeapSnapshot; class HeapSnapshot;
class StringsStorage;
class HeapProfiler { class HeapProfiler {
public: public:
@ -63,7 +66,7 @@ class HeapProfiler {
void ClearHeapObjectMap(); void ClearHeapObjectMap();
private: private:
Heap* heap() const { return ids_->heap(); } Heap* heap() const;
// Mapping from HeapObject addresses to objects' uids. // Mapping from HeapObject addresses to objects' uids.
base::SmartPointer<HeapObjectsMap> ids_; base::SmartPointer<HeapObjectsMap> ids_;

View File

@ -8,6 +8,7 @@
#include <cmath> #include <cmath>
#include "src/base/platform/platform.h" #include "src/base/platform/platform.h"
#include "src/counters.h"
#include "src/heap/heap.h" #include "src/heap/heap.h"
#include "src/heap/incremental-marking-inl.h" #include "src/heap/incremental-marking-inl.h"
#include "src/heap/spaces-inl.h" #include "src/heap/spaces-inl.h"

View File

@ -10,7 +10,6 @@
#include "src/allocation.h" #include "src/allocation.h"
#include "src/assert-scope.h" #include "src/assert-scope.h"
#include "src/counters.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/heap/gc-idle-time-handler.h" #include "src/heap/gc-idle-time-handler.h"
#include "src/heap/gc-tracer.h" #include "src/heap/gc-tracer.h"
@ -21,7 +20,6 @@
#include "src/heap/spaces.h" #include "src/heap/spaces.h"
#include "src/heap/store-buffer.h" #include "src/heap/store-buffer.h"
#include "src/list.h" #include "src/list.h"
#include "src/splay-tree-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -6,7 +6,6 @@
#define V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ #define V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_
#include "src/ia32/assembler-ia32.h" #include "src/ia32/assembler-ia32.h"
#include "src/ia32/assembler-ia32-inl.h"
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
namespace v8 { namespace v8 {

View File

@ -68,6 +68,7 @@ class MaterializedObjectStore;
class CodeAgingHelper; class CodeAgingHelper;
class RegExpStack; class RegExpStack;
class SaveContext; class SaveContext;
class StatsTable;
class StringTracker; class StringTracker;
class StubCache; class StubCache;
class SweeperThread; class SweeperThread;

View File

@ -5,7 +5,7 @@
#ifndef V8_JSON_PARSER_H_ #ifndef V8_JSON_PARSER_H_
#define V8_JSON_PARSER_H_ #define V8_JSON_PARSER_H_
#include "src/char-predicates-inl.h" #include "src/char-predicates.h"
#include "src/conversions.h" #include "src/conversions.h"
#include "src/messages.h" #include "src/messages.h"
#include "src/token.h" #include "src/token.h"

View File

@ -20,6 +20,7 @@
#include "src/regexp-macro-assembler-tracer.h" #include "src/regexp-macro-assembler-tracer.h"
#include "src/regexp-stack.h" #include "src/regexp-stack.h"
#include "src/runtime/runtime.h" #include "src/runtime/runtime.h"
#include "src/splay-tree-inl.h"
#include "src/string-search.h" #include "src/string-search.h"
#include "src/unicode-decoder.h" #include "src/unicode-decoder.h"

View File

@ -2,12 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ #ifndef V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_
#define V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ #define V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/mips/assembler-mips-inl.h"
#include "src/mips/assembler-mips.h" #include "src/mips/assembler-mips.h"
#include "src/mips/macro-assembler-mips.h" #include "src/mips/macro-assembler-mips.h"

View File

@ -2,12 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ #ifndef V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_
#define V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ #define V8_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/mips64/assembler-mips64-inl.h"
#include "src/mips64/assembler-mips64.h" #include "src/mips64/assembler-mips64.h"
#include "src/mips64/macro-assembler-mips64.h" #include "src/mips64/macro-assembler-mips64.h"

View File

@ -7,7 +7,6 @@
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/ppc/assembler-ppc.h" #include "src/ppc/assembler-ppc.h"
#include "src/ppc/assembler-ppc-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -12,6 +12,7 @@
#include "src/global-handles.h" #include "src/global-handles.h"
#include "src/sampler.h" #include "src/sampler.h"
#include "src/scopeinfo.h" #include "src/scopeinfo.h"
#include "src/splay-tree-inl.h"
#include "src/unicode.h" #include "src/unicode.h"
namespace v8 { namespace v8 {
@ -377,6 +378,9 @@ void CpuProfile::Print() {
} }
CodeMap::~CodeMap() {}
const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL; const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL;

View File

@ -266,6 +266,7 @@ class CpuProfile {
class CodeMap { class CodeMap {
public: public:
CodeMap() {} CodeMap() {}
~CodeMap();
void AddCode(Address addr, CodeEntry* entry, unsigned size); void AddCode(Address addr, CodeEntry* entry, unsigned size);
void MoveCode(Address from, Address to); void MoveCode(Address from, Address to);
CodeEntry* FindEntry(Address addr, Address* start = NULL); CodeEntry* FindEntry(Address addr, Address* start = NULL);

View File

@ -9,7 +9,6 @@
#include "src/factory.h" #include "src/factory.h"
#include "src/field-index.h" #include "src/field-index.h"
#include "src/field-index-inl.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/types.h" #include "src/types.h"

View File

@ -5,6 +5,7 @@
#include "src/v8.h" #include "src/v8.h"
#include "src/arguments.h" #include "src/arguments.h"
#include "src/char-predicates-inl.h"
#include "src/json-parser.h" #include "src/json-parser.h"
#include "src/json-stringifier.h" #include "src/json-stringifier.h"
#include "src/runtime/runtime-utils.h" #include "src/runtime/runtime-utils.h"

View File

@ -14,7 +14,7 @@
#include "src/hashmap.h" #include "src/hashmap.h"
#include "src/list.h" #include "src/list.h"
#include "src/token.h" #include "src/token.h"
#include "src/unicode-inl.h" #include "src/unicode.h"
#include "src/unicode-decoder.h" #include "src/unicode-decoder.h"
#include "src/utils.h" #include "src/utils.h"

View File

@ -4,6 +4,8 @@
#include "src/string-builder.h" #include "src/string-builder.h"
#include "src/objects-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -5,7 +5,11 @@
#ifndef V8_STRING_BUILDER_H_ #ifndef V8_STRING_BUILDER_H_
#define V8_STRING_BUILDER_H_ #define V8_STRING_BUILDER_H_
#include "src/objects-inl.h" #include "src/assert-scope.h"
#include "src/factory.h"
#include "src/handles.h"
#include "src/isolate.h"
#include "src/objects.h"
#include "src/utils.h" #include "src/utils.h"
namespace v8 { namespace v8 {

View File

@ -9,6 +9,7 @@
#include "src/ostreams.h" #include "src/ostreams.h"
#include "src/parser.h" // for CompileTimeValue; TODO(rossberg): should move #include "src/parser.h" // for CompileTimeValue; TODO(rossberg): should move
#include "src/scopes.h" #include "src/scopes.h"
#include "src/splay-tree-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {

View File

@ -8,7 +8,7 @@
#include <ostream> // NOLINT(readability/streams) #include <ostream> // NOLINT(readability/streams)
#include "src/base/functional.h" #include "src/base/functional.h"
#include "src/handles-inl.h" // TODO(everyone): Fix our inl.h crap #include "src/handles.h"
#include "src/objects-inl.h" // TODO(everyone): Fix our inl.h crap #include "src/objects-inl.h" // TODO(everyone): Fix our inl.h crap
#include "src/utils.h" #include "src/utils.h"
#include "src/zone.h" #include "src/zone.h"

View File

@ -6,7 +6,6 @@
#define V8_X64_REGEXP_MACRO_ASSEMBLER_X64_H_ #define V8_X64_REGEXP_MACRO_ASSEMBLER_X64_H_
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/x64/assembler-x64-inl.h"
#include "src/x64/assembler-x64.h" #include "src/x64/assembler-x64.h"
#include "src/x64/macro-assembler-x64.h" #include "src/x64/macro-assembler-x64.h"

View File

@ -6,7 +6,6 @@
#define V8_X87_REGEXP_MACRO_ASSEMBLER_X87_H_ #define V8_X87_REGEXP_MACRO_ASSEMBLER_X87_H_
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/x87/assembler-x87-inl.h"
#include "src/x87/assembler-x87.h" #include "src/x87/assembler-x87.h"
namespace v8 { namespace v8 {

View File

@ -602,28 +602,6 @@ static inline void EmptyMessageQueues(v8::Isolate* isolate) {
} }
// Helper class for new allocations tracking and checking.
// To use checking of JS allocations tracking in a test,
// just create an instance of this class.
class HeapObjectsTracker {
public:
HeapObjectsTracker() {
heap_profiler_ = i::Isolate::Current()->heap_profiler();
CHECK_NOT_NULL(heap_profiler_);
heap_profiler_->StartHeapObjectsTracking(true);
}
~HeapObjectsTracker() {
i::Isolate::Current()->heap()->CollectAllAvailableGarbage();
CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects());
heap_profiler_->StopHeapObjectsTracking();
}
private:
i::HeapProfiler* heap_profiler_;
};
class InitializedHandleScope { class InitializedHandleScope {
public: public:
InitializedHandleScope() InitializedHandleScope()

View File

@ -36,6 +36,7 @@
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/hashmap.h" #include "src/hashmap.h"
#include "src/heap-profiler.h" #include "src/heap-profiler.h"
#include "src/heap-snapshot-generator-inl.h"
#include "test/cctest/cctest.h" #include "test/cctest/cctest.h"
using i::AllocationTraceNode; using i::AllocationTraceNode;

View File

@ -37,6 +37,7 @@
#include "src/parser.h" #include "src/parser.h"
#include "src/regexp-macro-assembler.h" #include "src/regexp-macro-assembler.h"
#include "src/regexp-macro-assembler-irregexp.h" #include "src/regexp-macro-assembler-irregexp.h"
#include "src/splay-tree-inl.h"
#include "src/string-stream.h" #include "src/string-stream.h"
#ifdef V8_INTERPRETED_REGEXP #ifdef V8_INTERPRETED_REGEXP
#include "src/interpreter-irregexp.h" #include "src/interpreter-irregexp.h"

19
tools/check-inline-includes.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# Copyright 2015 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.
v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
headers=$(find "$v8_root/src" -name '*.h' -not -name '*-inl.h')
for header in $headers; do
inline_header_include=$(grep '#include ".*-inl.h"' "$header")
if [ -n "$inline_header_include" ]; then
echo "The following non-inline header seems to include an inline header:"
echo " Header : $header"
echo " Include: $inline_header_include"
echo
fi
done
echo "Kthxbye."