Commit 9db60f2b authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[zone] Cleanup zone allocations in src/interpreter and tests

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

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

Bug: v8:10689
Change-Id: Ic7d893b8d6772bd923c37c3d1e7cff5cc6667192
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2288868
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68786}
parent e4e57d16
......@@ -59,9 +59,9 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(
DCHECK_GE(local_register_count_, 0);
if (FLAG_ignition_reo) {
register_optimizer_ = new (zone) BytecodeRegisterOptimizer(
register_optimizer_ = zone->New<BytecodeRegisterOptimizer>(
zone, &register_allocator_, fixed_register_count(), parameter_count,
new (zone) RegisterTransferWriter(this));
zone->New<RegisterTransferWriter>(this));
}
}
......@@ -1554,8 +1554,8 @@ BytecodeJumpTable* BytecodeArrayBuilder::AllocateJumpTable(
size_t constant_pool_index = constant_array_builder()->InsertJumpTable(size);
return new (zone())
BytecodeJumpTable(constant_pool_index, size, case_value_base, zone());
return zone()->New<BytecodeJumpTable>(constant_pool_index, size,
case_value_base, zone());
}
size_t BytecodeArrayBuilder::AllocateDeferredConstantPoolEntry() {
......
......@@ -1007,7 +1007,7 @@ class AccessorTable
Accessors<PropertyT>* LookupOrInsert(Literal* key) {
auto it = this->find(key, true, ZoneAllocationPolicy(zone_));
if (it->second == nullptr) {
it->second = new (zone_) Accessors<PropertyT>();
it->second = zone_->New<Accessors<PropertyT>>();
ordered_accessors_.push_back({key, it->second});
}
return it->second;
......@@ -1052,8 +1052,8 @@ BytecodeGenerator::BytecodeGenerator(
closure_scope_(info->scope()),
current_scope_(info->scope()),
eager_inner_literals_(eager_inner_literals),
feedback_slot_cache_(new (zone()) FeedbackSlotCache(zone())),
top_level_builder_(new (zone()) TopLevelDeclarationsBuilder()),
feedback_slot_cache_(zone()->New<FeedbackSlotCache>(zone())),
top_level_builder_(zone()->New<TopLevelDeclarationsBuilder>()),
block_coverage_builder_(nullptr),
function_literals_(0, zone()),
native_function_literals_(0, zone()),
......@@ -1074,8 +1074,8 @@ BytecodeGenerator::BytecodeGenerator(
catch_prediction_(HandlerTable::UNCAUGHT) {
DCHECK_EQ(closure_scope(), closure_scope()->GetClosureScope());
if (info->has_source_range_map()) {
block_coverage_builder_ = new (zone())
BlockCoverageBuilder(zone(), builder(), info->source_range_map());
block_coverage_builder_ = zone()->New<BlockCoverageBuilder>(
zone(), builder(), info->source_range_map());
}
}
......
......@@ -246,7 +246,7 @@ BytecodeRegisterOptimizer::BytecodeRegisterOptimizer(
register_info_table_.resize(register_info_table_offset_ +
static_cast<size_t>(temporary_base_.index()));
for (size_t i = 0; i < register_info_table_.size(); ++i) {
register_info_table_[i] = new (zone) RegisterInfo(
register_info_table_[i] = zone->New<RegisterInfo>(
RegisterFromRegisterInfoTableIndex(i), NextEquivalenceId(), true, true);
DCHECK_EQ(register_info_table_[i]->register_value().index(),
RegisterFromRegisterInfoTableIndex(i).index());
......@@ -474,7 +474,7 @@ void BytecodeRegisterOptimizer::GrowRegisterMap(Register reg) {
register_info_table_.resize(new_size);
for (size_t i = old_size; i < new_size; ++i) {
register_info_table_[i] =
new (zone()) RegisterInfo(RegisterFromRegisterInfoTableIndex(i),
zone()->New<RegisterInfo>(RegisterFromRegisterInfoTableIndex(i),
NextEquivalenceId(), true, false);
}
}
......
......@@ -140,10 +140,10 @@ ConstantArrayBuilder::ConstantArrayBuilder(Zone* zone)
#undef INIT_SINGLETON_ENTRY_FIELD
zone_(zone) {
idx_slice_[0] =
new (zone) ConstantArraySlice(zone, 0, k8BitCapacity, OperandSize::kByte);
idx_slice_[1] = new (zone) ConstantArraySlice(
zone->New<ConstantArraySlice>(zone, 0, k8BitCapacity, OperandSize::kByte);
idx_slice_[1] = zone->New<ConstantArraySlice>(
zone, k8BitCapacity, k16BitCapacity, OperandSize::kShort);
idx_slice_[2] = new (zone) ConstantArraySlice(
idx_slice_[2] = zone->New<ConstantArraySlice>(
zone, k8BitCapacity + k16BitCapacity, k32BitCapacity, OperandSize::kQuad);
}
......
......@@ -28,9 +28,9 @@ class BytecodeRegisterOptimizerTest
void Initialize(int number_of_parameters, int number_of_locals) {
register_allocator_ = new BytecodeRegisterAllocator(number_of_locals);
register_optimizer_ = new (zone())
BytecodeRegisterOptimizer(zone(), register_allocator_, number_of_locals,
number_of_parameters, this);
register_optimizer_ = zone()->New<BytecodeRegisterOptimizer>(
zone(), register_allocator_, number_of_locals, number_of_parameters,
this);
}
void EmitLdar(Register input) override {
......
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