Commit c26965bd authored by Dan Elphick's avatar Dan Elphick Committed by V8 LUCI CQ

[build] Reduce size of inline header cycles

This removes/replaces header includes with the aim of shrinking the
size of the inline header cycle. Specifically before this CL, there was
a single Strongly-Connected Component comprising 60 header files from
src/objects and src/heap.

Now there are two 2 SCCs. The src/heap SCC has 6 files and depends on
the src/objects SCC, which has 50 files. Additionally some previously
implicit dependencies have been added.

Dependencies calculated using:
git grep "#include \"" *.h *.cc | sed 's/:#include "/ /;s/".*$//' | \
awk 'BEGIN {print "digraph deps {" } END {print "}"} {print "\""$1"\" -> \""$2"\""}'

SCCs found using sccmap from graphviz.

Also removes unused Cell::FromValueAddress method.

Change-Id: Ib19d00ccd14e490ee64d57be4d99b1b3686ac32a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2951734Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75103}
parent 930fb646
......@@ -9,6 +9,7 @@
#include "src/execution/interrupts-scope.h"
#include "src/execution/microtask-queue.h"
#include "src/handles/handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/objects/foreign-inl.h"
#include "src/objects/js-weak-refs.h"
#include "src/objects/objects-inl.h"
......
......@@ -7,6 +7,7 @@
#include "src/api/api-inl.h"
#include "src/common/message-template.h"
#include "src/execution/isolate-inl.h"
#include "src/heap/heap-inl.h"
#include "src/logging/runtime-call-stats-scope.h"
#include "src/objects/api-callbacks.h"
#include "src/objects/hash-table-inl.h"
......
......@@ -14,6 +14,7 @@
#include "src/codegen/compiler.h"
#include "src/execution/isolate.h"
#include "src/heap/factory-inl.h"
#include "src/heap/heap-inl.h"
#include "src/objects/fixed-array-inl.h"
#include "src/objects/js-function-inl.h"
......
......@@ -31,6 +31,7 @@
#include "src/objects/code.h"
#include "src/objects/heap-object.h"
#include "src/objects/instance-type.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/shared-function-info-inl.h"
#include "src/roots/roots.h"
......
......@@ -11,6 +11,7 @@
#include "src/compiler/code-assembler.h"
#include "src/execution/isolate.h"
#include "src/handles/handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/init/setup-isolate.h"
#include "src/interpreter/bytecodes.h"
#include "src/interpreter/interpreter-generator.h"
......
......@@ -2,16 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <ostream>
#include "src/compiler/access-info.h"
#include <ostream>
#include "src/builtins/accessors.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/compilation-dependency.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/type-cache.h"
#include "src/ic/call-optimization.h"
#include "src/ic/handler-configuration.h"
#include "src/logging/counters.h"
#include "src/objects/cell-inl.h"
#include "src/objects/field-index-inl.h"
......
......@@ -15,9 +15,11 @@
#include "src/compiler/graph-reducer.h"
#include "src/compiler/js-heap-broker.h"
#include "src/execution/protectors-inl.h"
#include "src/objects/allocation-site-inl.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/heap-number-inl.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/property-cell.h"
#include "src/objects/template-objects-inl.h"
......
......@@ -11,10 +11,14 @@
#include "src/codegen/code-factory.h"
#include "src/codegen/optimized-compilation-info.h"
#include "src/handles/handles-inl.h"
#include "src/ic/handler-configuration.h"
#include "src/heap/heap-inl.h"
#include "src/ic/handler-configuration-inl.h"
#include "src/init/bootstrapper.h"
#include "src/objects/allocation-site-inl.h"
#include "src/objects/data-handler-inl.h"
#include "src/objects/feedback-cell.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/oddball.h"
#include "src/objects/property-cell.h"
......
......@@ -34,6 +34,7 @@
#include "src/base/platform/wrappers.h"
#include "src/base/sanitizer/msan.h"
#include "src/base/sys-info.h"
#include "src/base/utils/random-number-generator.h"
#include "src/d8/d8-console.h"
#include "src/d8/d8-platforms.h"
#include "src/d8/d8.h"
......
......@@ -5,6 +5,7 @@
#include "src/debug/debug-interface.h"
#include "src/api/api-inl.h"
#include "src/base/utils/random-number-generator.h"
#include "src/debug/debug-coverage.h"
#include "src/debug/debug-evaluate.h"
#include "src/debug/debug-property-iterator.h"
......@@ -13,6 +14,7 @@
#include "src/execution/vm-state-inl.h"
#include "src/objects/js-generator-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/profiler/heap-profiler.h"
#include "src/regexp/regexp-stack.h"
#include "src/strings/string-builder-inl.h"
......
......@@ -15,6 +15,7 @@
#include "src/execution/pointer-authentication.h"
#include "src/execution/v8threads.h"
#include "src/handles/handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/logging/counters.h"
#include "src/logging/log.h"
#include "src/logging/runtime-call-stats-scope.h"
......
......@@ -5,6 +5,7 @@
#include "src/deoptimizer/materialized-object-store.h"
#include "src/execution/isolate.h"
#include "src/heap/heap-inl.h"
#include "src/objects/fixed-array-inl.h"
#include "src/objects/oddball.h"
......
......@@ -11,6 +11,7 @@
#include "src/execution/isolate-utils-inl.h"
#include "src/heap/heap-inl.h" // For InOldSpace.
#include "src/heap/heap-write-barrier-inl.h" // For GetIsolateFromWritableObj.
#include "src/ic/handler-configuration-inl.h"
#include "src/init/bootstrapper.h"
#include "src/interpreter/bytecodes.h"
#include "src/objects/all-objects-inl.h"
......
......@@ -6,7 +6,6 @@
#define V8_EXECUTION_ISOLATE_INL_H_
#include "src/execution/isolate.h"
#include "src/objects/cell-inl.h"
#include "src/objects/contexts-inl.h"
#include "src/objects/js-function.h"
#include "src/objects/objects-inl.h"
......
......@@ -14,6 +14,7 @@
#include "src/base/sanitizer/asan.h"
#include "src/execution/vm-state-inl.h"
#include "src/heap/embedder-tracing.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/init/v8.h"
#include "src/logging/counters.h"
......
......@@ -10,6 +10,7 @@
#include "src/heap/concurrent-allocator.h"
#include "src/heap/heap.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/local-heap.h"
#include "src/heap/spaces-inl.h"
#include "src/heap/spaces.h"
#include "src/objects/heap-object.h"
......
......@@ -19,6 +19,7 @@
#include "src/execution/isolate-data.h"
#include "src/execution/isolate.h"
#include "src/heap/code-object-registry.h"
#include "src/heap/concurrent-allocator-inl.h"
#include "src/heap/heap-write-barrier.h"
#include "src/heap/heap.h"
#include "src/heap/large-spaces.h"
......@@ -31,17 +32,14 @@
#include "src/heap/spaces-inl.h"
#include "src/heap/third-party/heap-api.h"
#include "src/objects/allocation-site-inl.h"
#include "src/objects/api-callbacks-inl.h"
#include "src/objects/cell-inl.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/feedback-cell-inl.h"
#include "src/objects/feedback-vector.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/oddball.h"
#include "src/objects/property-cell.h"
#include "src/objects/scope-info.h"
#include "src/objects/script-inl.h"
#include "src/objects/slots-inl.h"
#include "src/objects/struct-inl.h"
#include "src/profiler/heap-profiler.h"
......
......@@ -8,6 +8,7 @@
#include "src/execution/local-isolate.h"
#include "src/handles/handles.h"
#include "src/heap/concurrent-allocator-inl.h"
#include "src/heap/local-heap-inl.h"
#include "src/numbers/hash-seed-inl.h"
#include "src/objects/fixed-array.h"
#include "src/objects/heap-object.h"
......
......@@ -10,6 +10,7 @@
#include "src/heap/heap.h"
#include "src/heap/new-spaces.h"
#include "src/heap/spaces-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/tagged-impl.h"
namespace v8 {
......
......@@ -9,6 +9,7 @@
#include "src/heap/mark-compact.h"
#include "src/heap/objects-visiting.h"
#include "src/objects/arguments.h"
#include "src/objects/data-handler-inl.h"
#include "src/objects/free-space-inl.h"
#include "src/objects/js-weak-refs-inl.h"
#include "src/objects/module-inl.h"
......
......@@ -9,7 +9,6 @@
#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/paged-spaces.h"
#include "src/objects/code-inl.h"
#include "src/objects/heap-object.h"
#include "src/objects/objects-inl.h"
......
......@@ -15,7 +15,6 @@
#include "src/heap/new-spaces.h"
#include "src/heap/paged-spaces.h"
#include "src/heap/spaces.h"
#include "src/objects/code-inl.h"
namespace v8 {
namespace internal {
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include 'src/ic/handler-configuration-inl.h'
extern class LoadHandler extends DataHandler;
extern class StoreHandler extends DataHandler;
......@@ -20,10 +20,6 @@ namespace internal {
TQ_OBJECT_CONSTRUCTORS_IMPL(Cell)
Cell Cell::FromValueAddress(Address value) {
return Cell::cast(HeapObject::FromAddress(value - kValueOffset));
}
} // namespace internal
} // namespace v8
......
......@@ -17,8 +17,6 @@ namespace internal {
class Cell : public TorqueGeneratedCell<Cell, HeapObject> {
public:
static inline Cell FromValueAddress(Address value);
inline Address ValueAddress() { return address() + kValueOffset; }
using BodyDescriptor = FixedBodyDescriptor<kValueOffset, kSize, kSize>;
......
......@@ -6,7 +6,6 @@
#define V8_OBJECTS_FEEDBACK_VECTOR_INL_H_
#include "src/common/globals.h"
#include "src/heap/factory-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/code-inl.h"
#include "src/objects/feedback-cell-inl.h"
......@@ -14,6 +13,7 @@
#include "src/objects/maybe-object-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/smi.h"
#include "src/roots/roots-inl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
......@@ -328,15 +328,15 @@ ForInHint ForInHintFromFeedback(ForInFeedback type_feedback) {
}
Handle<Symbol> FeedbackVector::UninitializedSentinel(Isolate* isolate) {
return isolate->factory()->uninitialized_symbol();
return ReadOnlyRoots(isolate).uninitialized_symbol_handle();
}
Handle<Symbol> FeedbackVector::MegamorphicSentinel(Isolate* isolate) {
return isolate->factory()->megamorphic_symbol();
return ReadOnlyRoots(isolate).megamorphic_symbol_handle();
}
Handle<Symbol> FeedbackVector::MegaDOMSentinel(Isolate* isolate) {
return isolate->factory()->mega_dom_symbol();
return ReadOnlyRoots(isolate).mega_dom_symbol_handle();
}
Symbol FeedbackVector::RawUninitializedSentinel(Isolate* isolate) {
......
......@@ -7,6 +7,7 @@
#include "src/objects/descriptor-array-inl.h"
#include "src/objects/field-index.h"
#include "src/objects/map-inl.h"
#include "src/objects/objects-inl.h"
namespace v8 {
......
......@@ -12,7 +12,6 @@
#include "src/numbers/conversions.h"
#include "src/objects/bigint.h"
#include "src/objects/compressed-slots.h"
#include "src/objects/heap-number-inl.h"
#include "src/objects/map.h"
#include "src/objects/maybe-object-inl.h"
#include "src/objects/objects-inl.h"
......
......@@ -5,9 +5,10 @@
#ifndef V8_OBJECTS_INSTANCE_TYPE_INL_H_
#define V8_OBJECTS_INSTANCE_TYPE_INL_H_
#include "src/base/bounds.h"
#include "src/execution/isolate-utils-inl.h"
#include "src/objects/instance-type.h"
#include "src/objects/map-inl.h"
#include "src/utils/utils.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
......
......@@ -12,11 +12,10 @@
// clang-format from merging that include into the following ones).
#include "src/codegen/compiler.h"
#include "src/diagnostics/code-tracer.h"
#include "src/heap/heap-inl.h"
#include "src/ic/ic.h"
#include "src/init/bootstrapper.h"
#include "src/objects/feedback-cell-inl.h"
#include "src/strings/string-builder-inl.h"
#include "src/objects/shared-function-info-inl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
......
......@@ -5,8 +5,9 @@
#ifndef V8_OBJECTS_JS_PROXY_INL_H_
#define V8_OBJECTS_JS_PROXY_INL_H_
#include "src/objects/instance-type-inl.h"
#include "src/objects/js-objects-inl.h"
#include "src/objects/js-proxy.h"
#include "src/objects/objects-inl.h" // Needed for write barriers
// Has to be the last include (doesn't have include guards):
......
......@@ -6,8 +6,8 @@
#define V8_OBJECTS_LOOKUP_CACHE_INL_H_
#include "src/objects/lookup-cache.h"
#include "src/objects/objects-inl.h"
#include "src/objects/map.h"
#include "src/objects/name-inl.h"
namespace v8 {
namespace internal {
......
......@@ -8,9 +8,7 @@
#include "src/objects/module.h"
#include "src/objects/objects-inl.h" // Needed for write barriers
#include "src/objects/scope-info.h"
#include "src/objects/source-text-module-inl.h"
#include "src/objects/source-text-module.h"
#include "src/objects/string-inl.h"
#include "src/objects/synthetic-module.h"
// Has to be the last include (doesn't have include guards):
......
......@@ -21,7 +21,7 @@
#include "src/heap/factory.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/heap/read-only-heap-inl.h"
#include "src/numbers/conversions.h"
#include "src/numbers/conversions-inl.h"
#include "src/numbers/double.h"
#include "src/objects/bigint.h"
#include "src/objects/heap-number-inl.h"
......@@ -35,7 +35,6 @@
#include "src/objects/property-details.h"
#include "src/objects/property.h"
#include "src/objects/regexp-match-info.h"
#include "src/objects/scope-info-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/slots-inl.h"
#include "src/objects/smi-inl.h"
......
......@@ -10,7 +10,6 @@
#include "src/handles/handles.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/string-inl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
......
......@@ -9,16 +9,16 @@
#include "src/base/platform/mutex.h"
#include "src/handles/handles-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/heap/local-heap-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/feedback-vector-inl.h"
#include "src/objects/scope-info.h"
#include "src/objects/scope-info-inl.h"
#include "src/objects/script-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/templates.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-objects-inl.h"
#include "src/wasm/wasm-objects.h"
#endif // V8_ENABLE_WEBASSEMBLY
// Has to be the last include (doesn't have include guards):
......
......@@ -12,7 +12,6 @@
#include "src/execution/isolate-utils.h"
#include "src/handles/handles-inl.h"
#include "src/heap/factory.h"
#include "src/numbers/conversions-inl.h"
#include "src/numbers/hash-seed-inl.h"
#include "src/objects/name-inl.h"
#include "src/objects/smi-inl.h"
......@@ -771,13 +770,6 @@ inline Vector<const uc16> String::GetCharVector(
return flat.ToUC16Vector();
}
uint32_t String::ToValidIndex(Object number) {
uint32_t index = PositiveNumberToUint32(number);
uint32_t length_value = static_cast<uint32_t>(length());
if (index > length_value) return length_value;
return index;
}
uint8_t SeqOneByteString::Get(int index) const {
DCHECK(!SharedStringAccessGuardIfNeeded::IsNeeded(*this));
return Get(index, SharedStringAccessGuardIfNeeded::NotNeeded());
......
......@@ -949,6 +949,17 @@ ComparisonResult String::Compare(Isolate* isolate, Handle<String> x,
return result;
}
namespace {
uint32_t ToValidIndex(String str, Object number) {
uint32_t index = PositiveNumberToUint32(number);
uint32_t length_value = static_cast<uint32_t>(str.length());
if (index > length_value) return length_value;
return index;
}
} // namespace
Object String::IndexOf(Isolate* isolate, Handle<Object> receiver,
Handle<Object> search, Handle<Object> position) {
if (receiver->IsNullOrUndefined(isolate)) {
......@@ -968,7 +979,7 @@ Object String::IndexOf(Isolate* isolate, Handle<Object> receiver,
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, position,
Object::ToInteger(isolate, position));
uint32_t index = receiver_string->ToValidIndex(*position);
uint32_t index = ToValidIndex(*receiver_string, *position);
return Smi::FromInt(
String::IndexOf(isolate, receiver_string, search_string, index));
}
......@@ -1241,7 +1252,7 @@ Object String::LastIndexOf(Isolate* isolate, Handle<Object> receiver,
} else {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, position,
Object::ToInteger(isolate, position));
start_index = receiver_string->ToValidIndex(*position);
start_index = ToValidIndex(*receiver_string, *position);
}
uint32_t pattern_length = search_string->length();
......
......@@ -392,7 +392,6 @@ class String : public TorqueGeneratedString<String, Name> {
// if 0 <= val <= INT_MAX, returns val
static int32_t ToArrayIndex(Address addr);
uint32_t inline ToValidIndex(Object number);
// "integer index": the string is the decimal representation of an
// integer in the range of a size_t. Useful for TypedArray accesses.
inline bool AsIntegerIndex(size_t* index);
......
......@@ -5,6 +5,7 @@
// Only including the -inl.h file directly makes the linter complain.
#include "src/objects/swiss-name-dictionary.h"
#include "src/heap/heap-inl.h"
#include "src/objects/swiss-name-dictionary-inl.h"
namespace v8 {
......
......@@ -5,7 +5,6 @@
#ifndef V8_OBJECTS_TRANSITIONS_INL_H_
#define V8_OBJECTS_TRANSITIONS_INL_H_
#include "src/ic/handler-configuration-inl.h"
#include "src/objects/fixed-array-inl.h"
#include "src/objects/maybe-object-inl.h"
#include "src/objects/slots.h"
......
......@@ -6,6 +6,7 @@
#include "src/base/platform/mutex.h"
#include "src/execution/arguments-inl.h"
#include "src/execution/frames-inl.h"
#include "src/heap/heap-inl.h"
#include "src/logging/counters.h"
#include "src/objects/smi.h"
#include "src/runtime/runtime-utils.h"
......
......@@ -7,10 +7,12 @@
#include "src/strings/string-hasher.h"
// Comment inserted to prevent header reordering.
#include <type_traits>
#include "src/objects/name-inl.h"
#include "src/objects/objects.h"
#include "src/objects/string-inl.h"
#include "src/objects/string.h"
#include "src/strings/char-predicates-inl.h"
#include "src/utils/utils-inl.h"
......
......@@ -9,13 +9,11 @@
#ifndef V8_WASM_WASM_OBJECTS_INL_H_
#define V8_WASM_WASM_OBJECTS_INL_H_
#include "src/wasm/wasm-objects.h"
#include "src/base/memory.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/contexts-inl.h"
#include "src/objects/foreign-inl.h"
#include "src/objects/heap-number-inl.h"
#include "src/objects/foreign.h"
#include "src/objects/heap-number.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/js-function-inl.h"
#include "src/objects/js-objects-inl.h"
......@@ -25,6 +23,7 @@
#include "src/roots/roots.h"
#include "src/wasm/wasm-code-manager.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-objects.h"
// Has to be the last include (doesn't have include guards)
#include "src/objects/object-macros.h"
......
......@@ -7,6 +7,8 @@
#include "src/execution/isolate.h"
#include "src/heap/factory.h"
#include "src/heap/heap-inl.h"
#include "src/ic/handler-configuration.h"
#include "src/objects/data-handler-inl.h"
#include "src/objects/smi.h"
#include "test/cctest/cctest.h"
#include "test/cctest/heap/heap-tester.h"
......
......@@ -4,6 +4,7 @@
#include <bitset>
#include "src/base/utils/random-number-generator.h"
#include "src/codegen/assembler-inl.h"
#include "src/codegen/macro-assembler-inl.h"
#include "src/execution/simulator.h"
......
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