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