Commit 2f839277 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[zone-compr] Add kCompressGraphZone constant

... that controls whether the TF graph zones should support compression.

Bug: v8:9923
Change-Id: Ifbe237b75e9c92e62eb32b69d6b3b1a818269b83
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2308347
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69036}
parent 06b2e89d
......@@ -158,7 +158,7 @@ Code BuildWithCodeStubAssemblerJS(Isolate* isolate, int32_t builtin_index,
// to code targets without dereferencing their handles.
CanonicalHandleScope canonical(isolate);
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
const int argc_with_recv =
(argc == kDontAdaptArgumentsSentinel) ? 0 : argc + 1;
compiler::CodeAssemblerState state(
......@@ -180,7 +180,7 @@ Code BuildWithCodeStubAssemblerCS(Isolate* isolate, int32_t builtin_index,
// Canonicalize handles, so that we can share constant pool entries pointing
// to code targets without dereferencing their handles.
CanonicalHandleScope canonical(isolate);
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
// The interface descriptor with given key must be initialized at this point
// and this construction just queries the details from the descriptors table.
CallInterfaceDescriptor descriptor(interface_descriptor);
......
......@@ -146,7 +146,7 @@ class PipelineData {
roots_relative_addressing_enabled_(
!isolate->serializer_enabled() &&
!isolate->IsGeneratingEmbeddedBuiltins()),
graph_zone_scope_(zone_stats_, kGraphZoneName),
graph_zone_scope_(zone_stats_, kGraphZoneName, kCompressGraphZone),
graph_zone_(graph_zone_scope_.zone()),
instruction_zone_scope_(zone_stats_, kInstructionZoneName),
instruction_zone_(instruction_zone_scope_.zone()),
......@@ -194,7 +194,7 @@ class PipelineData {
may_have_unverifiable_graph_(false),
zone_stats_(zone_stats),
pipeline_statistics_(pipeline_statistics),
graph_zone_scope_(zone_stats_, kGraphZoneName),
graph_zone_scope_(zone_stats_, kGraphZoneName, kCompressGraphZone),
graph_zone_(graph_zone_scope_.zone()),
graph_(mcgraph->graph()),
source_positions_(source_positions),
......@@ -225,7 +225,7 @@ class PipelineData {
info_(info),
debug_name_(info_->GetDebugName()),
zone_stats_(zone_stats),
graph_zone_scope_(zone_stats_, kGraphZoneName),
graph_zone_scope_(zone_stats_, kGraphZoneName, kCompressGraphZone),
graph_zone_(graph_zone_scope_.zone()),
graph_(graph),
source_positions_(source_positions),
......@@ -268,7 +268,7 @@ class PipelineData {
info_(info),
debug_name_(info_->GetDebugName()),
zone_stats_(zone_stats),
graph_zone_scope_(zone_stats_, kGraphZoneName),
graph_zone_scope_(zone_stats_, kGraphZoneName, kCompressGraphZone),
instruction_zone_scope_(zone_stats_, kInstructionZoneName),
instruction_zone_(sequence->zone()),
sequence_(sequence),
......
......@@ -6687,8 +6687,8 @@ std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
//----------------------------------------------------------------------------
// Create the Graph.
//----------------------------------------------------------------------------
std::unique_ptr<Zone> zone =
std::make_unique<Zone>(wasm_engine->allocator(), ZONE_NAME);
std::unique_ptr<Zone> zone = std::make_unique<Zone>(
wasm_engine->allocator(), ZONE_NAME, kCompressGraphZone);
Graph* graph = zone->New<Graph>(zone.get());
CommonOperatorBuilder* common = zone->New<CommonOperatorBuilder>(zone.get());
MachineOperatorBuilder* machine = zone->New<MachineOperatorBuilder>(
......@@ -6881,7 +6881,7 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
"wasm.CompileWasmMathIntrinsic");
Zone zone(wasm_engine->allocator(), ZONE_NAME);
Zone zone(wasm_engine->allocator(), ZONE_NAME, kCompressGraphZone);
// Compile a Wasm function with a single bytecode and let TurboFan
// generate either inlined machine code or a call to a helper.
......@@ -6957,7 +6957,7 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
//----------------------------------------------------------------------------
// Create the Graph
//----------------------------------------------------------------------------
Zone zone(wasm_engine->allocator(), ZONE_NAME);
Zone zone(wasm_engine->allocator(), ZONE_NAME, kCompressGraphZone);
Graph* graph = zone.New<Graph>(&zone);
CommonOperatorBuilder* common = zone.New<CommonOperatorBuilder>(&zone);
MachineOperatorBuilder* machine = zone.New<MachineOperatorBuilder>(
......@@ -6998,7 +6998,7 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine* wasm_engine,
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
"wasm.CompileWasmCapiFunction");
Zone zone(wasm_engine->allocator(), ZONE_NAME);
Zone zone(wasm_engine->allocator(), ZONE_NAME, kCompressGraphZone);
// TODO(jkummerow): Extract common code into helper method.
SourcePositionTable* source_positions = nullptr;
......@@ -7046,8 +7046,8 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine* wasm_engine,
MaybeHandle<Code> CompileJSToJSWrapper(Isolate* isolate,
const wasm::FunctionSig* sig) {
std::unique_ptr<Zone> zone =
std::make_unique<Zone>(isolate->allocator(), ZONE_NAME);
std::unique_ptr<Zone> zone = std::make_unique<Zone>(
isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph* graph = zone->New<Graph>(zone.get());
CommonOperatorBuilder* common = zone->New<CommonOperatorBuilder>(zone.get());
MachineOperatorBuilder* machine = zone->New<MachineOperatorBuilder>(
......@@ -7091,8 +7091,8 @@ MaybeHandle<Code> CompileJSToJSWrapper(Isolate* isolate,
}
Handle<Code> CompileCWasmEntry(Isolate* isolate, const wasm::FunctionSig* sig) {
std::unique_ptr<Zone> zone =
std::make_unique<Zone>(isolate->allocator(), ZONE_NAME);
std::unique_ptr<Zone> zone = std::make_unique<Zone>(
isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph* graph = zone->New<Graph>(zone.get());
CommonOperatorBuilder* common = zone->New<CommonOperatorBuilder>(zone.get());
MachineOperatorBuilder* machine = zone->New<MachineOperatorBuilder>(
......@@ -7204,7 +7204,7 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
"wasm.CompileTopTier", "func_index", func_index, "body_size",
func_body.end - func_body.start);
Zone zone(wasm_engine->allocator(), ZONE_NAME);
Zone zone(wasm_engine->allocator(), ZONE_NAME, kCompressGraphZone);
MachineGraph* mcgraph = zone.New<MachineGraph>(
zone.New<Graph>(&zone), zone.New<CommonOperatorBuilder>(&zone),
zone.New<MachineOperatorBuilder>(
......
......@@ -86,8 +86,9 @@ size_t ZoneStats::GetTotalAllocatedBytes() const {
return total_deleted_bytes_ + GetCurrentAllocatedBytes();
}
Zone* ZoneStats::NewEmptyZone(const char* zone_name) {
Zone* zone = new Zone(allocator_, zone_name);
Zone* ZoneStats::NewEmptyZone(const char* zone_name,
bool support_zone_compression) {
Zone* zone = new Zone(allocator_, zone_name, support_zone_compression);
zones_.push_back(zone);
return zone;
}
......
......@@ -20,12 +20,18 @@ class V8_EXPORT_PRIVATE ZoneStats final {
public:
class Scope final {
public:
explicit Scope(ZoneStats* zone_stats, const char* zone_name)
: zone_name_(zone_name), zone_stats_(zone_stats), zone_(nullptr) {}
explicit Scope(ZoneStats* zone_stats, const char* zone_name,
bool support_zone_compression = false)
: zone_name_(zone_name),
zone_stats_(zone_stats),
zone_(nullptr),
support_zone_compression_(support_zone_compression) {}
~Scope() { Destroy(); }
Zone* zone() {
if (zone_ == nullptr) zone_ = zone_stats_->NewEmptyZone(zone_name_);
if (zone_ == nullptr)
zone_ =
zone_stats_->NewEmptyZone(zone_name_, support_zone_compression_);
return zone_;
}
void Destroy() {
......@@ -39,6 +45,7 @@ class V8_EXPORT_PRIVATE ZoneStats final {
const char* zone_name_;
ZoneStats* const zone_stats_;
Zone* zone_;
const bool support_zone_compression_;
DISALLOW_COPY_AND_ASSIGN(Scope);
};
......@@ -73,7 +80,7 @@ class V8_EXPORT_PRIVATE ZoneStats final {
size_t GetCurrentAllocatedBytes() const;
private:
Zone* NewEmptyZone(const char* zone_name);
Zone* NewEmptyZone(const char* zone_name, bool support_zone_compression);
void ReturnZone(Zone* zone);
static const size_t kMaxUnusedSize = 3;
......
......@@ -3110,7 +3110,7 @@ Handle<Code> GenerateBytecodeHandler(Isolate* isolate, const char* debug_name,
OperandScale operand_scale,
int builtin_index,
const AssemblerOptions& options) {
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
compiler::CodeAssemblerState state(
isolate, &zone, InterpreterDispatchDescriptor{}, Code::BYTECODE_HANDLER,
debug_name,
......
......@@ -39,6 +39,10 @@ constexpr size_t kZoneReservationSize = 1;
constexpr size_t kZoneReservationAlignment = 1;
#endif // V8_COMPRESS_ZONES
// The flags controlling whether zones that will be used for allocating
// TurboFan graphs should be compressed or not.
static constexpr bool kCompressGraphZone = COMPRESS_ZONES_BOOL;
} // namespace internal
} // namespace v8
......
......@@ -239,8 +239,9 @@ InitializedHandleScope::InitializedHandleScope()
InitializedHandleScope::~InitializedHandleScope() = default;
HandleAndZoneScope::HandleAndZoneScope()
: main_zone_(new i::Zone(&allocator_, ZONE_NAME)) {}
HandleAndZoneScope::HandleAndZoneScope(bool support_zone_compression)
: main_zone_(
new i::Zone(&allocator_, ZONE_NAME, support_zone_compression)) {}
HandleAndZoneScope::~HandleAndZoneScope() = default;
......
......@@ -614,7 +614,7 @@ class InitializedHandleScope {
class HandleAndZoneScope : public InitializedHandleScope {
public:
HandleAndZoneScope();
explicit HandleAndZoneScope(bool support_zone_compression = false);
~HandleAndZoneScope();
// Prefixing the below with main_ reduces a lot of naming clashes.
......
......@@ -20,7 +20,7 @@ class CodeAssemblerTester {
public:
// Test generating code for a stub. Assumes VoidDescriptor call interface.
explicit CodeAssemblerTester(Isolate* isolate, const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME),
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate),
state_(isolate, &zone_, VoidDescriptor{}, Code::STUB, name,
PoisoningMitigationLevel::kDontPoison) {}
......@@ -29,21 +29,21 @@ class CodeAssemblerTester {
CodeAssemblerTester(Isolate* isolate, int parameter_count,
Code::Kind kind = Code::BUILTIN,
const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME),
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate),
state_(isolate, &zone_, parameter_count, kind, name,
PoisoningMitigationLevel::kDontPoison) {}
CodeAssemblerTester(Isolate* isolate, Code::Kind kind,
const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME),
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate),
state_(isolate, &zone_, 0, kind, name,
PoisoningMitigationLevel::kDontPoison) {}
CodeAssemblerTester(Isolate* isolate, CallDescriptor* call_descriptor,
const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME),
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate),
state_(isolate, &zone_, call_descriptor, Code::STUB, name,
PoisoningMitigationLevel::kDontPoison, Builtins::kNoBuiltinId) {}
......
......@@ -10,6 +10,7 @@
#include "src/compiler/pipeline.h"
#include "src/compiler/raw-machine-assembler.h"
#include "src/execution/simulator.h"
#include "src/zone/zone-fwd.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/call-tester.h"
......@@ -24,7 +25,7 @@ class RawMachineAssemblerTester : public HandleAndZoneScope,
public:
template <typename... ParamMachTypes>
explicit RawMachineAssemblerTester(ParamMachTypes... p)
: HandleAndZoneScope(),
: HandleAndZoneScope(kCompressGraphZone),
CallHelper<ReturnType>(
main_isolate(),
CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p...)),
......@@ -41,7 +42,7 @@ class RawMachineAssemblerTester : public HandleAndZoneScope,
template <typename... ParamMachTypes>
RawMachineAssemblerTester(Code::Kind kind, ParamMachTypes... p)
: HandleAndZoneScope(),
: HandleAndZoneScope(kCompressGraphZone),
CallHelper<ReturnType>(
main_isolate(),
CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p...)),
......
......@@ -14,6 +14,7 @@
#include "src/compiler/schedule.h"
#include "src/compiler/scheduler.h"
#include "src/compiler/verifier.h"
#include "src/zone/zone-fwd.h"
#include "test/cctest/cctest.h"
namespace v8 {
......@@ -27,7 +28,7 @@ static Operator dummy_operator6(IrOpcode::kParameter, Operator::kNoWrite,
TEST(NodeWithNullInputReachableFromEnd) {
HandleAndZoneScope scope;
HandleAndZoneScope scope(kCompressGraphZone);
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
......@@ -46,7 +47,7 @@ TEST(NodeWithNullInputReachableFromEnd) {
TEST(NodeWithNullControlReachableFromEnd) {
HandleAndZoneScope scope;
HandleAndZoneScope scope(kCompressGraphZone);
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
......@@ -65,7 +66,7 @@ TEST(NodeWithNullControlReachableFromEnd) {
TEST(NodeWithNullInputReachableFromStart) {
HandleAndZoneScope scope;
HandleAndZoneScope scope(kCompressGraphZone);
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
......@@ -84,7 +85,7 @@ TEST(NodeWithNullInputReachableFromStart) {
TEST(NodeWithNullControlReachableFromStart) {
HandleAndZoneScope scope;
HandleAndZoneScope scope(kCompressGraphZone);
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
......@@ -101,7 +102,7 @@ TEST(NodeWithNullControlReachableFromStart) {
TEST(NodeNetworkOfDummiesReachableFromEnd) {
HandleAndZoneScope scope;
HandleAndZoneScope scope(kCompressGraphZone);
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
......
......@@ -5,7 +5,7 @@
#include "src/compiler/backend/instruction-scheduler.h"
#include "src/compiler/backend/instruction-selector-impl.h"
#include "src/compiler/backend/instruction.h"
#include "src/zone/zone-fwd.h"
#include "test/cctest/cctest.h"
namespace v8 {
......@@ -26,7 +26,7 @@ InstructionBlocks* CreateSingleBlock(Zone* zone) {
class InstructionSchedulerTester {
public:
InstructionSchedulerTester()
: scope_(),
: scope_(kCompressGraphZone),
blocks_(CreateSingleBlock(scope_.main_zone())),
sequence_(scope_.main_isolate(), scope_.main_zone(), blocks_),
scheduler_(scope_.main_zone(), &sequence_) {}
......
......@@ -26,7 +26,8 @@ using TestInstrSeq = v8::internal::compiler::InstructionSequence;
class InstructionTester : public HandleAndZoneScope {
public: // We're all friends here.
InstructionTester()
: graph(zone()),
: HandleAndZoneScope(kCompressGraphZone),
graph(zone()),
schedule(zone()),
common(zone()),
machine(zone()),
......
......@@ -34,7 +34,8 @@ class JSConstantCacheTester : public HandleAndZoneScope,
public JSGraph {
public:
JSConstantCacheTester()
: JSCacheTesterHelper(main_zone()),
: HandleAndZoneScope(kCompressGraphZone),
JSCacheTesterHelper(main_zone()),
JSGraph(main_isolate(), &main_graph_, &main_common_, &main_javascript_,
nullptr, &main_machine_),
canonical_(main_isolate()),
......
......@@ -24,7 +24,8 @@ namespace compiler {
class ContextSpecializationTester : public HandleAndZoneScope {
public:
explicit ContextSpecializationTester(Maybe<OuterContext> context)
: canonical_(main_isolate()),
: HandleAndZoneScope(kCompressGraphZone),
canonical_(main_isolate()),
graph_(main_zone()->New<Graph>(main_zone())),
common_(main_zone()),
javascript_(main_zone()),
......
......@@ -25,7 +25,8 @@ namespace compiler {
class JSTypedLoweringTester : public HandleAndZoneScope {
public:
explicit JSTypedLoweringTester(int num_parameters = 0)
: isolate(main_isolate()),
: HandleAndZoneScope(kCompressGraphZone),
isolate(main_isolate()),
canonical(isolate),
js_heap_broker(isolate, main_zone(), isolate->NewPersistentHandles()),
binop(nullptr),
......
......@@ -36,7 +36,8 @@ static const int kNumLeafs = 4;
class LoopFinderTester : HandleAndZoneScope {
public:
LoopFinderTester()
: isolate(main_isolate()),
: HandleAndZoneScope(kCompressGraphZone),
isolate(main_isolate()),
common(main_zone()),
graph(main_zone()),
jsgraph(main_isolate(), &graph, &common, nullptr, nullptr, nullptr),
......
......@@ -78,7 +78,8 @@ class ReducerTester : public HandleAndZoneScope {
explicit ReducerTester(int num_parameters = 0,
MachineOperatorBuilder::Flags flags =
MachineOperatorBuilder::kAllOptionalOps)
: isolate(main_isolate()),
: HandleAndZoneScope(kCompressGraphZone),
isolate(main_isolate()),
binop(nullptr),
unop(nullptr),
machine(main_zone(), MachineType::PointerRepresentation(), flags),
......
......@@ -143,7 +143,7 @@ void TestReturnMultipleValues(MachineType type) {
Zone zone(&allocator, ZONE_NAME);
CallDescriptor* desc =
CreateCallDescriptor(&zone, count, param_count, type);
HandleAndZoneScope handles;
HandleAndZoneScope handles(kCompressGraphZone);
RawMachineAssembler m(
handles.main_isolate(),
handles.main_zone()->New<Graph>(handles.main_zone()), desc,
......@@ -253,7 +253,7 @@ void ReturnLastValue(MachineType type) {
CallDescriptor* desc = CreateCallDescriptor(&zone, return_count, 0, type);
HandleAndZoneScope handles;
HandleAndZoneScope handles(kCompressGraphZone);
RawMachineAssembler m(handles.main_isolate(),
handles.main_zone()->New<Graph>(handles.main_zone()),
desc, MachineType::PointerRepresentation(),
......@@ -316,7 +316,7 @@ void ReturnSumOfReturns(MachineType type) {
CallDescriptor* desc = CreateCallDescriptor(&zone, return_count, 0, type);
HandleAndZoneScope handles;
HandleAndZoneScope handles(kCompressGraphZone);
RawMachineAssembler m(handles.main_isolate(),
handles.main_zone()->New<Graph>(handles.main_zone()),
desc, MachineType::PointerRepresentation(),
......
......@@ -7,6 +7,7 @@
#include "src/compiler/graph.h"
#include "src/compiler/node.h"
#include "src/compiler/operator.h"
#include "src/zone/zone-fwd.h"
#include "test/cctest/cctest.h"
namespace v8 {
......@@ -156,7 +157,7 @@ void CheckInputs(Node* node, Node** inputs, int input_count) {
TEST(NodeUseIteratorReplaceUses) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
Node* n1 = graph.NewNode(&dummy_operator1, n0);
......@@ -182,7 +183,7 @@ TEST(NodeUseIteratorReplaceUses) {
TEST(NodeUseIteratorReplaceUsesSelf) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
Node* n1 = graph.NewNode(&dummy_operator1, n0);
......@@ -207,7 +208,7 @@ TEST(NodeUseIteratorReplaceUsesSelf) {
TEST(ReplaceInput) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
Node* n1 = graph.NewNode(&dummy_operator0);
......@@ -234,7 +235,7 @@ TEST(ReplaceInput) {
TEST(OwnedBy) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
{
......@@ -285,7 +286,7 @@ TEST(OwnedBy) {
TEST(Uses) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -308,7 +309,7 @@ TEST(Uses) {
TEST(Inputs) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -336,7 +337,7 @@ TEST(Inputs) {
TEST(InsertInputs) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -411,7 +412,7 @@ TEST(InsertInputs) {
TEST(RemoveInput) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -442,7 +443,7 @@ TEST(RemoveInput) {
TEST(AppendInputsAndIterator) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -465,7 +466,7 @@ TEST(AppendInputsAndIterator) {
TEST(NullInputsSimple) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -493,7 +494,7 @@ TEST(NullInputsSimple) {
TEST(NullInputsAppended) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -517,7 +518,7 @@ TEST(NullInputsAppended) {
TEST(ReplaceUsesFromAppendedInputs) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -546,7 +547,7 @@ TEST(ReplaceUsesFromAppendedInputs) {
TEST(ReplaceInputMultipleUses) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
......@@ -565,7 +566,7 @@ TEST(ReplaceInputMultipleUses) {
TEST(TrimInputCountInline) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
{
......@@ -634,7 +635,7 @@ TEST(TrimInputCountInline) {
TEST(TrimInputCountOutOfLine1) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
{
......@@ -729,7 +730,7 @@ TEST(TrimInputCountOutOfLine1) {
TEST(TrimInputCountOutOfLine2) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
{
......@@ -799,7 +800,7 @@ TEST(TrimInputCountOutOfLine2) {
TEST(NullAllInputs) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
for (int i = 0; i < 2; i++) {
......@@ -852,7 +853,7 @@ TEST(NullAllInputs) {
TEST(AppendAndTrim) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
Node* nodes[] = {
......
......@@ -23,7 +23,8 @@ class RepresentationChangerTester : public HandleAndZoneScope,
public GraphAndBuilders {
public:
explicit RepresentationChangerTester(int num_parameters = 0)
: GraphAndBuilders(main_zone()),
: HandleAndZoneScope(kCompressGraphZone),
GraphAndBuilders(main_zone()),
javascript_(main_zone()),
jsgraph_(main_isolate(), main_graph_, &main_common_, &javascript_,
&main_simplified_, &main_machine_),
......
......@@ -262,7 +262,7 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* call_descriptor,
Handle<Code> WrapWithCFunction(Handle<Code> inner,
CallDescriptor* call_descriptor) {
Zone zone(inner->GetIsolate()->allocator(), ZONE_NAME);
Zone zone(inner->GetIsolate()->allocator(), ZONE_NAME, kCompressGraphZone);
int param_count = static_cast<int>(call_descriptor->ParameterCount());
GraphAndBuilders caller(&zone);
{
......@@ -429,7 +429,7 @@ class Computer {
Handle<Code> inner = Handle<Code>::null();
{
// Build the graph for the computation.
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc);
build(desc, &raw);
......@@ -444,7 +444,7 @@ class Computer {
Handle<Code> wrapper = Handle<Code>::null();
{
// Wrap the above code with a callable function that passes constants.
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc);
......@@ -478,7 +478,7 @@ class Computer {
Handle<Code> wrapper = Handle<Code>::null();
{
// Wrap the above code with a callable function that loads from {input}.
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc);
......@@ -519,7 +519,7 @@ class Computer {
static void TestInt32Sub(CallDescriptor* desc) {
Isolate* isolate = CcTest::InitIsolateOnce();
HandleScope scope(isolate);
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
GraphAndBuilders inner(&zone);
{
// Build the add function.
......@@ -561,7 +561,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
Handle<Code> inner = Handle<Code>::null();
{
// Writes all parameters into the output buffer.
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc);
Node* base = raw.PointerConstant(output);
......@@ -578,7 +578,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
Handle<Code> wrapper = Handle<Code>::null();
{
// Loads parameters from the input buffer and calls the above code.
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc);
......@@ -947,7 +947,7 @@ static void Build_Select_With_Call(CallDescriptor* desc,
{
Isolate* isolate = CcTest::InitIsolateOnce();
// Build the actual select.
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc);
raw.Return(raw.Parameter(which));
......@@ -1044,7 +1044,7 @@ void MixedParamTest(int start) {
Handle<Code> select;
{
// build the select.
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc);
raw.Return(raw.Parameter(which));
......@@ -1061,7 +1061,7 @@ void MixedParamTest(int start) {
CSignatureOf<int32_t> csig;
{
// Wrap the select code with a callable function that passes constants.
Zone zone(&allocator, ZONE_NAME);
Zone zone(&allocator, ZONE_NAME, kCompressGraphZone);
Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc);
......@@ -1145,7 +1145,7 @@ void TestStackSlot(MachineType slot_type, T expected) {
Allocator ralloc(rarray_gp, 1, rarray_fp, 1);
RegisterConfig config(palloc, ralloc);
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
HandleScope scope(isolate);
MachineSignature::Builder builder(&zone, 1, 12);
builder.AddReturn(MachineType::Int32());
......
......@@ -2004,7 +2004,7 @@ WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) {
static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) {
Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone(isolate->allocator(), ZONE_NAME);
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
HandleScope scope(isolate);
// TODO(ahaas): Enable this test for externref opcodes when code generation
// for them is implemented.
......
......@@ -357,13 +357,13 @@ class WasmFunctionCompiler : public compiler::GraphAndBuilders {
// A helper class to build a module around Wasm bytecode, generate machine
// code, and run that code.
class WasmRunnerBase : public HandleAndZoneScope {
class WasmRunnerBase : public InitializedHandleScope {
public:
WasmRunnerBase(ManuallyImportedJSFunction* maybe_import,
ExecutionTier execution_tier, int num_params,
RuntimeExceptionSupport runtime_exception_support,
LowerSimd lower_simd)
: zone_(&allocator_, ZONE_NAME),
: zone_(&allocator_, ZONE_NAME, kCompressGraphZone),
builder_(&zone_, maybe_import, execution_tier,
runtime_exception_support, lower_simd),
wrapper_(&zone_, num_params) {}
......
......@@ -6,6 +6,7 @@
#define V8_UNITTESTS_CODE_STUB_ASSEMBLER_UNITTEST_H_
#include "src/codegen/code-stub-assembler.h"
#include "src/zone/zone-fwd.h"
#include "test/unittests/test-utils.h"
#include "testing/gmock-support.h"
......@@ -14,7 +15,7 @@ namespace internal {
class CodeStubAssemblerTest : public TestWithIsolateAndZone {
public:
CodeStubAssemblerTest() = default;
CodeStubAssemblerTest() : TestWithIsolateAndZone(kCompressGraphZone) {}
~CodeStubAssemblerTest() override = default;
};
......
......@@ -17,7 +17,9 @@ namespace v8 {
namespace internal {
namespace compiler {
InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {}
InstructionSelectorTest::InstructionSelectorTest()
: TestWithNativeContextAndZone(kCompressGraphZone),
rng_(FLAG_random_seed) {}
InstructionSelectorTest::~InstructionSelectorTest() = default;
......
......@@ -234,7 +234,7 @@ class AB2Sorter final : public Reducer {
class AdvancedReducerTest : public TestWithZone {
public:
AdvancedReducerTest() : graph_(zone()) {}
AdvancedReducerTest() : TestWithZone(kCompressGraphZone), graph_(zone()) {}
protected:
Graph* graph() { return &graph_; }
......@@ -411,7 +411,7 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse3) {
class GraphReducerTest : public TestWithZone {
public:
GraphReducerTest() : graph_(zone()) {}
GraphReducerTest() : TestWithZone(kCompressGraphZone), graph_(zone()) {}
static void SetUpTestCase() {
TestWithZone::SetUpTestCase();
......
......@@ -8,6 +8,7 @@
#include "src/compiler/node-properties.h"
#include "src/heap/factory.h"
#include "src/objects/objects-inl.h" // TODO(everyone): Make typer.h IWYU compliant.
#include "src/zone/zone-fwd.h"
#include "test/unittests/compiler/node-test-utils.h"
namespace v8 {
......@@ -15,7 +16,8 @@ namespace internal {
namespace compiler {
GraphTest::GraphTest(int num_parameters)
: canonical_(isolate()),
: TestWithNativeContextAndZone(kCompressGraphZone),
canonical_(isolate()),
common_(zone()),
graph_(zone()),
broker_(isolate(), zone(), isolate()->NewPersistentHandles()),
......
......@@ -23,6 +23,8 @@ MachineType kMachineTypes[] = {
class LinkageTailCall : public TestWithZone {
protected:
LinkageTailCall() : TestWithZone(kCompressGraphZone) {}
CallDescriptor* NewStandardCallDescriptor(LocationSignature* locations) {
DCHECK(arraysize(kMachineTypes) >=
locations->return_count() + locations->parameter_count());
......
......@@ -18,6 +18,8 @@ namespace node_properties_unittest {
class NodePropertiesTest : public TestWithZone {
public:
NodePropertiesTest() : TestWithZone(kCompressGraphZone) {}
Node* NewMockNode(const Operator* op) {
return Node::New(zone(), 0, op, 0, nullptr, false);
}
......
......@@ -17,7 +17,10 @@ namespace internal {
namespace compiler {
namespace node_unittest {
using NodeTest = TestWithZone;
class NodeTest : public TestWithZone {
public:
NodeTest() : TestWithZone(kCompressGraphZone) {}
};
const IrOpcode::Value kOpcode0 = static_cast<IrOpcode::Value>(0);
const IrOpcode::Value kOpcode1 = static_cast<IrOpcode::Value>(1);
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/node.h"
#include "src/compiler/schedule.h"
#include "src/compiler/node.h"
#include "src/zone/zone-fwd.h"
#include "test/unittests/test-utils.h"
#include "testing/gmock/include/gmock/gmock.h"
......@@ -67,7 +69,10 @@ TEST_F(BasicBlockTest, GetCommonDominator3) {
EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b3, &b1));
}
using ScheduleTest = TestWithZone;
class ScheduleTest : public TestWithZone {
public:
ScheduleTest() : TestWithZone(kCompressGraphZone) {}
};
const Operator kCallOperator(IrOpcode::kCall, Operator::kNoProperties,
"MockCall", 0, 0, 0, 0, 0, 0);
......
......@@ -30,7 +30,11 @@ namespace compiler {
class SchedulerTest : public TestWithIsolateAndZone {
public:
SchedulerTest()
: graph_(zone()), common_(zone()), simplified_(zone()), js_(zone()) {}
: TestWithIsolateAndZone(kCompressGraphZone),
graph_(zone()),
common_(zone()),
simplified_(zone()),
js_(zone()) {}
Schedule* ComputeAndVerifySchedule(size_t expected) {
if (FLAG_trace_turbo) {
......
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/value-numbering-reducer.h"
#include <limits>
#include "src/compiler/graph.h"
#include "src/compiler/node.h"
#include "src/compiler/operator.h"
#include "src/compiler/value-numbering-reducer.h"
#include "src/zone/zone-fwd.h"
#include "test/unittests/test-utils.h"
namespace v8 {
......@@ -30,7 +32,9 @@ static const TestOperator kOp1(1, Operator::kIdempotent, 1, 1);
class ValueNumberingReducerTest : public TestWithZone {
public:
ValueNumberingReducerTest()
: graph_(zone()), reducer_(zone(), graph()->zone()) {}
: TestWithZone(kCompressGraphZone),
graph_(zone()),
reducer_(zone(), graph()->zone()) {}
protected:
Reduction Reduce(Node* node) { return reducer_.Reduce(node); }
......
......@@ -28,7 +28,7 @@ class InterpreterAssemblerTestState : public compiler::CodeAssemblerState {
class InterpreterAssemblerTest : public TestWithIsolateAndZone {
public:
InterpreterAssemblerTest() = default;
InterpreterAssemblerTest() : TestWithIsolateAndZone(kCompressGraphZone) {}
~InterpreterAssemblerTest() override = default;
class InterpreterAssemblerForTest final : public InterpreterAssembler {
......
......@@ -205,7 +205,8 @@ class WithInternalIsolateMixin : public TMixin {
template <typename TMixin>
class WithZoneMixin : public TMixin {
public:
WithZoneMixin() : zone_(&allocator_, ZONE_NAME) {}
explicit WithZoneMixin(bool support_zone_compression = false)
: zone_(&allocator_, ZONE_NAME, support_zone_compression) {}
Zone* zone() { return &zone_; }
......@@ -224,11 +225,11 @@ using TestWithIsolate = //
using TestWithZone = WithZoneMixin<::testing::Test>;
using TestWithIsolateAndZone = //
WithInternalIsolateMixin< //
WithIsolateScopeMixin< //
WithIsolateMixin< //
WithZoneMixin< //
using TestWithIsolateAndZone = //
WithZoneMixin< //
WithInternalIsolateMixin< //
WithIsolateScopeMixin< //
WithIsolateMixin< //
::testing::Test>>>>;
using TestWithNativeContext = //
......
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