Commit 099d50f4 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[compiler] Refactor compilation dependencies

- Move the compilation-dependency.h header contents into
  compilation-dependencies.cc;
- add macro lists to define type checks and casts;
- add invalidated dependency tracing to
  the --trace-compilation-dependencies flag (renamed from
  --trace-code-dependencies).

Bug: v8:7790
Change-Id: I34b950cd0b79b8d2673b1195599aec763f6b60d1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3129420
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76596}
parent ccece727
......@@ -2342,7 +2342,6 @@ filegroup(
"src/compiler/common-operator-reducer.h",
"src/compiler/compilation-dependencies.cc",
"src/compiler/compilation-dependencies.h",
"src/compiler/compilation-dependency.h",
"src/compiler/compiler-source-position-table.cc",
"src/compiler/compiler-source-position-table.h",
"src/compiler/constant-folding-reducer.cc",
......
......@@ -2575,7 +2575,6 @@ v8_header_set("v8_internal_headers") {
"src/compiler/common-operator-reducer.h",
"src/compiler/common-operator.h",
"src/compiler/compilation-dependencies.h",
"src/compiler/compilation-dependency.h",
"src/compiler/compiler-source-position-table.h",
"src/compiler/constant-folding-reducer.h",
"src/compiler/control-equivalence.h",
......
......@@ -8,7 +8,6 @@
#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"
......@@ -57,7 +56,8 @@ bool HasFieldRepresentationDependenciesOnMap(
ZoneVector<CompilationDependency const*>& dependencies,
Handle<Map> const& field_owner_map) {
for (auto dep : dependencies) {
if (dep->IsFieldRepresentationDependencyOnMap(field_owner_map)) {
if (CompilationDependencies::IsFieldRepresentationDependencyOnMap(
dep, field_owner_map)) {
return true;
}
}
......
This diff is collapsed.
......@@ -154,6 +154,11 @@ class V8_EXPORT_PRIVATE CompilationDependencies : public ZoneObject {
const MapRef& map, InternalIndex descriptor,
const ObjectRef& /* Contains a FieldType underneath. */ type) const;
#ifdef DEBUG
static bool IsFieldRepresentationDependencyOnMap(
const CompilationDependency* dep, const Handle<Map>& receiver_map);
#endif // DEBUG
private:
Zone* const zone_;
JSHeapBroker* const broker_;
......
// Copyright 2019 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_COMPILATION_DEPENDENCY_H_
#define V8_COMPILER_COMPILATION_DEPENDENCY_H_
#include "src/zone/zone.h"
namespace v8 {
namespace internal {
class MaybeObjectHandle;
namespace compiler {
class CompilationDependency : public ZoneObject {
public:
virtual bool IsValid() const = 0;
virtual void PrepareInstall() const {}
virtual void Install(Handle<Code> code) const = 0;
#ifdef DEBUG
virtual bool IsPretenureModeDependency() const { return false; }
virtual bool IsFieldRepresentationDependencyOnMap(
Handle<Map> const& receiver_map) const {
return false;
}
virtual bool IsConsistentJSFunctionViewDependency() const { return false; }
#endif
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_COMPILATION_DEPENDENCY_H_
......@@ -536,9 +536,9 @@ DEFINE_NEG_IMPLICATION(jitless, interpreted_frames_native_stack)
DEFINE_BOOL(assert_types, false,
"generate runtime type assertions to test the typer")
DEFINE_BOOL(trace_code_dependencies, false, "trace code dependencies")
DEFINE_BOOL(trace_compilation_dependencies, false, "trace code dependencies")
// Depend on --trace-deopt-verbose for reporting dependency invalidations.
DEFINE_IMPLICATION(trace_code_dependencies, trace_deopt_verbose)
DEFINE_IMPLICATION(trace_compilation_dependencies, trace_deopt_verbose)
#ifdef V8_ALLOCATION_SITE_TRACKING
#define V8_ALLOCATION_SITE_TRACKING_BOOL true
......
......@@ -775,7 +775,7 @@ void DependentCode::SetDependentCode(Handle<HeapObject> object,
void DependentCode::InstallDependency(Isolate* isolate, Handle<Code> code,
Handle<HeapObject> object,
DependencyGroup group) {
if (V8_UNLIKELY(FLAG_trace_code_dependencies)) {
if (V8_UNLIKELY(FLAG_trace_compilation_dependencies)) {
StdoutStream{} << "Installing dependency of [" << code->GetHeapObject()
<< "] on [" << object << "] in group ["
<< DependencyGroupName(group) << "]\n";
......
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