Commit 1540a014 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[zone] Cleanup zone allocations in src/compiler and tests, pt.2

... by migrating old-style code
  MyObject* obj = new (zone) MyObject(...)

to the new style
  MyObject* obj = zone->New<MyObject>(...)

Bug: v8:10689
Change-Id: Iec2b3102bd35ad7e50b90882ade78d27999a71f2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2288866Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68803}
parent 3af53301
...@@ -20,8 +20,8 @@ using interpreter::OperandType; ...@@ -20,8 +20,8 @@ using interpreter::OperandType;
BytecodeLoopAssignments::BytecodeLoopAssignments(int parameter_count, BytecodeLoopAssignments::BytecodeLoopAssignments(int parameter_count,
int register_count, Zone* zone) int register_count, Zone* zone)
: parameter_count_(parameter_count), : parameter_count_(parameter_count),
bit_vector_(new (zone) bit_vector_(
BitVector(parameter_count + register_count, zone)) {} zone->New<BitVector>(parameter_count + register_count, zone)) {}
void BytecodeLoopAssignments::Add(interpreter::Register r) { void BytecodeLoopAssignments::Add(interpreter::Register r) {
if (r.is_parameter()) { if (r.is_parameter()) {
......
...@@ -514,6 +514,8 @@ class BytecodeGraphBuilder::Environment : public ZoneObject { ...@@ -514,6 +514,8 @@ class BytecodeGraphBuilder::Environment : public ZoneObject {
const BytecodeLivenessState* liveness); const BytecodeLivenessState* liveness);
private: private:
friend Zone;
explicit Environment(const Environment* copy); explicit Environment(const Environment* copy);
bool StateValuesRequireUpdate(Node** state_values, Node** values, int count); bool StateValuesRequireUpdate(Node** state_values, Node** values, int count);
...@@ -707,7 +709,7 @@ void BytecodeGraphBuilder::Environment::RecordAfterState( ...@@ -707,7 +709,7 @@ void BytecodeGraphBuilder::Environment::RecordAfterState(
} }
BytecodeGraphBuilder::Environment* BytecodeGraphBuilder::Environment::Copy() { BytecodeGraphBuilder::Environment* BytecodeGraphBuilder::Environment::Copy() {
return new (zone()) Environment(this); return zone()->New<Environment>(this);
} }
void BytecodeGraphBuilder::Environment::Merge( void BytecodeGraphBuilder::Environment::Merge(
......
...@@ -9,8 +9,8 @@ namespace internal { ...@@ -9,8 +9,8 @@ namespace internal {
namespace compiler { namespace compiler {
BytecodeLiveness::BytecodeLiveness(int register_count, Zone* zone) BytecodeLiveness::BytecodeLiveness(int register_count, Zone* zone)
: in(new (zone) BytecodeLivenessState(register_count, zone)), : in(zone->New<BytecodeLivenessState>(register_count, zone)),
out(new (zone) BytecodeLivenessState(register_count, zone)) {} out(zone->New<BytecodeLivenessState>(register_count, zone)) {}
BytecodeLivenessMap::BytecodeLivenessMap(int bytecode_size, Zone* zone) BytecodeLivenessMap::BytecodeLivenessMap(int bytecode_size, Zone* zone)
: liveness_map_(base::bits::RoundUpToPowerOfTwo32(bytecode_size / 4 + 1), : liveness_map_(base::bits::RoundUpToPowerOfTwo32(bytecode_size / 4 + 1),
......
...@@ -222,7 +222,7 @@ CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone, ...@@ -222,7 +222,7 @@ CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone,
LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type); LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type);
flags |= CallDescriptor::kNoAllocate; flags |= CallDescriptor::kNoAllocate;
return new (zone) CallDescriptor( // -- return zone->New<CallDescriptor>( // --
CallDescriptor::kCallAddress, // kind CallDescriptor::kCallAddress, // kind
target_type, // target MachineType target_type, // target MachineType
target_loc, // target location target_loc, // target location
......
...@@ -77,7 +77,7 @@ CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone, ...@@ -77,7 +77,7 @@ CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone,
PoisoningMitigationLevel poisoning_level, PoisoningMitigationLevel poisoning_level,
int32_t builtin_index) int32_t builtin_index)
: raw_assembler_(new RawMachineAssembler( : raw_assembler_(new RawMachineAssembler(
isolate, new (zone) Graph(zone), call_descriptor, isolate, zone->New<Graph>(zone), call_descriptor,
MachineType::PointerRepresentation(), MachineType::PointerRepresentation(),
InstructionSelector::SupportedMachineOperatorFlags(), InstructionSelector::SupportedMachineOperatorFlags(),
InstructionSelector::AlignmentRequirements(), poisoning_level)), InstructionSelector::AlignmentRequirements(), poisoning_level)),
...@@ -86,9 +86,9 @@ CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone, ...@@ -86,9 +86,9 @@ CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone,
builtin_index_(builtin_index), builtin_index_(builtin_index),
code_generated_(false), code_generated_(false),
variables_(zone), variables_(zone),
jsgraph_(new (zone) JSGraph( jsgraph_(zone->New<JSGraph>(
isolate, raw_assembler_->graph(), raw_assembler_->common(), isolate, raw_assembler_->graph(), raw_assembler_->common(),
new (zone) JSOperatorBuilder(zone), raw_assembler_->simplified(), zone->New<JSOperatorBuilder>(zone), raw_assembler_->simplified(),
raw_assembler_->machine())) {} raw_assembler_->machine())) {}
CodeAssemblerState::~CodeAssemblerState() = default; CodeAssemblerState::~CodeAssemblerState() = default;
...@@ -135,7 +135,7 @@ void CodeAssembler::BreakOnNode(int node_id) { ...@@ -135,7 +135,7 @@ void CodeAssembler::BreakOnNode(int node_id) {
Graph* graph = raw_assembler()->graph(); Graph* graph = raw_assembler()->graph();
Zone* zone = graph->zone(); Zone* zone = graph->zone();
GraphDecorator* decorator = GraphDecorator* decorator =
new (zone) BreakOnNodeDecorator(static_cast<NodeId>(node_id)); zone->New<BreakOnNodeDecorator>(static_cast<NodeId>(node_id));
graph->AddDecorator(decorator); graph->AddDecorator(decorator);
} }
...@@ -1199,9 +1199,7 @@ void CodeAssembler::Branch(TNode<BoolT> condition, ...@@ -1199,9 +1199,7 @@ void CodeAssembler::Branch(TNode<BoolT> condition,
void CodeAssembler::Switch(Node* index, Label* default_label, void CodeAssembler::Switch(Node* index, Label* default_label,
const int32_t* case_values, Label** case_labels, const int32_t* case_values, Label** case_labels,
size_t case_count) { size_t case_count) {
RawMachineLabel** labels = RawMachineLabel** labels = zone()->NewArray<RawMachineLabel*>(case_count);
new (zone()->New(sizeof(RawMachineLabel*) * case_count))
RawMachineLabel*[case_count];
for (size_t i = 0; i < case_count; ++i) { for (size_t i = 0; i < case_count; ++i) {
labels[i] = case_labels[i]->label_; labels[i] = case_labels[i]->label_;
case_labels[i]->MergeVariables(); case_labels[i]->MergeVariables();
...@@ -1275,8 +1273,8 @@ bool CodeAssemblerVariable::ImplComparator::operator()( ...@@ -1275,8 +1273,8 @@ bool CodeAssemblerVariable::ImplComparator::operator()(
CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler, CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler,
MachineRepresentation rep) MachineRepresentation rep)
: impl_(new (assembler->zone()) : impl_(assembler->zone()->New<Impl>(rep,
Impl(rep, assembler->state()->NextVariableId())), assembler->state()->NextVariableId())),
state_(assembler->state()) { state_(assembler->state()) {
state_->variables_.insert(impl_); state_->variables_.insert(impl_);
} }
...@@ -1292,8 +1290,8 @@ CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler, ...@@ -1292,8 +1290,8 @@ CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler,
CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler, CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler,
AssemblerDebugInfo debug_info, AssemblerDebugInfo debug_info,
MachineRepresentation rep) MachineRepresentation rep)
: impl_(new (assembler->zone()) : impl_(assembler->zone()->New<Impl>(rep,
Impl(rep, assembler->state()->NextVariableId())), assembler->state()->NextVariableId())),
state_(assembler->state()) { state_(assembler->state()) {
impl_->set_debug_info(debug_info); impl_->set_debug_info(debug_info);
state_->variables_.insert(impl_); state_->variables_.insert(impl_);
...@@ -1361,10 +1359,9 @@ CodeAssemblerLabel::CodeAssemblerLabel(CodeAssembler* assembler, ...@@ -1361,10 +1359,9 @@ CodeAssemblerLabel::CodeAssemblerLabel(CodeAssembler* assembler,
merge_count_(0), merge_count_(0),
state_(assembler->state()), state_(assembler->state()),
label_(nullptr) { label_(nullptr) {
void* buffer = assembler->zone()->New(sizeof(RawMachineLabel)); label_ = assembler->zone()->New<RawMachineLabel>(
label_ = new (buffer) type == kDeferred ? RawMachineLabel::kDeferred
RawMachineLabel(type == kDeferred ? RawMachineLabel::kDeferred : RawMachineLabel::kNonDeferred);
: RawMachineLabel::kNonDeferred);
for (size_t i = 0; i < vars_count; ++i) { for (size_t i = 0; i < vars_count; ++i) {
variable_phis_[vars[i]->impl_] = nullptr; variable_phis_[vars[i]->impl_] = nullptr;
} }
......
This diff is collapsed.
...@@ -373,21 +373,21 @@ void CompilationDependencies::RecordDependency( ...@@ -373,21 +373,21 @@ void CompilationDependencies::RecordDependency(
MapRef CompilationDependencies::DependOnInitialMap( MapRef CompilationDependencies::DependOnInitialMap(
const JSFunctionRef& function) { const JSFunctionRef& function) {
MapRef map = function.initial_map(); MapRef map = function.initial_map();
RecordDependency(new (zone_) InitialMapDependency(function, map)); RecordDependency(zone_->New<InitialMapDependency>(function, map));
return map; return map;
} }
ObjectRef CompilationDependencies::DependOnPrototypeProperty( ObjectRef CompilationDependencies::DependOnPrototypeProperty(
const JSFunctionRef& function) { const JSFunctionRef& function) {
ObjectRef prototype = function.prototype(); ObjectRef prototype = function.prototype();
RecordDependency(new (zone_) RecordDependency(
PrototypePropertyDependency(function, prototype)); zone_->New<PrototypePropertyDependency>(function, prototype));
return prototype; return prototype;
} }
void CompilationDependencies::DependOnStableMap(const MapRef& map) { void CompilationDependencies::DependOnStableMap(const MapRef& map) {
if (map.CanTransition()) { if (map.CanTransition()) {
RecordDependency(new (zone_) StableMapDependency(map)); RecordDependency(zone_->New<StableMapDependency>(map));
} else { } else {
DCHECK(map.is_stable()); DCHECK(map.is_stable());
} }
...@@ -400,7 +400,7 @@ void CompilationDependencies::DependOnTransition(const MapRef& target_map) { ...@@ -400,7 +400,7 @@ void CompilationDependencies::DependOnTransition(const MapRef& target_map) {
AllocationType CompilationDependencies::DependOnPretenureMode( AllocationType CompilationDependencies::DependOnPretenureMode(
const AllocationSiteRef& site) { const AllocationSiteRef& site) {
AllocationType allocation = site.GetAllocationType(); AllocationType allocation = site.GetAllocationType();
RecordDependency(new (zone_) PretenureModeDependency(site, allocation)); RecordDependency(zone_->New<PretenureModeDependency>(site, allocation));
return allocation; return allocation;
} }
...@@ -423,7 +423,7 @@ PropertyConstness CompilationDependencies::DependOnFieldConstness( ...@@ -423,7 +423,7 @@ PropertyConstness CompilationDependencies::DependOnFieldConstness(
} }
DCHECK_EQ(constness, PropertyConstness::kConst); DCHECK_EQ(constness, PropertyConstness::kConst);
RecordDependency(new (zone_) FieldConstnessDependency(owner, descriptor)); RecordDependency(zone_->New<FieldConstnessDependency>(owner, descriptor));
return PropertyConstness::kConst; return PropertyConstness::kConst;
} }
...@@ -441,12 +441,12 @@ void CompilationDependencies::DependOnGlobalProperty( ...@@ -441,12 +441,12 @@ void CompilationDependencies::DependOnGlobalProperty(
const PropertyCellRef& cell) { const PropertyCellRef& cell) {
PropertyCellType type = cell.property_details().cell_type(); PropertyCellType type = cell.property_details().cell_type();
bool read_only = cell.property_details().IsReadOnly(); bool read_only = cell.property_details().IsReadOnly();
RecordDependency(new (zone_) GlobalPropertyDependency(cell, type, read_only)); RecordDependency(zone_->New<GlobalPropertyDependency>(cell, type, read_only));
} }
bool CompilationDependencies::DependOnProtector(const PropertyCellRef& cell) { bool CompilationDependencies::DependOnProtector(const PropertyCellRef& cell) {
if (cell.value().AsSmi() != Protectors::kProtectorValid) return false; if (cell.value().AsSmi() != Protectors::kProtectorValid) return false;
RecordDependency(new (zone_) ProtectorDependency(cell)); RecordDependency(zone_->New<ProtectorDependency>(cell));
return true; return true;
} }
...@@ -493,7 +493,7 @@ void CompilationDependencies::DependOnElementsKind( ...@@ -493,7 +493,7 @@ void CompilationDependencies::DependOnElementsKind(
? site.boilerplate().value().GetElementsKind() ? site.boilerplate().value().GetElementsKind()
: site.GetElementsKind(); : site.GetElementsKind();
if (AllocationSite::ShouldTrack(kind)) { if (AllocationSite::ShouldTrack(kind)) {
RecordDependency(new (zone_) ElementsKindDependency(site, kind)); RecordDependency(zone_->New<ElementsKindDependency>(site, kind));
} }
} }
...@@ -619,7 +619,7 @@ CompilationDependencies::DependOnInitialMapInstanceSizePrediction( ...@@ -619,7 +619,7 @@ CompilationDependencies::DependOnInitialMapInstanceSizePrediction(
// Currently, we always install the prediction dependency. If this turns out // Currently, we always install the prediction dependency. If this turns out
// to be too expensive, we can only install the dependency if slack // to be too expensive, we can only install the dependency if slack
// tracking is active. // tracking is active.
RecordDependency(new (zone_) InitialMapInstanceSizePredictionDependency( RecordDependency(zone_->New<InitialMapInstanceSizePredictionDependency>(
function, instance_size)); function, instance_size));
DCHECK_LE(instance_size, function.initial_map().instance_size()); DCHECK_LE(instance_size, function.initial_map().instance_size());
return SlackTrackingPrediction(initial_map, instance_size); return SlackTrackingPrediction(initial_map, instance_size);
...@@ -629,7 +629,7 @@ CompilationDependency const* ...@@ -629,7 +629,7 @@ CompilationDependency const*
CompilationDependencies::TransitionDependencyOffTheRecord( CompilationDependencies::TransitionDependencyOffTheRecord(
const MapRef& target_map) const { const MapRef& target_map) const {
if (target_map.CanBeDeprecated()) { if (target_map.CanBeDeprecated()) {
return new (zone_) TransitionDependency(target_map); return zone_->New<TransitionDependency>(target_map);
} else { } else {
DCHECK(!target_map.is_deprecated()); DCHECK(!target_map.is_deprecated());
return nullptr; return nullptr;
...@@ -643,7 +643,7 @@ CompilationDependencies::FieldRepresentationDependencyOffTheRecord( ...@@ -643,7 +643,7 @@ CompilationDependencies::FieldRepresentationDependencyOffTheRecord(
PropertyDetails details = owner.GetPropertyDetails(descriptor); PropertyDetails details = owner.GetPropertyDetails(descriptor);
DCHECK(details.representation().Equals( DCHECK(details.representation().Equals(
map.GetPropertyDetails(descriptor).representation())); map.GetPropertyDetails(descriptor).representation()));
return new (zone_) FieldRepresentationDependency(owner, descriptor, return zone_->New<FieldRepresentationDependency>(owner, descriptor,
details.representation()); details.representation());
} }
...@@ -653,7 +653,7 @@ CompilationDependencies::FieldTypeDependencyOffTheRecord( ...@@ -653,7 +653,7 @@ CompilationDependencies::FieldTypeDependencyOffTheRecord(
MapRef owner = map.FindFieldOwner(descriptor); MapRef owner = map.FindFieldOwner(descriptor);
ObjectRef type = owner.GetFieldType(descriptor); ObjectRef type = owner.GetFieldType(descriptor);
DCHECK(type.equals(map.GetFieldType(descriptor))); DCHECK(type.equals(map.GetFieldType(descriptor)));
return new (zone_) FieldTypeDependency(owner, descriptor, type); return zone_->New<FieldTypeDependency>(owner, descriptor, type);
} }
} // namespace compiler } // namespace compiler
......
...@@ -32,7 +32,7 @@ SourcePositionTable::SourcePositionTable(Graph* graph) ...@@ -32,7 +32,7 @@ SourcePositionTable::SourcePositionTable(Graph* graph)
void SourcePositionTable::AddDecorator() { void SourcePositionTable::AddDecorator() {
DCHECK_NULL(decorator_); DCHECK_NULL(decorator_);
decorator_ = new (graph_->zone()) Decorator(this); decorator_ = graph_->zone()->New<Decorator>(this);
graph_->AddDecorator(decorator_); graph_->AddDecorator(decorator_);
} }
......
...@@ -136,7 +136,7 @@ class V8_EXPORT_PRIVATE ControlEquivalence final ...@@ -136,7 +136,7 @@ class V8_EXPORT_PRIVATE ControlEquivalence final
void AllocateData(Node* node) { void AllocateData(Node* node) {
size_t const index = node->id(); size_t const index = node->id();
if (index >= node_data_.size()) node_data_.resize(index + 1); if (index >= node_data_.size()) node_data_.resize(index + 1);
node_data_[index] = new (zone_) NodeData(zone_); node_data_[index] = zone_->New<NodeData>(zone_);
} }
int NewClassNumber() { return class_number_++; } int NewClassNumber() { return class_number_++; }
......
...@@ -125,7 +125,7 @@ CsaLoadElimination::AbstractState::KillField(Node* kill_object, ...@@ -125,7 +125,7 @@ CsaLoadElimination::AbstractState::KillField(Node* kill_object,
MachineRepresentation kill_repr, MachineRepresentation kill_repr,
Zone* zone) const { Zone* zone) const {
FieldInfo empty_info; FieldInfo empty_info;
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
for (std::pair<Field, FieldInfo> entry : that->field_infos_) { for (std::pair<Field, FieldInfo> entry : that->field_infos_) {
Field field = entry.first; Field field = entry.first;
MachineRepresentation field_repr = entry.second.representation; MachineRepresentation field_repr = entry.second.representation;
...@@ -142,7 +142,7 @@ CsaLoadElimination::AbstractState const* ...@@ -142,7 +142,7 @@ CsaLoadElimination::AbstractState const*
CsaLoadElimination::AbstractState::AddField(Node* object, Node* offset, CsaLoadElimination::AbstractState::AddField(Node* object, Node* offset,
CsaLoadElimination::FieldInfo info, CsaLoadElimination::FieldInfo info,
Zone* zone) const { Zone* zone) const {
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
that->field_infos_.Set({object, offset}, info); that->field_infos_.Set({object, offset}, info);
return that; return that;
} }
...@@ -233,7 +233,7 @@ Reduction CsaLoadElimination::ReduceEffectPhi(Node* node) { ...@@ -233,7 +233,7 @@ Reduction CsaLoadElimination::ReduceEffectPhi(Node* node) {
// Make a copy of the first input's state and merge with the state // Make a copy of the first input's state and merge with the state
// from other inputs. // from other inputs.
AbstractState* state = new (zone()) AbstractState(*state0); AbstractState* state = zone()->New<AbstractState>(*state0);
for (int i = 1; i < input_count; ++i) { for (int i = 1; i < input_count; ++i) {
Node* const input = NodeProperties::GetEffectInput(node, i); Node* const input = NodeProperties::GetEffectInput(node, i);
state->Merge(node_states_.Get(input), zone()); state->Merge(node_states_.Get(input), zone());
......
...@@ -266,8 +266,8 @@ class EscapeAnalysisTracker : public ZoneObject { ...@@ -266,8 +266,8 @@ class EscapeAnalysisTracker : public ZoneObject {
VirtualObject* NewVirtualObject(int size) { VirtualObject* NewVirtualObject(int size) {
if (next_object_id_ >= kMaxTrackedObjects) return nullptr; if (next_object_id_ >= kMaxTrackedObjects) return nullptr;
return new (zone_) return zone_->New<VirtualObject>(&variable_states_, next_object_id_++,
VirtualObject(&variable_states_, next_object_id_++, size); size);
} }
SparseSidetable<VirtualObject*> virtual_objects_; SparseSidetable<VirtualObject*> virtual_objects_;
...@@ -829,7 +829,7 @@ EscapeAnalysis::EscapeAnalysis(JSGraph* jsgraph, TickCounter* tick_counter, ...@@ -829,7 +829,7 @@ EscapeAnalysis::EscapeAnalysis(JSGraph* jsgraph, TickCounter* tick_counter,
jsgraph->graph(), jsgraph->graph(),
[this](Node* node, Reduction* reduction) { Reduce(node, reduction); }, [this](Node* node, Reduction* reduction) { Reduce(node, reduction); },
tick_counter, zone), tick_counter, zone),
tracker_(new (zone) EscapeAnalysisTracker(jsgraph, this, zone)), tracker_(zone->New<EscapeAnalysisTracker>(jsgraph, this, zone)),
jsgraph_(jsgraph) {} jsgraph_(jsgraph) {}
Node* EscapeAnalysisResult::GetReplacementOf(Node* node) { Node* EscapeAnalysisResult::GetReplacementOf(Node* node) {
......
...@@ -67,7 +67,7 @@ class FunctionalList { ...@@ -67,7 +67,7 @@ class FunctionalList {
} }
void PushFront(A a, Zone* zone) { void PushFront(A a, Zone* zone) {
elements_ = new (zone) Cons(std::move(a), elements_); elements_ = zone->New<Cons>(std::move(a), elements_);
} }
// If {hint} happens to be exactly what we want to allocate, avoid allocation // If {hint} happens to be exactly what we want to allocate, avoid allocation
......
...@@ -173,11 +173,11 @@ DEFINE_GETTER(EmptyStateValues, ...@@ -173,11 +173,11 @@ DEFINE_GETTER(EmptyStateValues,
graph()->NewNode(common()->StateValues(0, graph()->NewNode(common()->StateValues(0,
SparseInputMask::Dense()))) SparseInputMask::Dense())))
DEFINE_GETTER(SingleDeadTypedStateValues, DEFINE_GETTER(
graph()->NewNode(common()->TypedStateValues( SingleDeadTypedStateValues,
new (graph()->zone()->New(sizeof(ZoneVector<MachineType>))) graph()->NewNode(common()->TypedStateValues(
ZoneVector<MachineType>(0, graph()->zone()), graph()->zone()->New<ZoneVector<MachineType>>(0, graph()->zone()),
SparseInputMask(SparseInputMask::kEndMarker << 1)))) SparseInputMask(SparseInputMask::kEndMarker << 1))))
#undef DEFINE_GETTER #undef DEFINE_GETTER
#undef GET_CACHED_FIELD #undef GET_CACHED_FIELD
......
This diff is collapsed.
...@@ -284,8 +284,8 @@ class V8_EXPORT_PRIVATE JSHeapBroker { ...@@ -284,8 +284,8 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
ZoneMultimap<SerializedFunction, HintsVector> serialized_functions_; ZoneMultimap<SerializedFunction, HintsVector> serialized_functions_;
static const size_t kMaxSerializedFunctionsCacheSize = 200; static const size_t kMaxSerializedFunctionsCacheSize = 200;
static const size_t kMinimalRefsBucketCount = 8; // must be power of 2 static const uint32_t kMinimalRefsBucketCount = 8; // must be power of 2
static const size_t kInitialRefsBucketCount = 1024; // must be power of 2 static const uint32_t kInitialRefsBucketCount = 1024; // must be power of 2
}; };
class TraceScope { class TraceScope {
......
...@@ -170,7 +170,7 @@ Reduction JSNativeContextSpecialization::ReduceJSToString(Node* node) { ...@@ -170,7 +170,7 @@ Reduction JSNativeContextSpecialization::ReduceJSToString(Node* node) {
NumberMatcher number_matcher(input); NumberMatcher number_matcher(input);
if (number_matcher.HasValue()) { if (number_matcher.HasValue()) {
const StringConstantBase* base = const StringConstantBase* base =
new (shared_zone()) NumberToStringConstant(number_matcher.Value()); shared_zone()->New<NumberToStringConstant>(number_matcher.Value());
reduction = reduction =
Replace(graph()->NewNode(common()->DelayedStringConstant(base))); Replace(graph()->NewNode(common()->DelayedStringConstant(base)));
ReplaceWithValue(node, reduction.replacement()); ReplaceWithValue(node, reduction.replacement());
...@@ -187,13 +187,13 @@ JSNativeContextSpecialization::CreateDelayedStringConstant(Node* node) { ...@@ -187,13 +187,13 @@ JSNativeContextSpecialization::CreateDelayedStringConstant(Node* node) {
} else { } else {
NumberMatcher number_matcher(node); NumberMatcher number_matcher(node);
if (number_matcher.HasValue()) { if (number_matcher.HasValue()) {
return new (shared_zone()) NumberToStringConstant(number_matcher.Value()); return shared_zone()->New<NumberToStringConstant>(number_matcher.Value());
} else { } else {
HeapObjectMatcher matcher(node); HeapObjectMatcher matcher(node);
if (matcher.HasValue() && matcher.Ref(broker()).IsString()) { if (matcher.HasValue() && matcher.Ref(broker()).IsString()) {
StringRef s = matcher.Ref(broker()).AsString(); StringRef s = matcher.Ref(broker()).AsString();
return new (shared_zone()) return shared_zone()->New<StringLiteral>(
StringLiteral(s.object(), static_cast<size_t>(s.length())); s.object(), static_cast<size_t>(s.length()));
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
...@@ -335,7 +335,7 @@ Reduction JSNativeContextSpecialization::ReduceJSAdd(Node* node) { ...@@ -335,7 +335,7 @@ Reduction JSNativeContextSpecialization::ReduceJSAdd(Node* node) {
const StringConstantBase* left = CreateDelayedStringConstant(lhs); const StringConstantBase* left = CreateDelayedStringConstant(lhs);
const StringConstantBase* right = CreateDelayedStringConstant(rhs); const StringConstantBase* right = CreateDelayedStringConstant(rhs);
const StringConstantBase* cons = const StringConstantBase* cons =
new (shared_zone()) StringCons(left, right); shared_zone()->New<StringCons>(left, right);
Node* reduced = graph()->NewNode(common()->DelayedStringConstant(cons)); Node* reduced = graph()->NewNode(common()->DelayedStringConstant(cons));
ReplaceWithValue(node, reduced); ReplaceWithValue(node, reduced);
......
This diff is collapsed.
...@@ -74,7 +74,7 @@ MachineSignature* CallDescriptor::GetMachineSignature(Zone* zone) const { ...@@ -74,7 +74,7 @@ MachineSignature* CallDescriptor::GetMachineSignature(Zone* zone) const {
for (size_t i = 0; i < param_count; ++i) { for (size_t i = 0; i < param_count; ++i) {
types[current++] = GetParameterType(i); types[current++] = GetParameterType(i);
} }
return new (zone) MachineSignature(return_count, param_count, types); return zone->New<MachineSignature>(return_count, param_count, types);
} }
int CallDescriptor::GetFirstUnusedStackSlot() const { int CallDescriptor::GetFirstUnusedStackSlot() const {
...@@ -295,7 +295,7 @@ CallDescriptor* Linkage::GetCEntryStubCallDescriptor( ...@@ -295,7 +295,7 @@ CallDescriptor* Linkage::GetCEntryStubCallDescriptor(
MachineType target_type = MachineType::AnyTagged(); MachineType target_type = MachineType::AnyTagged();
LinkageLocation target_loc = LinkageLocation target_loc =
LinkageLocation::ForAnyRegister(MachineType::AnyTagged()); LinkageLocation::ForAnyRegister(MachineType::AnyTagged());
return new (zone) CallDescriptor( // -- return zone->New<CallDescriptor>( // --
CallDescriptor::kCallCodeObject, // kind CallDescriptor::kCallCodeObject, // kind
target_type, // target MachineType target_type, // target MachineType
target_loc, // target location target_loc, // target location
...@@ -353,7 +353,7 @@ CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr, ...@@ -353,7 +353,7 @@ CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
LinkageLocation target_loc = LinkageLocation target_loc =
is_osr ? LinkageLocation::ForSavedCallerFunction() is_osr ? LinkageLocation::ForSavedCallerFunction()
: regloc(kJSFunctionRegister, MachineType::AnyTagged()); : regloc(kJSFunctionRegister, MachineType::AnyTagged());
return new (zone) CallDescriptor( // -- return zone->New<CallDescriptor>( // --
CallDescriptor::kCallJSFunction, // kind CallDescriptor::kCallJSFunction, // kind
target_type, // target MachineType target_type, // target MachineType
target_loc, // target location target_loc, // target location
...@@ -452,7 +452,7 @@ CallDescriptor* Linkage::GetStubCallDescriptor( ...@@ -452,7 +452,7 @@ CallDescriptor* Linkage::GetStubCallDescriptor(
} }
LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type); LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type);
return new (zone) CallDescriptor( // -- return zone->New<CallDescriptor>( // --
kind, // kind kind, // kind
target_type, // target MachineType target_type, // target MachineType
target_loc, // target location target_loc, // target location
...@@ -499,7 +499,7 @@ CallDescriptor* Linkage::GetBytecodeDispatchCallDescriptor( ...@@ -499,7 +499,7 @@ CallDescriptor* Linkage::GetBytecodeDispatchCallDescriptor(
LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type); LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type);
const CallDescriptor::Flags kFlags = const CallDescriptor::Flags kFlags =
CallDescriptor::kCanUseRoots | CallDescriptor::kFixedTargetRegister; CallDescriptor::kCanUseRoots | CallDescriptor::kFixedTargetRegister;
return new (zone) CallDescriptor( // -- return zone->New<CallDescriptor>( // --
CallDescriptor::kCallAddress, // kind CallDescriptor::kCallAddress, // kind
target_type, // target MachineType target_type, // target MachineType
target_loc, // target location target_loc, // target location
......
...@@ -167,7 +167,7 @@ LoadElimination::AbstractElements::Kill(Node* object, Node* index, ...@@ -167,7 +167,7 @@ LoadElimination::AbstractElements::Kill(Node* object, Node* index,
for (Element const element : this->elements_) { for (Element const element : this->elements_) {
if (element.object == nullptr) continue; if (element.object == nullptr) continue;
if (MayAlias(object, element.object)) { if (MayAlias(object, element.object)) {
AbstractElements* that = new (zone) AbstractElements(zone); AbstractElements* that = zone->New<AbstractElements>(zone);
for (Element const element : this->elements_) { for (Element const element : this->elements_) {
if (element.object == nullptr) continue; if (element.object == nullptr) continue;
DCHECK_NOT_NULL(element.index); DCHECK_NOT_NULL(element.index);
...@@ -221,7 +221,7 @@ LoadElimination::AbstractElements const* ...@@ -221,7 +221,7 @@ LoadElimination::AbstractElements const*
LoadElimination::AbstractElements::Merge(AbstractElements const* that, LoadElimination::AbstractElements::Merge(AbstractElements const* that,
Zone* zone) const { Zone* zone) const {
if (this->Equals(that)) return this; if (this->Equals(that)) return this;
AbstractElements* copy = new (zone) AbstractElements(zone); AbstractElements* copy = zone->New<AbstractElements>(zone);
for (Element const this_element : this->elements_) { for (Element const this_element : this->elements_) {
if (this_element.object == nullptr) continue; if (this_element.object == nullptr) continue;
for (Element const that_element : that->elements_) { for (Element const that_element : that->elements_) {
...@@ -293,7 +293,7 @@ LoadElimination::AbstractField const* LoadElimination::AbstractField::KillConst( ...@@ -293,7 +293,7 @@ LoadElimination::AbstractField const* LoadElimination::AbstractField::KillConst(
// store was performed on the Allocate node. We therefore remove information // store was performed on the Allocate node. We therefore remove information
// on all nodes that must alias with 'object'. // on all nodes that must alias with 'object'.
if (MustAlias(object, pair.first)) { if (MustAlias(object, pair.first)) {
AbstractField* that = new (zone) AbstractField(zone); AbstractField* that = zone->New<AbstractField>(zone);
for (auto pair : this->info_for_node_) { for (auto pair : this->info_for_node_) {
if (!MustAlias(object, pair.first)) { if (!MustAlias(object, pair.first)) {
that->info_for_node_.insert(pair); that->info_for_node_.insert(pair);
...@@ -311,7 +311,7 @@ LoadElimination::AbstractField const* LoadElimination::AbstractField::Kill( ...@@ -311,7 +311,7 @@ LoadElimination::AbstractField const* LoadElimination::AbstractField::Kill(
for (auto pair : this->info_for_node_) { for (auto pair : this->info_for_node_) {
if (pair.first->IsDead()) continue; if (pair.first->IsDead()) continue;
if (alias_info.MayAlias(pair.first)) { if (alias_info.MayAlias(pair.first)) {
AbstractField* that = new (zone) AbstractField(zone); AbstractField* that = zone->New<AbstractField>(zone);
for (auto pair : this->info_for_node_) { for (auto pair : this->info_for_node_) {
if (!alias_info.MayAlias(pair.first) || if (!alias_info.MayAlias(pair.first) ||
!MayAlias(name, pair.second.name)) { !MayAlias(name, pair.second.name)) {
...@@ -355,7 +355,7 @@ LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Kill( ...@@ -355,7 +355,7 @@ LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Kill(
const AliasStateInfo& alias_info, Zone* zone) const { const AliasStateInfo& alias_info, Zone* zone) const {
for (auto pair : this->info_for_node_) { for (auto pair : this->info_for_node_) {
if (alias_info.MayAlias(pair.first)) { if (alias_info.MayAlias(pair.first)) {
AbstractMaps* that = new (zone) AbstractMaps(zone); AbstractMaps* that = zone->New<AbstractMaps>(zone);
for (auto pair : this->info_for_node_) { for (auto pair : this->info_for_node_) {
if (!alias_info.MayAlias(pair.first)) that->info_for_node_.insert(pair); if (!alias_info.MayAlias(pair.first)) that->info_for_node_.insert(pair);
} }
...@@ -368,7 +368,7 @@ LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Kill( ...@@ -368,7 +368,7 @@ LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Kill(
LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Merge( LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Merge(
AbstractMaps const* that, Zone* zone) const { AbstractMaps const* that, Zone* zone) const {
if (this->Equals(that)) return this; if (this->Equals(that)) return this;
AbstractMaps* copy = new (zone) AbstractMaps(zone); AbstractMaps* copy = zone->New<AbstractMaps>(zone);
for (auto this_it : this->info_for_node_) { for (auto this_it : this->info_for_node_) {
Node* this_object = this_it.first; Node* this_object = this_it.first;
ZoneHandleSet<Map> this_maps = this_it.second; ZoneHandleSet<Map> this_maps = this_it.second;
...@@ -382,7 +382,7 @@ LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Merge( ...@@ -382,7 +382,7 @@ LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Merge(
LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Extend( LoadElimination::AbstractMaps const* LoadElimination::AbstractMaps::Extend(
Node* object, ZoneHandleSet<Map> maps, Zone* zone) const { Node* object, ZoneHandleSet<Map> maps, Zone* zone) const {
AbstractMaps* that = new (zone) AbstractMaps(zone); AbstractMaps* that = zone->New<AbstractMaps>(zone);
that->info_for_node_ = this->info_for_node_; that->info_for_node_ = this->info_for_node_;
object = ResolveRenames(object); object = ResolveRenames(object);
that->info_for_node_[object] = maps; that->info_for_node_[object] = maps;
...@@ -480,11 +480,11 @@ bool LoadElimination::AbstractState::LookupMaps( ...@@ -480,11 +480,11 @@ bool LoadElimination::AbstractState::LookupMaps(
LoadElimination::AbstractState const* LoadElimination::AbstractState::SetMaps( LoadElimination::AbstractState const* LoadElimination::AbstractState::SetMaps(
Node* object, ZoneHandleSet<Map> maps, Zone* zone) const { Node* object, ZoneHandleSet<Map> maps, Zone* zone) const {
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
if (that->maps_) { if (that->maps_) {
that->maps_ = that->maps_->Extend(object, maps, zone); that->maps_ = that->maps_->Extend(object, maps, zone);
} else { } else {
that->maps_ = new (zone) AbstractMaps(object, maps, zone); that->maps_ = zone->New<AbstractMaps>(object, maps, zone);
} }
return that; return that;
} }
...@@ -494,7 +494,7 @@ LoadElimination::AbstractState const* LoadElimination::AbstractState::KillMaps( ...@@ -494,7 +494,7 @@ LoadElimination::AbstractState const* LoadElimination::AbstractState::KillMaps(
if (this->maps_) { if (this->maps_) {
AbstractMaps const* that_maps = this->maps_->Kill(alias_info, zone); AbstractMaps const* that_maps = this->maps_->Kill(alias_info, zone);
if (this->maps_ != that_maps) { if (this->maps_ != that_maps) {
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
that->maps_ = that_maps; that->maps_ = that_maps;
return that; return that;
} }
...@@ -521,13 +521,13 @@ LoadElimination::AbstractState::AddElement(Node* object, Node* index, ...@@ -521,13 +521,13 @@ LoadElimination::AbstractState::AddElement(Node* object, Node* index,
Node* value, Node* value,
MachineRepresentation representation, MachineRepresentation representation,
Zone* zone) const { Zone* zone) const {
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
if (that->elements_) { if (that->elements_) {
that->elements_ = that->elements_ =
that->elements_->Extend(object, index, value, representation, zone); that->elements_->Extend(object, index, value, representation, zone);
} else { } else {
that->elements_ = that->elements_ =
new (zone) AbstractElements(object, index, value, representation, zone); zone->New<AbstractElements>(object, index, value, representation, zone);
} }
return that; return that;
} }
...@@ -539,7 +539,7 @@ LoadElimination::AbstractState::KillElement(Node* object, Node* index, ...@@ -539,7 +539,7 @@ LoadElimination::AbstractState::KillElement(Node* object, Node* index,
AbstractElements const* that_elements = AbstractElements const* that_elements =
this->elements_->Kill(object, index, zone); this->elements_->Kill(object, index, zone);
if (this->elements_ != that_elements) { if (this->elements_ != that_elements) {
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
that->elements_ = that_elements; that->elements_ = that_elements;
return that; return that;
} }
...@@ -550,14 +550,14 @@ LoadElimination::AbstractState::KillElement(Node* object, Node* index, ...@@ -550,14 +550,14 @@ LoadElimination::AbstractState::KillElement(Node* object, Node* index,
LoadElimination::AbstractState const* LoadElimination::AbstractState::AddField( LoadElimination::AbstractState const* LoadElimination::AbstractState::AddField(
Node* object, IndexRange index_range, LoadElimination::FieldInfo info, Node* object, IndexRange index_range, LoadElimination::FieldInfo info,
Zone* zone) const { Zone* zone) const {
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
AbstractFields& fields = AbstractFields& fields =
info.const_field_info.IsConst() ? that->const_fields_ : that->fields_; info.const_field_info.IsConst() ? that->const_fields_ : that->fields_;
for (int index : index_range) { for (int index : index_range) {
if (fields[index]) { if (fields[index]) {
fields[index] = fields[index]->Extend(object, info, zone); fields[index] = fields[index]->Extend(object, info, zone);
} else { } else {
fields[index] = new (zone) AbstractField(object, info, zone); fields[index] = zone->New<AbstractField>(object, info, zone);
} }
} }
return that; return that;
...@@ -573,7 +573,7 @@ LoadElimination::AbstractState::KillConstField(Node* object, ...@@ -573,7 +573,7 @@ LoadElimination::AbstractState::KillConstField(Node* object,
if (AbstractField const* this_field = this->const_fields_[index]) { if (AbstractField const* this_field = this->const_fields_[index]) {
this_field = this_field->KillConst(object, zone); this_field = this_field->KillConst(object, zone);
if (this->const_fields_[index] != this_field) { if (this->const_fields_[index] != this_field) {
if (!that) that = new (zone) AbstractState(*this); if (!that) that = zone->New<AbstractState>(*this);
that->const_fields_[index] = this_field; that->const_fields_[index] = this_field;
} }
} }
...@@ -596,7 +596,7 @@ LoadElimination::AbstractState const* LoadElimination::AbstractState::KillField( ...@@ -596,7 +596,7 @@ LoadElimination::AbstractState const* LoadElimination::AbstractState::KillField(
if (AbstractField const* this_field = this->fields_[index]) { if (AbstractField const* this_field = this->fields_[index]) {
this_field = this_field->Kill(alias_info, name, zone); this_field = this_field->Kill(alias_info, name, zone);
if (this->fields_[index] != this_field) { if (this->fields_[index] != this_field) {
if (!that) that = new (zone) AbstractState(*this); if (!that) that = zone->New<AbstractState>(*this);
that->fields_[index] = this_field; that->fields_[index] = this_field;
} }
} }
...@@ -614,7 +614,7 @@ LoadElimination::AbstractState::KillFields(Node* object, MaybeHandle<Name> name, ...@@ -614,7 +614,7 @@ LoadElimination::AbstractState::KillFields(Node* object, MaybeHandle<Name> name,
AbstractField const* that_field = AbstractField const* that_field =
this_field->Kill(alias_info, name, zone); this_field->Kill(alias_info, name, zone);
if (that_field != this_field) { if (that_field != this_field) {
AbstractState* that = new (zone) AbstractState(*this); AbstractState* that = zone->New<AbstractState>(*this);
that->fields_[i] = that_field; that->fields_[i] = that_field;
while (++i < fields_.size()) { while (++i < fields_.size()) {
if (this->fields_[i] != nullptr) { if (this->fields_[i] != nullptr) {
...@@ -632,7 +632,7 @@ LoadElimination::AbstractState const* LoadElimination::AbstractState::KillAll( ...@@ -632,7 +632,7 @@ LoadElimination::AbstractState const* LoadElimination::AbstractState::KillAll(
// Kill everything except for const fields // Kill everything except for const fields
for (size_t i = 0; i < const_fields_.size(); ++i) { for (size_t i = 0; i < const_fields_.size(); ++i) {
if (const_fields_[i]) { if (const_fields_[i]) {
AbstractState* that = new (zone) AbstractState(); AbstractState* that = zone->New<AbstractState>();
that->const_fields_ = const_fields_; that->const_fields_ = const_fields_;
return that; return that;
} }
...@@ -1188,7 +1188,7 @@ Reduction LoadElimination::ReduceEffectPhi(Node* node) { ...@@ -1188,7 +1188,7 @@ Reduction LoadElimination::ReduceEffectPhi(Node* node) {
// Make a copy of the first input's state and merge with the state // Make a copy of the first input's state and merge with the state
// from other inputs. // from other inputs.
AbstractState* state = new (zone()) AbstractState(*state0); AbstractState* state = zone()->New<AbstractState>(*state0);
for (int i = 1; i < input_count; ++i) { for (int i = 1; i < input_count; ++i) {
Node* const input = NodeProperties::GetEffectInput(node, i); Node* const input = NodeProperties::GetEffectInput(node, i);
state->Merge(node_states_.Get(input), zone()); state->Merge(node_states_.Get(input), zone());
......
...@@ -59,7 +59,7 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -59,7 +59,7 @@ class V8_EXPORT_PRIVATE LoadElimination final
AbstractElements const* Extend(Node* object, Node* index, Node* value, AbstractElements const* Extend(Node* object, Node* index, Node* value,
MachineRepresentation representation, MachineRepresentation representation,
Zone* zone) const { Zone* zone) const {
AbstractElements* that = new (zone) AbstractElements(*this); AbstractElements* that = zone->New<AbstractElements>(*this);
that->elements_[that->next_index_] = that->elements_[that->next_index_] =
Element(object, index, value, representation); Element(object, index, value, representation);
that->next_index_ = (that->next_index_ + 1) % arraysize(elements_); that->next_index_ = (that->next_index_ + 1) % arraysize(elements_);
...@@ -134,7 +134,7 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -134,7 +134,7 @@ class V8_EXPORT_PRIVATE LoadElimination final
AbstractField const* Extend(Node* object, FieldInfo info, AbstractField const* Extend(Node* object, FieldInfo info,
Zone* zone) const { Zone* zone) const {
AbstractField* that = new (zone) AbstractField(zone); AbstractField* that = zone->New<AbstractField>(zone);
that->info_for_node_ = this->info_for_node_; that->info_for_node_ = this->info_for_node_;
that->info_for_node_[object] = info; that->info_for_node_[object] = info;
return that; return that;
...@@ -148,7 +148,7 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -148,7 +148,7 @@ class V8_EXPORT_PRIVATE LoadElimination final
} }
AbstractField const* Merge(AbstractField const* that, Zone* zone) const { AbstractField const* Merge(AbstractField const* that, Zone* zone) const {
if (this->Equals(that)) return this; if (this->Equals(that)) return this;
AbstractField* copy = new (zone) AbstractField(zone); AbstractField* copy = zone->New<AbstractField>(zone);
for (auto this_it : this->info_for_node_) { for (auto this_it : this->info_for_node_) {
Node* this_object = this_it.first; Node* this_object = this_it.first;
FieldInfo this_second = this_it.second; FieldInfo this_second = this_it.second;
......
...@@ -524,7 +524,7 @@ class LoopFinderImpl { ...@@ -524,7 +524,7 @@ class LoopFinderImpl {
LoopTree* LoopFinder::BuildLoopTree(Graph* graph, TickCounter* tick_counter, LoopTree* LoopFinder::BuildLoopTree(Graph* graph, TickCounter* tick_counter,
Zone* zone) { Zone* zone) {
LoopTree* loop_tree = LoopTree* loop_tree =
new (graph->zone()) LoopTree(graph->NodeCount(), graph->zone()); graph->zone()->New<LoopTree>(graph->NodeCount(), graph->zone());
LoopFinderImpl finder(graph, loop_tree, tick_counter, zone); LoopFinderImpl finder(graph, loop_tree, tick_counter, zone);
finder.Run(); finder.Run();
if (FLAG_trace_turbo_loop) { if (FLAG_trace_turbo_loop) {
......
...@@ -216,7 +216,7 @@ PeeledIteration* LoopPeeler::Peel(LoopTree::Loop* loop) { ...@@ -216,7 +216,7 @@ PeeledIteration* LoopPeeler::Peel(LoopTree::Loop* loop) {
//============================================================================ //============================================================================
// Construct the peeled iteration. // Construct the peeled iteration.
//============================================================================ //============================================================================
PeeledIterationImpl* iter = new (tmp_zone_) PeeledIterationImpl(tmp_zone_); PeeledIterationImpl* iter = tmp_zone_->New<PeeledIterationImpl>(tmp_zone_);
size_t estimated_peeled_size = 5 + (loop->TotalSize()) * 2; size_t estimated_peeled_size = 5 + (loop->TotalSize()) * 2;
Peeling peeling(graph_, estimated_peeled_size, &iter->node_pairs_); Peeling peeling(graph_, estimated_peeled_size, &iter->node_pairs_);
......
...@@ -260,7 +260,7 @@ InductionVariable* LoopVariableOptimizer::TryGetInductionVariable(Node* phi) { ...@@ -260,7 +260,7 @@ InductionVariable* LoopVariableOptimizer::TryGetInductionVariable(Node* phi) {
if (!effect_phi) return nullptr; if (!effect_phi) return nullptr;
Node* incr = arith->InputAt(1); Node* incr = arith->InputAt(1);
return new (zone()) InductionVariable(phi, effect_phi, arith, incr, initial, return zone()->New<InductionVariable>(phi, effect_phi, arith, incr, initial,
zone(), arithmeticType); zone(), arithmeticType);
} }
......
...@@ -41,6 +41,7 @@ class InductionVariable : public ZoneObject { ...@@ -41,6 +41,7 @@ class InductionVariable : public ZoneObject {
private: private:
friend class LoopVariableOptimizer; friend class LoopVariableOptimizer;
friend Zone;
InductionVariable(Node* phi, Node* effect_phi, Node* arith, Node* increment, InductionVariable(Node* phi, Node* effect_phi, Node* arith, Node* increment,
Node* init_value, Zone* zone, ArithmeticType arithmeticType) Node* init_value, Zone* zone, ArithmeticType arithmeticType)
......
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