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

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

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

Bug: v8:10689
Change-Id: Iea6c1225ee672035763d8141292a40874658d270
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2288864
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68788}
This commit is contained in:
Igor Sheludko 2020-07-09 12:50:27 +02:00 committed by Commit Bot
parent ab2b18e1be
commit 734ea68230
30 changed files with 167 additions and 164 deletions

View File

@ -193,7 +193,7 @@ class SafepointTableBuilder {
: pc(pc), : pc(pc),
deopt_index(Safepoint::kNoDeoptimizationIndex), deopt_index(Safepoint::kNoDeoptimizationIndex),
trampoline(-1), trampoline(-1),
indexes(new (zone) ZoneChunkList<int>( indexes(zone->New<ZoneChunkList<int>>(
zone, ZoneChunkList<int>::StartMode::kSmall)) {} zone, ZoneChunkList<int>::StartMode::kSmall)) {}
}; };

View File

@ -89,7 +89,7 @@ class Signature : public ZoneObject {
Signature<T>* Build() { Signature<T>* Build() {
DCHECK_EQ(rcursor_, return_count_); DCHECK_EQ(rcursor_, return_count_);
DCHECK_EQ(pcursor_, parameter_count_); DCHECK_EQ(pcursor_, parameter_count_);
return new (zone_) Signature<T>(return_count_, parameter_count_, buffer_); return zone_->New<Signature<T>>(return_count_, parameter_count_, buffer_);
} }
private: private:

View File

@ -1027,7 +1027,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
offset = Operand(reg); offset = Operand(reg);
__ str(value, MemOperand(object, reg)); __ str(value, MemOperand(object, reg));
} }
auto ool = new (zone()) OutOfLineRecordWrite( auto ool = zone()->New<OutOfLineRecordWrite>(
this, object, offset, value, mode, DetermineStubCallMode(), this, object, offset, value, mode, DetermineStubCallMode(),
&unwinding_info_writer_); &unwinding_info_writer_);
__ CheckPageFlag(object, MemoryChunk::kPointersFromHereAreInterestingMask, __ CheckPageFlag(object, MemoryChunk::kPointersFromHereAreInterestingMask,
@ -1731,7 +1731,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
if (left == right) { if (left == right) {
__ Move(result, left); __ Move(result, left);
} else { } else {
auto ool = new (zone()) OutOfLineFloat32Max(this, result, left, right); auto ool = zone()->New<OutOfLineFloat32Max>(this, result, left, right);
__ FloatMax(result, left, right, ool->entry()); __ FloatMax(result, left, right, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
} }
@ -1745,7 +1745,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
if (left == right) { if (left == right) {
__ Move(result, left); __ Move(result, left);
} else { } else {
auto ool = new (zone()) OutOfLineFloat64Max(this, result, left, right); auto ool = zone()->New<OutOfLineFloat64Max>(this, result, left, right);
__ FloatMax(result, left, right, ool->entry()); __ FloatMax(result, left, right, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
} }
@ -1759,7 +1759,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
if (left == right) { if (left == right) {
__ Move(result, left); __ Move(result, left);
} else { } else {
auto ool = new (zone()) OutOfLineFloat32Min(this, result, left, right); auto ool = zone()->New<OutOfLineFloat32Min>(this, result, left, right);
__ FloatMin(result, left, right, ool->entry()); __ FloatMin(result, left, right, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
} }
@ -1773,7 +1773,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
if (left == right) { if (left == right) {
__ Move(result, left); __ Move(result, left);
} else { } else {
auto ool = new (zone()) OutOfLineFloat64Min(this, result, left, right); auto ool = zone()->New<OutOfLineFloat64Min>(this, result, left, right);
__ FloatMin(result, left, right, ool->entry()); __ FloatMin(result, left, right, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
} }
@ -1911,10 +1911,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
if (left == right) { if (left == right) {
__ Move(result, left); __ Move(result, left);
} else { } else {
auto ool_low = new (zone()) auto ool_low = zone()->New<OutOfLineFloat64Min>(
OutOfLineFloat64Min(this, result.low(), left.low(), right.low()); this, result.low(), left.low(), right.low());
auto ool_high = new (zone()) auto ool_high = zone()->New<OutOfLineFloat64Min>(
OutOfLineFloat64Min(this, result.high(), left.high(), right.high()); this, result.high(), left.high(), right.high());
__ FloatMin(result.low(), left.low(), right.low(), ool_low->entry()); __ FloatMin(result.low(), left.low(), right.low(), ool_low->entry());
__ bind(ool_low->exit()); __ bind(ool_low->exit());
__ FloatMin(result.high(), left.high(), right.high(), __ FloatMin(result.high(), left.high(), right.high(),
@ -1931,10 +1931,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
if (left == right) { if (left == right) {
__ Move(result, left); __ Move(result, left);
} else { } else {
auto ool_low = new (zone()) auto ool_low = zone()->New<OutOfLineFloat64Max>(
OutOfLineFloat64Max(this, result.low(), left.low(), right.low()); this, result.low(), left.low(), right.low());
auto ool_high = new (zone()) auto ool_high = zone()->New<OutOfLineFloat64Max>(
OutOfLineFloat64Max(this, result.high(), left.high(), right.high()); this, result.high(), left.high(), right.high());
__ FloatMax(result.low(), left.low(), right.low(), ool_low->entry()); __ FloatMax(result.low(), left.low(), right.low(), ool_low->entry());
__ bind(ool_low->exit()); __ bind(ool_low->exit());
__ FloatMax(result.high(), left.high(), right.high(), __ FloatMax(result.high(), left.high(), right.high(),
@ -3544,7 +3544,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();
@ -3555,7 +3555,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Instruction* instr_; Instruction* instr_;
CodeGenerator* gen_; CodeGenerator* gen_;
}; };
auto ool = new (zone()) OutOfLineTrap(this, instr); auto ool = zone()->New<OutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Condition cc = FlagsConditionToCondition(condition); Condition cc = FlagsConditionToCondition(condition);
__ b(cc, tlabel); __ b(cc, tlabel);
@ -3714,7 +3714,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();

View File

@ -46,7 +46,7 @@ void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) {
DCHECK_EQ(existing_state->saved_lr_, saved_lr_); DCHECK_EQ(existing_state->saved_lr_, saved_lr_);
} else { } else {
block_initial_states_[successor_index] = block_initial_states_[successor_index] =
new (zone_) BlockInitialState(saved_lr_); zone_->New<BlockInitialState>(saved_lr_);
} }
} }
} }

View File

@ -950,7 +950,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
offset = Operand(i.InputRegister(1)); offset = Operand(i.InputRegister(1));
} }
Register value = i.InputRegister(2); Register value = i.InputRegister(2);
auto ool = new (zone()) OutOfLineRecordWrite( auto ool = zone()->New<OutOfLineRecordWrite>(
this, object, offset, value, mode, DetermineStubCallMode(), this, object, offset, value, mode, DetermineStubCallMode(),
&unwinding_info_writer_); &unwinding_info_writer_);
__ StoreTaggedField(value, MemOperand(object, offset)); __ StoreTaggedField(value, MemOperand(object, offset));
@ -2788,7 +2788,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
// The trap code should never return. // The trap code should never return.
@ -2799,7 +2799,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Instruction* instr_; Instruction* instr_;
CodeGenerator* gen_; CodeGenerator* gen_;
}; };
auto ool = new (zone()) OutOfLineTrap(this, instr); auto ool = zone()->New<OutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Condition cc = FlagsConditionToCondition(condition); Condition cc = FlagsConditionToCondition(condition);
__ B(cc, tlabel); __ B(cc, tlabel);
@ -2957,7 +2957,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ Brk(0); __ Brk(0);

View File

@ -50,7 +50,7 @@ void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) {
DCHECK_EQ(existing_state->saved_lr_, saved_lr_); DCHECK_EQ(existing_state->saved_lr_, saved_lr_);
} else { } else {
block_initial_states_[successor_index] = block_initial_states_[successor_index] =
new (zone_) BlockInitialState(saved_lr_); zone_->New<BlockInitialState>(saved_lr_);
} }
} }
} }

View File

@ -114,7 +114,7 @@ void CodeGenerator::AddProtectedInstructionLanding(uint32_t instr_offset,
void CodeGenerator::CreateFrameAccessState(Frame* frame) { void CodeGenerator::CreateFrameAccessState(Frame* frame) {
FinishFrame(frame); FinishFrame(frame);
frame_access_state_ = new (zone()) FrameAccessState(frame); frame_access_state_ = zone()->New<FrameAccessState>(frame);
} }
bool CodeGenerator::ShouldApplyOffsetToStackCheck(Instruction* instr, bool CodeGenerator::ShouldApplyOffsetToStackCheck(Instruction* instr,
@ -971,7 +971,7 @@ Handle<DeoptimizationData> CodeGenerator::GenerateDeoptimizationData() {
} }
Label* CodeGenerator::AddJumpTable(Label** targets, size_t target_count) { Label* CodeGenerator::AddJumpTable(Label** targets, size_t target_count) {
jump_tables_ = new (zone()) JumpTable(jump_tables_, targets, target_count); jump_tables_ = zone()->New<JumpTable>(jump_tables_, targets, target_count);
return jump_tables_->label(); return jump_tables_->label();
} }
@ -1163,7 +1163,7 @@ DeoptimizationExit* CodeGenerator::BuildTranslation(
BuildTranslationForFrameStateDescriptor(descriptor, &iter, &translation, BuildTranslationForFrameStateDescriptor(descriptor, &iter, &translation,
state_combine); state_combine);
DeoptimizationExit* const exit = new (zone()) DeoptimizationExit( DeoptimizationExit* const exit = zone()->New<DeoptimizationExit>(
current_source_position_, descriptor->bailout_id(), translation.index(), current_source_position_, descriptor->bailout_id(), translation.index(),
pc_offset, entry.kind(), entry.reason()); pc_offset, entry.kind(), entry.reason());

View File

@ -970,7 +970,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kArchTruncateDoubleToI: { case kArchTruncateDoubleToI: {
auto result = i.OutputRegister(); auto result = i.OutputRegister();
auto input = i.InputDoubleRegister(0); auto input = i.InputDoubleRegister(0);
auto ool = new (zone()) OutOfLineTruncateDoubleToI( auto ool = zone()->New<OutOfLineTruncateDoubleToI>(
this, result, input, DetermineStubCallMode()); this, result, input, DetermineStubCallMode());
__ cvttsd2si(result, Operand(input)); __ cvttsd2si(result, Operand(input));
__ cmp(result, 1); __ cmp(result, 1);
@ -987,9 +987,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Register value = i.InputRegister(index); Register value = i.InputRegister(index);
Register scratch0 = i.TempRegister(0); Register scratch0 = i.TempRegister(0);
Register scratch1 = i.TempRegister(1); Register scratch1 = i.TempRegister(1);
auto ool = new (zone()) auto ool = zone()->New<OutOfLineRecordWrite>(this, object, operand, value,
OutOfLineRecordWrite(this, object, operand, value, scratch0, scratch1, scratch0, scratch1, mode,
mode, DetermineStubCallMode()); DetermineStubCallMode());
__ mov(operand, value); __ mov(operand, value);
__ CheckPageFlag(object, scratch0, __ CheckPageFlag(object, scratch0,
MemoryChunk::kPointersFromHereAreInterestingMask, MemoryChunk::kPointersFromHereAreInterestingMask,
@ -1339,7 +1339,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ ucomiss(i.InputDoubleRegister(0), i.InputOperand(1)); __ ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat32NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(above, &done_compare, Label::kNear); __ j(above, &done_compare, Label::kNear);
__ j(below, &compare_swap, Label::kNear); __ j(below, &compare_swap, Label::kNear);
@ -1365,7 +1365,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat64NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(above, &done_compare, Label::kNear); __ j(above, &done_compare, Label::kNear);
__ j(below, &compare_swap, Label::kNear); __ j(below, &compare_swap, Label::kNear);
@ -1390,7 +1390,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ ucomiss(i.InputDoubleRegister(0), i.InputOperand(1)); __ ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat32NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(below, &done_compare, Label::kNear); __ j(below, &done_compare, Label::kNear);
__ j(above, &compare_swap, Label::kNear); __ j(above, &compare_swap, Label::kNear);
@ -1420,7 +1420,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat64NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(below, &done_compare, Label::kNear); __ j(below, &done_compare, Label::kNear);
__ j(above, &compare_swap, Label::kNear); __ j(above, &compare_swap, Label::kNear);
@ -4451,7 +4451,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ wasm_call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ wasm_call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
__ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap); __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
} }
@ -4460,7 +4460,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Instruction* instr_; Instruction* instr_;
CodeGenerator* gen_; CodeGenerator* gen_;
}; };
auto ool = new (zone()) OutOfLineTrap(this, instr); auto ool = zone()->New<OutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Label end; Label end;
if (condition == kUnorderedEqual) { if (condition == kUnorderedEqual) {
@ -4761,7 +4761,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ wasm_call(wasm::WasmCode::kWasmStackOverflow, __ wasm_call(wasm::WasmCode::kWasmStackOverflow,
RelocInfo::WASM_STUB_CALL); RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
__ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap); __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
__ bind(&done); __ bind(&done);

View File

@ -108,7 +108,7 @@ void InstructionScheduler::EndBlock(RpoNumber rpo) {
} }
void InstructionScheduler::AddTerminator(Instruction* instr) { void InstructionScheduler::AddTerminator(Instruction* instr) {
ScheduleGraphNode* new_node = new (zone()) ScheduleGraphNode(zone(), instr); ScheduleGraphNode* new_node = zone()->New<ScheduleGraphNode>(zone(), instr);
// Make sure that basic block terminators are not moved by adding them // Make sure that basic block terminators are not moved by adding them
// as successor of every instruction. // as successor of every instruction.
for (ScheduleGraphNode* node : graph_) { for (ScheduleGraphNode* node : graph_) {
@ -128,7 +128,7 @@ void InstructionScheduler::AddInstruction(Instruction* instr) {
return; return;
} }
ScheduleGraphNode* new_node = new (zone()) ScheduleGraphNode(zone(), instr); ScheduleGraphNode* new_node = zone()->New<ScheduleGraphNode>(zone(), instr);
// We should not have branches in the middle of a block. // We should not have branches in the middle of a block.
DCHECK_NE(instr->flags_mode(), kFlags_branch); DCHECK_NE(instr->flags_mode(), kFlags_branch);

View File

@ -97,7 +97,7 @@ bool InstructionSelector::SelectInstructions() {
// Schedule the selected instructions. // Schedule the selected instructions.
if (UseInstructionScheduling()) { if (UseInstructionScheduling()) {
scheduler_ = new (zone()) InstructionScheduler(zone(), sequence()); scheduler_ = zone()->New<InstructionScheduler>(zone(), sequence());
} }
for (auto const block : *blocks) { for (auto const block : *blocks) {
@ -2750,9 +2750,9 @@ void InstructionSelector::VisitOsrValue(Node* node) {
void InstructionSelector::VisitPhi(Node* node) { void InstructionSelector::VisitPhi(Node* node) {
const int input_count = node->op()->ValueInputCount(); const int input_count = node->op()->ValueInputCount();
DCHECK_EQ(input_count, current_block_->PredecessorCount()); DCHECK_EQ(input_count, current_block_->PredecessorCount());
PhiInstruction* phi = new (instruction_zone()) PhiInstruction* phi = instruction_zone()->New<PhiInstruction>(
PhiInstruction(instruction_zone(), GetVirtualRegister(node), instruction_zone(), GetVirtualRegister(node),
static_cast<size_t>(input_count)); static_cast<size_t>(input_count));
sequence() sequence()
->InstructionBlockAt(RpoNumber::FromInt(current_block_->rpo_number())) ->InstructionBlockAt(RpoNumber::FromInt(current_block_->rpo_number()))
->AddPhi(phi); ->AddPhi(phi);
@ -3136,10 +3136,10 @@ FrameStateDescriptor* GetFrameStateDescriptorInternal(Zone* zone, Node* state) {
outer_state = GetFrameStateDescriptorInternal(zone, outer_node); outer_state = GetFrameStateDescriptorInternal(zone, outer_node);
} }
return new (zone) return zone->New<FrameStateDescriptor>(
FrameStateDescriptor(zone, state_info.type(), state_info.bailout_id(), zone, state_info.type(), state_info.bailout_id(),
state_info.state_combine(), parameters, locals, state_info.state_combine(), parameters, locals, stack,
stack, state_info.shared_info(), outer_state); state_info.shared_info(), outer_state);
} }
} // namespace } // namespace

View File

@ -611,9 +611,9 @@ static InstructionBlock* InstructionBlockFor(Zone* zone,
const BasicBlock* block) { const BasicBlock* block) {
bool is_handler = bool is_handler =
!block->empty() && block->front()->opcode() == IrOpcode::kIfException; !block->empty() && block->front()->opcode() == IrOpcode::kIfException;
InstructionBlock* instr_block = new (zone) InstructionBlock* instr_block = zone->New<InstructionBlock>(
InstructionBlock(zone, GetRpo(block), GetRpo(block->loop_header()), zone, GetRpo(block), GetRpo(block->loop_header()), GetLoopEndRpo(block),
GetLoopEndRpo(block), block->deferred(), is_handler); block->deferred(), is_handler);
// Map successors and precessors // Map successors and precessors
instr_block->successors().reserve(block->SuccessorCount()); instr_block->successors().reserve(block->SuccessorCount());
for (BasicBlock* successor : block->successors()) { for (BasicBlock* successor : block->successors()) {
@ -863,7 +863,7 @@ int InstructionSequence::AddInstruction(Instruction* instr) {
instructions_.push_back(instr); instructions_.push_back(instr);
if (instr->NeedsReferenceMap()) { if (instr->NeedsReferenceMap()) {
DCHECK_NULL(instr->reference_map()); DCHECK_NULL(instr->reference_map());
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
reference_map->set_instruction_position(index); reference_map->set_instruction_position(index);
instr->set_reference_map(reference_map); instr->set_reference_map(reference_map);
reference_maps_.push_back(reference_map); reference_maps_.push_back(reference_map);

View File

@ -90,8 +90,7 @@ class V8_EXPORT_PRIVATE InstructionOperand {
template <typename SubKindOperand> template <typename SubKindOperand>
static SubKindOperand* New(Zone* zone, const SubKindOperand& op) { static SubKindOperand* New(Zone* zone, const SubKindOperand& op) {
void* buffer = zone->New(sizeof(op)); return zone->New<SubKindOperand>(op);
return new (buffer) SubKindOperand(op);
} }
static void ReplaceWith(InstructionOperand* dest, static void ReplaceWith(InstructionOperand* dest,
@ -704,7 +703,7 @@ class V8_EXPORT_PRIVATE ParallelMove final
const InstructionOperand& to, const InstructionOperand& to,
Zone* operand_allocation_zone) { Zone* operand_allocation_zone) {
if (from.EqualsCanonicalized(to)) return nullptr; if (from.EqualsCanonicalized(to)) return nullptr;
MoveOperands* move = new (operand_allocation_zone) MoveOperands(from, to); MoveOperands* move = operand_allocation_zone->New<MoveOperands>(from, to);
if (empty()) reserve(4); if (empty()) reserve(4);
push_back(move); push_back(move);
return move; return move;
@ -817,7 +816,7 @@ class V8_EXPORT_PRIVATE Instruction final {
int size = static_cast<int>( int size = static_cast<int>(
RoundUp(sizeof(Instruction), sizeof(InstructionOperand)) + RoundUp(sizeof(Instruction), sizeof(InstructionOperand)) +
total_extra_ops * sizeof(InstructionOperand)); total_extra_ops * sizeof(InstructionOperand));
return new (zone->New(size)) Instruction( return new (zone->Allocate<Instruction>(size)) Instruction(
opcode, output_count, outputs, input_count, inputs, temp_count, temps); opcode, output_count, outputs, input_count, inputs, temp_count, temps);
} }
@ -876,7 +875,7 @@ class V8_EXPORT_PRIVATE Instruction final {
ParallelMove* GetOrCreateParallelMove(GapPosition pos, Zone* zone) { ParallelMove* GetOrCreateParallelMove(GapPosition pos, Zone* zone) {
if (parallel_moves_[pos] == nullptr) { if (parallel_moves_[pos] == nullptr) {
parallel_moves_[pos] = new (zone) ParallelMove(zone); parallel_moves_[pos] = zone->New<ParallelMove>(zone);
} }
return parallel_moves_[pos]; return parallel_moves_[pos];
} }
@ -1195,8 +1194,7 @@ class StateValueList {
StateValueList* PushRecursiveField(Zone* zone, size_t id) { StateValueList* PushRecursiveField(Zone* zone, size_t id) {
fields_.push_back(StateValueDescriptor::Recursive(id)); fields_.push_back(StateValueDescriptor::Recursive(id));
StateValueList* nested = StateValueList* nested = zone->New<StateValueList>(zone);
new (zone->New(sizeof(StateValueList))) StateValueList(zone);
nested_.push_back(nested); nested_.push_back(nested);
return nested; return nested;
} }

View File

@ -903,9 +903,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Register value = i.InputRegister(2); Register value = i.InputRegister(2);
Register scratch0 = i.TempRegister(0); Register scratch0 = i.TempRegister(0);
Register scratch1 = i.TempRegister(1); Register scratch1 = i.TempRegister(1);
auto ool = new (zone()) auto ool = zone()->New<OutOfLineRecordWrite>(this, object, index, value,
OutOfLineRecordWrite(this, object, index, value, scratch0, scratch1, scratch0, scratch1, mode,
mode, DetermineStubCallMode()); DetermineStubCallMode());
__ Addu(kScratchReg, object, index); __ Addu(kScratchReg, object, index);
__ sw(value, MemOperand(kScratchReg)); __ sw(value, MemOperand(kScratchReg));
__ CheckPageFlag(object, scratch0, __ CheckPageFlag(object, scratch0,
@ -1387,7 +1387,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
FPURegister dst = i.OutputSingleRegister(); FPURegister dst = i.OutputSingleRegister();
FPURegister src1 = i.InputSingleRegister(0); FPURegister src1 = i.InputSingleRegister(0);
FPURegister src2 = i.InputSingleRegister(1); FPURegister src2 = i.InputSingleRegister(1);
auto ool = new (zone()) OutOfLineFloat32Max(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat32Max>(this, dst, src1, src2);
__ Float32Max(dst, src1, src2, ool->entry()); __ Float32Max(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -1396,7 +1396,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
DoubleRegister dst = i.OutputDoubleRegister(); DoubleRegister dst = i.OutputDoubleRegister();
DoubleRegister src1 = i.InputDoubleRegister(0); DoubleRegister src1 = i.InputDoubleRegister(0);
DoubleRegister src2 = i.InputDoubleRegister(1); DoubleRegister src2 = i.InputDoubleRegister(1);
auto ool = new (zone()) OutOfLineFloat64Max(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat64Max>(this, dst, src1, src2);
__ Float64Max(dst, src1, src2, ool->entry()); __ Float64Max(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -1405,7 +1405,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
FPURegister dst = i.OutputSingleRegister(); FPURegister dst = i.OutputSingleRegister();
FPURegister src1 = i.InputSingleRegister(0); FPURegister src1 = i.InputSingleRegister(0);
FPURegister src2 = i.InputSingleRegister(1); FPURegister src2 = i.InputSingleRegister(1);
auto ool = new (zone()) OutOfLineFloat32Min(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat32Min>(this, dst, src1, src2);
__ Float32Min(dst, src1, src2, ool->entry()); __ Float32Min(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -1414,7 +1414,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
DoubleRegister dst = i.OutputDoubleRegister(); DoubleRegister dst = i.OutputDoubleRegister();
DoubleRegister src1 = i.InputDoubleRegister(0); DoubleRegister src1 = i.InputDoubleRegister(0);
DoubleRegister src2 = i.InputDoubleRegister(1); DoubleRegister src2 = i.InputDoubleRegister(1);
auto ool = new (zone()) OutOfLineFloat64Min(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat64Min>(this, dst, src1, src2);
__ Float64Min(dst, src1, src2, ool->entry()); __ Float64Min(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -3683,7 +3683,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();
@ -3694,7 +3694,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Instruction* instr_; Instruction* instr_;
CodeGenerator* gen_; CodeGenerator* gen_;
}; };
auto ool = new (zone()) OutOfLineTrap(this, instr); auto ool = zone()->New<OutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
AssembleBranchToLabels(this, tasm(), instr, condition, tlabel, nullptr, true); AssembleBranchToLabels(this, tasm(), instr, condition, tlabel, nullptr, true);
} }
@ -3976,7 +3976,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();

View File

@ -882,9 +882,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Register value = i.InputRegister(2); Register value = i.InputRegister(2);
Register scratch0 = i.TempRegister(0); Register scratch0 = i.TempRegister(0);
Register scratch1 = i.TempRegister(1); Register scratch1 = i.TempRegister(1);
auto ool = new (zone()) auto ool = zone()->New<OutOfLineRecordWrite>(this, object, index, value,
OutOfLineRecordWrite(this, object, index, value, scratch0, scratch1, scratch0, scratch1, mode,
mode, DetermineStubCallMode()); DetermineStubCallMode());
__ Daddu(kScratchReg, object, index); __ Daddu(kScratchReg, object, index);
__ Sd(value, MemOperand(kScratchReg)); __ Sd(value, MemOperand(kScratchReg));
__ CheckPageFlag(object, scratch0, __ CheckPageFlag(object, scratch0,
@ -1431,7 +1431,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
FPURegister dst = i.OutputSingleRegister(); FPURegister dst = i.OutputSingleRegister();
FPURegister src1 = i.InputSingleRegister(0); FPURegister src1 = i.InputSingleRegister(0);
FPURegister src2 = i.InputSingleRegister(1); FPURegister src2 = i.InputSingleRegister(1);
auto ool = new (zone()) OutOfLineFloat32Max(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat32Max>(this, dst, src1, src2);
__ Float32Max(dst, src1, src2, ool->entry()); __ Float32Max(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -1440,7 +1440,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
FPURegister dst = i.OutputDoubleRegister(); FPURegister dst = i.OutputDoubleRegister();
FPURegister src1 = i.InputDoubleRegister(0); FPURegister src1 = i.InputDoubleRegister(0);
FPURegister src2 = i.InputDoubleRegister(1); FPURegister src2 = i.InputDoubleRegister(1);
auto ool = new (zone()) OutOfLineFloat64Max(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat64Max>(this, dst, src1, src2);
__ Float64Max(dst, src1, src2, ool->entry()); __ Float64Max(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -1449,7 +1449,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
FPURegister dst = i.OutputSingleRegister(); FPURegister dst = i.OutputSingleRegister();
FPURegister src1 = i.InputSingleRegister(0); FPURegister src1 = i.InputSingleRegister(0);
FPURegister src2 = i.InputSingleRegister(1); FPURegister src2 = i.InputSingleRegister(1);
auto ool = new (zone()) OutOfLineFloat32Min(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat32Min>(this, dst, src1, src2);
__ Float32Min(dst, src1, src2, ool->entry()); __ Float32Min(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -1458,7 +1458,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
FPURegister dst = i.OutputDoubleRegister(); FPURegister dst = i.OutputDoubleRegister();
FPURegister src1 = i.InputDoubleRegister(0); FPURegister src1 = i.InputDoubleRegister(0);
FPURegister src2 = i.InputDoubleRegister(1); FPURegister src2 = i.InputDoubleRegister(1);
auto ool = new (zone()) OutOfLineFloat64Min(this, dst, src1, src2); auto ool = zone()->New<OutOfLineFloat64Min>(this, dst, src1, src2);
__ Float64Min(dst, src1, src2, ool->entry()); __ Float64Min(dst, src1, src2, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -3951,7 +3951,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();
@ -3961,7 +3961,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Instruction* instr_; Instruction* instr_;
CodeGenerator* gen_; CodeGenerator* gen_;
}; };
auto ool = new (zone()) OutOfLineTrap(this, instr); auto ool = zone()->New<OutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
AssembleBranchToLabels(this, tasm(), instr, condition, tlabel, nullptr, true); AssembleBranchToLabels(this, tasm(), instr, condition, tlabel, nullptr, true);
} }
@ -4256,7 +4256,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();

View File

@ -1194,14 +1194,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
AddressingModeField::decode(instr->opcode()); AddressingModeField::decode(instr->opcode());
if (addressing_mode == kMode_MRI) { if (addressing_mode == kMode_MRI) {
int32_t offset = i.InputInt32(1); int32_t offset = i.InputInt32(1);
ool = new (zone()) OutOfLineRecordWrite( ool = zone()->New<OutOfLineRecordWrite>(
this, object, offset, value, scratch0, scratch1, mode, this, object, offset, value, scratch0, scratch1, mode,
DetermineStubCallMode(), &unwinding_info_writer_); DetermineStubCallMode(), &unwinding_info_writer_);
__ StoreTaggedField(value, MemOperand(object, offset), r0); __ StoreTaggedField(value, MemOperand(object, offset), r0);
} else { } else {
DCHECK_EQ(kMode_MRR, addressing_mode); DCHECK_EQ(kMode_MRR, addressing_mode);
Register offset(i.InputRegister(1)); Register offset(i.InputRegister(1));
ool = new (zone()) OutOfLineRecordWrite( ool = zone()->New<OutOfLineRecordWrite>(
this, object, offset, value, scratch0, scratch1, mode, this, object, offset, value, scratch0, scratch1, mode,
DetermineStubCallMode(), &unwinding_info_writer_); DetermineStubCallMode(), &unwinding_info_writer_);
__ StoreTaggedFieldX(value, MemOperand(object, offset), r0); __ StoreTaggedFieldX(value, MemOperand(object, offset), r0);
@ -3169,7 +3169,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();
@ -3180,7 +3180,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Instruction* instr_; Instruction* instr_;
CodeGenerator* gen_; CodeGenerator* gen_;
}; };
auto ool = new (zone()) OutOfLineTrap(this, instr); auto ool = zone()->New<OutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Label end; Label end;
@ -3412,7 +3412,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();

View File

@ -47,7 +47,7 @@ void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) {
DCHECK_EQ(existing_state->saved_lr_, saved_lr_); DCHECK_EQ(existing_state->saved_lr_, saved_lr_);
} else { } else {
block_initial_states_[successor_index] = block_initial_states_[successor_index] =
new (zone_) BlockInitialState(saved_lr_); zone_->New<BlockInitialState>(saved_lr_);
} }
} }
} }

View File

@ -376,7 +376,7 @@ BlockAssessments* RegisterAllocatorVerifier::CreateForBlock(
RpoNumber current_block_id = block->rpo_number(); RpoNumber current_block_id = block->rpo_number();
BlockAssessments* ret = BlockAssessments* ret =
new (zone()) BlockAssessments(zone(), spill_slot_delta()); zone()->New<BlockAssessments>(zone(), spill_slot_delta());
if (block->PredecessorCount() == 0) { if (block->PredecessorCount() == 0) {
// TODO(mtrofin): the following check should hold, however, in certain // TODO(mtrofin): the following check should hold, however, in certain
// unit tests it is invalidated by the last block. Investigate and // unit tests it is invalidated by the last block. Investigate and
@ -407,7 +407,7 @@ BlockAssessments* RegisterAllocatorVerifier::CreateForBlock(
InstructionOperand operand = pair.first; InstructionOperand operand = pair.first;
if (ret->map().find(operand) == ret->map().end()) { if (ret->map().find(operand) == ret->map().end()) {
ret->map().insert(std::make_pair( ret->map().insert(std::make_pair(
operand, new (zone()) PendingAssessment(zone(), block, operand))); operand, zone()->New<PendingAssessment>(zone(), block, operand)));
} }
} }
@ -472,7 +472,7 @@ void RegisterAllocatorVerifier::ValidatePendingAssessment(
auto todo_iter = outstanding_assessments_.find(pred); auto todo_iter = outstanding_assessments_.find(pred);
DelayedAssessments* set = nullptr; DelayedAssessments* set = nullptr;
if (todo_iter == outstanding_assessments_.end()) { if (todo_iter == outstanding_assessments_.end()) {
set = new (zone()) DelayedAssessments(zone()); set = zone()->New<DelayedAssessments>(zone());
outstanding_assessments_.insert(std::make_pair(pred, set)); outstanding_assessments_.insert(std::make_pair(pred, set));
} else { } else {
set = todo_iter->second; set = todo_iter->second;

View File

@ -154,7 +154,7 @@ class BlockAssessments : public ZoneObject {
stale_ref_stack_slots_.erase(operand); stale_ref_stack_slots_.erase(operand);
} }
map_.insert( map_.insert(
std::make_pair(operand, new (zone_) FinalAssessment(virtual_register))); std::make_pair(operand, zone_->New<FinalAssessment>(virtual_register)));
} }
void PerformMoves(const Instruction* instruction); void PerformMoves(const Instruction* instruction);

View File

@ -356,7 +356,7 @@ void UsePosition::set_type(UsePositionType type, bool register_beneficial) {
UseInterval* UseInterval::SplitAt(LifetimePosition pos, Zone* zone) { UseInterval* UseInterval::SplitAt(LifetimePosition pos, Zone* zone) {
DCHECK(Contains(pos) && pos != start()); DCHECK(Contains(pos) && pos != start());
UseInterval* after = new (zone) UseInterval(pos, end_); UseInterval* after = zone->New<UseInterval>(pos, end_);
after->next_ = next_; after->next_ = next_;
next_ = nullptr; next_ = nullptr;
end_ = pos; end_ = pos;
@ -627,7 +627,7 @@ void LiveRange::AdvanceLastProcessedMarker(
LiveRange* LiveRange::SplitAt(LifetimePosition position, Zone* zone) { LiveRange* LiveRange::SplitAt(LifetimePosition position, Zone* zone) {
int new_id = TopLevel()->GetNextChildId(); int new_id = TopLevel()->GetNextChildId();
LiveRange* child = new (zone) LiveRange(new_id, representation(), TopLevel()); LiveRange* child = zone->New<LiveRange>(new_id, representation(), TopLevel());
child->set_bundle(bundle_); child->set_bundle(bundle_);
// If we split, we do so because we're about to switch registers or move // If we split, we do so because we're about to switch registers or move
// to/from a slot, so there's no value in connecting hints. // to/from a slot, so there's no value in connecting hints.
@ -930,7 +930,7 @@ int TopLevelLiveRange::debug_virt_reg() const {
void TopLevelLiveRange::RecordSpillLocation(Zone* zone, int gap_index, void TopLevelLiveRange::RecordSpillLocation(Zone* zone, int gap_index,
InstructionOperand* operand) { InstructionOperand* operand) {
DCHECK(HasNoSpillType()); DCHECK(HasNoSpillType());
spill_move_insertion_locations_ = new (zone) SpillMoveInsertionList( spill_move_insertion_locations_ = zone->New<SpillMoveInsertionList>(
gap_index, operand, spill_move_insertion_locations_); gap_index, operand, spill_move_insertion_locations_);
} }
@ -1197,7 +1197,7 @@ void TopLevelLiveRange::EnsureInterval(LifetimePosition start,
first_interval_ = first_interval_->next(); first_interval_ = first_interval_->next();
} }
UseInterval* new_interval = new (zone) UseInterval(start, new_end); UseInterval* new_interval = zone->New<UseInterval>(start, new_end);
new_interval->set_next(first_interval_); new_interval->set_next(first_interval_);
first_interval_ = new_interval; first_interval_ = new_interval;
if (new_interval->next() == nullptr) { if (new_interval->next() == nullptr) {
@ -1211,14 +1211,14 @@ void TopLevelLiveRange::AddUseInterval(LifetimePosition start,
TRACE_COND(trace_alloc, "Add to live range %d interval [%d %d[\n", vreg(), TRACE_COND(trace_alloc, "Add to live range %d interval [%d %d[\n", vreg(),
start.value(), end.value()); start.value(), end.value());
if (first_interval_ == nullptr) { if (first_interval_ == nullptr) {
UseInterval* interval = new (zone) UseInterval(start, end); UseInterval* interval = zone->New<UseInterval>(start, end);
first_interval_ = interval; first_interval_ = interval;
last_interval_ = interval; last_interval_ = interval;
} else { } else {
if (end == first_interval_->start()) { if (end == first_interval_->start()) {
first_interval_->set_start(start); first_interval_->set_start(start);
} else if (end < first_interval_->start()) { } else if (end < first_interval_->start()) {
UseInterval* interval = new (zone) UseInterval(start, end); UseInterval* interval = zone->New<UseInterval>(start, end);
interval->set_next(first_interval_); interval->set_next(first_interval_);
first_interval_ = interval; first_interval_ = interval;
} else { } else {
@ -1412,7 +1412,7 @@ SpillRange::SpillRange(TopLevelLiveRange* parent, Zone* zone)
for (LiveRange* range = parent; range != nullptr; range = range->next()) { for (LiveRange* range = parent; range != nullptr; range = range->next()) {
UseInterval* src = range->first_interval(); UseInterval* src = range->first_interval();
while (src != nullptr) { while (src != nullptr) {
UseInterval* new_node = new (zone) UseInterval(src->start(), src->end()); UseInterval* new_node = zone->New<UseInterval>(src->start(), src->end());
if (result == nullptr) { if (result == nullptr) {
result = new_node; result = new_node;
} else { } else {
@ -1563,14 +1563,14 @@ RegisterAllocationData::RegisterAllocationData(
nullptr); nullptr);
} }
assigned_registers_ = new (code_zone()) assigned_registers_ = code_zone()->New<BitVector>(
BitVector(this->config()->num_general_registers(), code_zone()); this->config()->num_general_registers(), code_zone());
assigned_double_registers_ = new (code_zone()) assigned_double_registers_ = code_zone()->New<BitVector>(
BitVector(this->config()->num_double_registers(), code_zone()); this->config()->num_double_registers(), code_zone());
fixed_register_use_ = new (code_zone()) fixed_register_use_ = code_zone()->New<BitVector>(
BitVector(this->config()->num_general_registers(), code_zone()); this->config()->num_general_registers(), code_zone());
fixed_fp_register_use_ = new (code_zone()) fixed_fp_register_use_ = code_zone()->New<BitVector>(
BitVector(this->config()->num_double_registers(), code_zone()); this->config()->num_double_registers(), code_zone());
this->frame()->SetAllocatedRegisters(assigned_registers_); this->frame()->SetAllocatedRegisters(assigned_registers_);
this->frame()->SetAllocatedDoubleRegisters(assigned_double_registers_); this->frame()->SetAllocatedDoubleRegisters(assigned_double_registers_);
@ -1604,7 +1604,7 @@ TopLevelLiveRange* RegisterAllocationData::GetOrCreateLiveRangeFor(int index) {
TopLevelLiveRange* RegisterAllocationData::NewLiveRange( TopLevelLiveRange* RegisterAllocationData::NewLiveRange(
int index, MachineRepresentation rep) { int index, MachineRepresentation rep) {
return new (allocation_zone()) TopLevelLiveRange(index, rep); return allocation_zone()->New<TopLevelLiveRange>(index, rep);
} }
int RegisterAllocationData::GetNextLiveRangeId() { int RegisterAllocationData::GetNextLiveRangeId() {
@ -1624,8 +1624,9 @@ TopLevelLiveRange* RegisterAllocationData::NextLiveRange(
RegisterAllocationData::PhiMapValue* RegisterAllocationData::InitializePhiMap( RegisterAllocationData::PhiMapValue* RegisterAllocationData::InitializePhiMap(
const InstructionBlock* block, PhiInstruction* phi) { const InstructionBlock* block, PhiInstruction* phi) {
RegisterAllocationData::PhiMapValue* map_value = new (allocation_zone()) RegisterAllocationData::PhiMapValue* map_value =
RegisterAllocationData::PhiMapValue(phi, block, allocation_zone()); allocation_zone()->New<RegisterAllocationData::PhiMapValue>(
phi, block, allocation_zone());
auto res = auto res =
phi_map_.insert(std::make_pair(phi->virtual_register(), map_value)); phi_map_.insert(std::make_pair(phi->virtual_register(), map_value));
DCHECK(res.second); DCHECK(res.second);
@ -1706,7 +1707,7 @@ SpillRange* RegisterAllocationData::AssignSpillRangeToLiveRange(
SpillRange* spill_range = range->GetAllocatedSpillRange(); SpillRange* spill_range = range->GetAllocatedSpillRange();
if (spill_range == nullptr) { if (spill_range == nullptr) {
DCHECK(!range->IsSplinter()); DCHECK(!range->IsSplinter());
spill_range = new (allocation_zone()) SpillRange(range, allocation_zone()); spill_range = allocation_zone()->New<SpillRange>(range, allocation_zone());
} }
if (spill_mode == SpillMode::kSpillDeferred && if (spill_mode == SpillMode::kSpillDeferred &&
(range->spill_type() != SpillType::kSpillRange)) { (range->spill_type() != SpillType::kSpillRange)) {
@ -1730,7 +1731,7 @@ SpillRange* RegisterAllocationData::CreateSpillRangeForLiveRange(
DCHECK(!range->HasSpillOperand()); DCHECK(!range->HasSpillOperand());
DCHECK(!range->IsSplinter()); DCHECK(!range->IsSplinter());
SpillRange* spill_range = SpillRange* spill_range =
new (allocation_zone()) SpillRange(range, allocation_zone()); allocation_zone()->New<SpillRange>(range, allocation_zone());
return spill_range; return spill_range;
} }
@ -2085,7 +2086,7 @@ BitVector* LiveRangeBuilder::ComputeLiveOut(const InstructionBlock* block,
Zone* zone = data->allocation_zone(); Zone* zone = data->allocation_zone();
const InstructionSequence* code = data->code(); const InstructionSequence* code = data->code();
live_out = new (zone) BitVector(code->VirtualRegisterCount(), zone); live_out = zone->New<BitVector>(code->VirtualRegisterCount(), zone);
// Process all successor blocks. // Process all successor blocks.
for (const RpoNumber& succ : block->successors()) { for (const RpoNumber& succ : block->successors()) {
@ -2231,7 +2232,7 @@ UsePosition* LiveRangeBuilder::NewUsePosition(LifetimePosition pos,
InstructionOperand* operand, InstructionOperand* operand,
void* hint, void* hint,
UsePositionHintType hint_type) { UsePositionHintType hint_type) {
return new (allocation_zone()) UsePosition(pos, operand, hint, hint_type); return allocation_zone()->New<UsePosition>(pos, operand, hint, hint_type);
} }
UsePosition* LiveRangeBuilder::Define(LifetimePosition position, UsePosition* LiveRangeBuilder::Define(LifetimePosition position,
@ -2827,8 +2828,8 @@ void BundleBuilder::BuildBundles() {
data()->GetOrCreateLiveRangeFor(phi->virtual_register()); data()->GetOrCreateLiveRangeFor(phi->virtual_register());
LiveRangeBundle* out = out_range->get_bundle(); LiveRangeBundle* out = out_range->get_bundle();
if (out == nullptr) { if (out == nullptr) {
out = new (data()->allocation_zone()) out = data()->allocation_zone()->New<LiveRangeBundle>(
LiveRangeBundle(data()->allocation_zone(), next_bundle_id_++); data()->allocation_zone(), next_bundle_id_++);
out->TryAddRange(out_range); out->TryAddRange(out_range);
} }
TRACE("Processing phi for v%d with %d:%d\n", phi->virtual_register(), TRACE("Processing phi for v%d with %d:%d\n", phi->virtual_register(),
@ -5256,7 +5257,7 @@ void LiveRangeConnector::ConnectRanges(Zone* local_zone) {
} }
// Gather all MoveOperands for a single ParallelMove. // Gather all MoveOperands for a single ParallelMove.
MoveOperands* move = MoveOperands* move =
new (code_zone()) MoveOperands(it->first.second, it->second); code_zone()->New<MoveOperands>(it->first.second, it->second);
moves->PrepareInsertAfter(move, &to_eliminate); moves->PrepareInsertAfter(move, &to_eliminate);
to_insert.push_back(move); to_insert.push_back(move);
} }

View File

@ -668,6 +668,8 @@ class V8_EXPORT_PRIVATE LiveRange : public NON_EXPORTED_BASE(ZoneObject) {
private: private:
friend class TopLevelLiveRange; friend class TopLevelLiveRange;
friend Zone;
explicit LiveRange(int relative_id, MachineRepresentation rep, explicit LiveRange(int relative_id, MachineRepresentation rep,
TopLevelLiveRange* top_level); TopLevelLiveRange* top_level);
@ -733,6 +735,7 @@ class LiveRangeBundle : public ZoneObject {
private: private:
friend class BundleBuilder; friend class BundleBuilder;
friend Zone;
// Representation of the non-empty interval [start,end[. // Representation of the non-empty interval [start,end[.
class Range { class Range {
@ -916,7 +919,7 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange {
spilled_in_deferred_blocks_ = true; spilled_in_deferred_blocks_ = true;
spill_move_insertion_locations_ = nullptr; spill_move_insertion_locations_ = nullptr;
list_of_blocks_requiring_spill_operands_ = list_of_blocks_requiring_spill_operands_ =
new (zone) BitVector(total_block_count, zone); zone->New<BitVector>(total_block_count, zone);
} }
// Updates internal data structures to reflect that this range is not // Updates internal data structures to reflect that this range is not
@ -925,7 +928,7 @@ class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange {
spill_start_index_ = -1; spill_start_index_ = -1;
spill_move_insertion_locations_ = nullptr; spill_move_insertion_locations_ = nullptr;
list_of_blocks_requiring_spill_operands_ = list_of_blocks_requiring_spill_operands_ =
new (zone) BitVector(total_block_count, zone); zone->New<BitVector>(total_block_count, zone);
} }
// Promotes this range to spill at definition if it was marked for spilling // Promotes this range to spill at definition if it was marked for spilling

View File

@ -1644,14 +1644,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
AddressingModeField::decode(instr->opcode()); AddressingModeField::decode(instr->opcode());
if (addressing_mode == kMode_MRI) { if (addressing_mode == kMode_MRI) {
int32_t offset = i.InputInt32(1); int32_t offset = i.InputInt32(1);
ool = new (zone()) OutOfLineRecordWrite( ool = zone()->New<OutOfLineRecordWrite>(
this, object, offset, value, scratch0, scratch1, mode, this, object, offset, value, scratch0, scratch1, mode,
DetermineStubCallMode(), &unwinding_info_writer_); DetermineStubCallMode(), &unwinding_info_writer_);
__ StoreTaggedField(value, MemOperand(object, offset), r0); __ StoreTaggedField(value, MemOperand(object, offset), r0);
} else { } else {
DCHECK_EQ(kMode_MRR, addressing_mode); DCHECK_EQ(kMode_MRR, addressing_mode);
Register offset(i.InputRegister(1)); Register offset(i.InputRegister(1));
ool = new (zone()) OutOfLineRecordWrite( ool = zone()->New<OutOfLineRecordWrite>(
this, object, offset, value, scratch0, scratch1, mode, this, object, offset, value, scratch0, scratch1, mode,
DetermineStubCallMode(), &unwinding_info_writer_); DetermineStubCallMode(), &unwinding_info_writer_);
__ StoreTaggedField(value, MemOperand(object, offset)); __ StoreTaggedField(value, MemOperand(object, offset));
@ -4441,7 +4441,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();
@ -4452,7 +4452,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Instruction* instr_; Instruction* instr_;
CodeGenerator* gen_; CodeGenerator* gen_;
}; };
auto ool = new (zone()) OutOfLineTrap(this, instr); auto ool = zone()->New<OutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Label end; Label end;
@ -4643,7 +4643,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) { if (FLAG_debug_code) {
__ stop(); __ stop();

View File

@ -46,7 +46,7 @@ void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) {
DCHECK_EQ(existing_state->saved_lr_, saved_lr_); DCHECK_EQ(existing_state->saved_lr_, saved_lr_);
} else { } else {
block_initial_states_[successor_index] = block_initial_states_[successor_index] =
new (zone_) BlockInitialState(saved_lr_); zone_->New<BlockInitialState>(saved_lr_);
} }
} }
} }

View File

@ -423,7 +423,7 @@ class WasmOutOfLineTrap : public OutOfLineCode {
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ near_call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); __ near_call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = ReferenceMap* reference_map =
new (gen_->zone()) ReferenceMap(gen_->zone()); gen_->zone()->New<ReferenceMap>(gen_->zone());
gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
__ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap); __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
} }
@ -452,7 +452,7 @@ void EmitOOLTrapIfNeeded(Zone* zone, CodeGenerator* codegen,
const MemoryAccessMode access_mode = const MemoryAccessMode access_mode =
static_cast<MemoryAccessMode>(MiscField::decode(opcode)); static_cast<MemoryAccessMode>(MiscField::decode(opcode));
if (access_mode == kMemoryAccessProtected) { if (access_mode == kMemoryAccessProtected) {
new (zone) WasmProtectedInstructionTrap(codegen, pc, instr); zone->New<WasmProtectedInstructionTrap>(codegen, pc, instr);
} }
} }
@ -1148,7 +1148,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kArchTruncateDoubleToI: { case kArchTruncateDoubleToI: {
auto result = i.OutputRegister(); auto result = i.OutputRegister();
auto input = i.InputDoubleRegister(0); auto input = i.InputDoubleRegister(0);
auto ool = new (zone()) OutOfLineTruncateDoubleToI( auto ool = zone()->New<OutOfLineTruncateDoubleToI>(
this, result, input, DetermineStubCallMode(), this, result, input, DetermineStubCallMode(),
&unwinding_info_writer_); &unwinding_info_writer_);
// We use Cvttsd2siq instead of Cvttsd2si due to performance reasons. The // We use Cvttsd2siq instead of Cvttsd2si due to performance reasons. The
@ -1169,9 +1169,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Register value = i.InputRegister(index); Register value = i.InputRegister(index);
Register scratch0 = i.TempRegister(0); Register scratch0 = i.TempRegister(0);
Register scratch1 = i.TempRegister(1); Register scratch1 = i.TempRegister(1);
auto ool = new (zone()) auto ool = zone()->New<OutOfLineRecordWrite>(this, object, operand, value,
OutOfLineRecordWrite(this, object, operand, value, scratch0, scratch1, scratch0, scratch1, mode,
mode, DetermineStubCallMode()); DetermineStubCallMode());
__ StoreTaggedField(operand, value); __ StoreTaggedField(operand, value);
__ CheckPageFlag(object, scratch0, __ CheckPageFlag(object, scratch0,
MemoryChunk::kPointersFromHereAreInterestingMask, MemoryChunk::kPointersFromHereAreInterestingMask,
@ -1567,7 +1567,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ucomiss(i.InputDoubleRegister(0), i.InputOperand(1)); __ Ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat32NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(above, &done_compare, Label::kNear); __ j(above, &done_compare, Label::kNear);
__ j(below, &compare_swap, Label::kNear); __ j(below, &compare_swap, Label::kNear);
@ -1592,7 +1592,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ucomiss(i.InputDoubleRegister(0), i.InputOperand(1)); __ Ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat32NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(below, &done_compare, Label::kNear); __ j(below, &done_compare, Label::kNear);
__ j(above, &compare_swap, Label::kNear); __ j(above, &compare_swap, Label::kNear);
@ -1622,7 +1622,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); __ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat64NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(above, &done_compare, Label::kNear); __ j(above, &done_compare, Label::kNear);
__ j(below, &compare_swap, Label::kNear); __ j(below, &compare_swap, Label::kNear);
@ -1647,7 +1647,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); __ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
} }
auto ool = auto ool =
new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); zone()->New<OutOfLineLoadFloat64NaN>(this, i.OutputDoubleRegister());
__ j(parity_even, ool->entry()); __ j(parity_even, ool->entry());
__ j(below, &done_compare, Label::kNear); __ j(below, &done_compare, Label::kNear);
__ j(above, &compare_swap, Label::kNear); __ j(above, &compare_swap, Label::kNear);
@ -2425,7 +2425,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
// Most likely there is no difference and we're done. // Most likely there is no difference and we're done.
__ Xorpd(kScratchDoubleReg, dst); __ Xorpd(kScratchDoubleReg, dst);
__ Ptest(kScratchDoubleReg, kScratchDoubleReg); __ Ptest(kScratchDoubleReg, kScratchDoubleReg);
auto ool = new (zone()) OutOfLineF64x2Min(this, dst, kScratchDoubleReg); auto ool = zone()->New<OutOfLineF64x2Min>(this, dst, kScratchDoubleReg);
__ j(not_zero, ool->entry()); __ j(not_zero, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -2443,7 +2443,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
// Most likely there is no difference and we're done. // Most likely there is no difference and we're done.
__ Xorpd(kScratchDoubleReg, dst); __ Xorpd(kScratchDoubleReg, dst);
__ Ptest(kScratchDoubleReg, kScratchDoubleReg); __ Ptest(kScratchDoubleReg, kScratchDoubleReg);
auto ool = new (zone()) OutOfLineF64x2Max(this, dst, kScratchDoubleReg); auto ool = zone()->New<OutOfLineF64x2Max>(this, dst, kScratchDoubleReg);
__ j(not_zero, ool->entry()); __ j(not_zero, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -2618,7 +2618,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
// Most likely there is no difference and we're done. // Most likely there is no difference and we're done.
__ Xorps(kScratchDoubleReg, dst); __ Xorps(kScratchDoubleReg, dst);
__ Ptest(kScratchDoubleReg, kScratchDoubleReg); __ Ptest(kScratchDoubleReg, kScratchDoubleReg);
auto ool = new (zone()) OutOfLineF32x4Min(this, dst, kScratchDoubleReg); auto ool = zone()->New<OutOfLineF32x4Min>(this, dst, kScratchDoubleReg);
__ j(not_zero, ool->entry()); __ j(not_zero, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -2636,7 +2636,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
// Most likely there is no difference and we're done. // Most likely there is no difference and we're done.
__ Xorps(kScratchDoubleReg, dst); __ Xorps(kScratchDoubleReg, dst);
__ Ptest(kScratchDoubleReg, kScratchDoubleReg); __ Ptest(kScratchDoubleReg, kScratchDoubleReg);
auto ool = new (zone()) OutOfLineF32x4Max(this, dst, kScratchDoubleReg); auto ool = zone()->New<OutOfLineF32x4Max>(this, dst, kScratchDoubleReg);
__ j(not_zero, ool->entry()); __ j(not_zero, ool->entry());
__ bind(ool->exit()); __ bind(ool->exit());
break; break;
@ -4370,7 +4370,7 @@ void CodeGenerator::AssembleArchJump(RpoNumber target) {
void CodeGenerator::AssembleArchTrap(Instruction* instr, void CodeGenerator::AssembleArchTrap(Instruction* instr,
FlagsCondition condition) { FlagsCondition condition) {
auto ool = new (zone()) WasmOutOfLineTrap(this, instr); auto ool = zone()->New<WasmOutOfLineTrap>(this, instr);
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Label end; Label end;
if (condition == kUnorderedEqual) { if (condition == kUnorderedEqual) {
@ -4553,7 +4553,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ near_call(wasm::WasmCode::kWasmStackOverflow, __ near_call(wasm::WasmCode::kWasmStackOverflow,
RelocInfo::WASM_STUB_CALL); RelocInfo::WASM_STUB_CALL);
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt);
__ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap); __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
__ bind(&done); __ bind(&done);

View File

@ -51,9 +51,9 @@ void UnwindingInfoWriter::EndInstructionBlock(const InstructionBlock* block) {
DCHECK_EQ(existing_state->offset_, eh_frame_writer_.base_offset()); DCHECK_EQ(existing_state->offset_, eh_frame_writer_.base_offset());
DCHECK_EQ(existing_state->tracking_fp_, tracking_fp_); DCHECK_EQ(existing_state->tracking_fp_, tracking_fp_);
} else { } else {
block_initial_states_[successor_index] = new (zone_) block_initial_states_[successor_index] = zone_->New<BlockInitialState>(
BlockInitialState(eh_frame_writer_.base_register(), eh_frame_writer_.base_register(), eh_frame_writer_.base_offset(),
eh_frame_writer_.base_offset(), tracking_fp_); tracking_fp_);
} }
} }
} }

View File

@ -206,7 +206,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
} }
RawMachineAssembler callee( RawMachineAssembler callee(
i_isolate, new (&zone) Graph(&zone), desc, i_isolate, zone.New<Graph>(&zone), desc,
MachineType::PointerRepresentation(), MachineType::PointerRepresentation(),
InstructionSelector::SupportedMachineOperatorFlags()); InstructionSelector::SupportedMachineOperatorFlags());
@ -259,7 +259,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CallDescriptor* wrapper_desc = CallDescriptor* wrapper_desc =
Linkage::GetSimplifiedCDescriptor(&zone, sig_builder.Build()); Linkage::GetSimplifiedCDescriptor(&zone, sig_builder.Build());
RawMachineAssembler caller( RawMachineAssembler caller(
i_isolate, new (&zone) Graph(&zone), wrapper_desc, i_isolate, zone.New<Graph>(&zone), wrapper_desc,
MachineType::PointerRepresentation(), MachineType::PointerRepresentation(),
InstructionSelector::SupportedMachineOperatorFlags()); InstructionSelector::SupportedMachineOperatorFlags());

View File

@ -37,7 +37,7 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
public: public:
StreamBuilder(InstructionSelectorTest* test, MachineType return_type) StreamBuilder(InstructionSelectorTest* test, MachineType return_type)
: RawMachineAssembler(test->isolate(), : RawMachineAssembler(test->isolate(),
new (test->zone()) Graph(test->zone()), test->zone()->New<Graph>(test->zone()),
MakeCallDescriptor(test->zone(), return_type), MakeCallDescriptor(test->zone(), return_type),
MachineType::PointerRepresentation(), MachineType::PointerRepresentation(),
MachineOperatorBuilder::kAllOptionalOps), MachineOperatorBuilder::kAllOptionalOps),
@ -45,7 +45,7 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
StreamBuilder(InstructionSelectorTest* test, MachineType return_type, StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
MachineType parameter0_type) MachineType parameter0_type)
: RawMachineAssembler( : RawMachineAssembler(
test->isolate(), new (test->zone()) Graph(test->zone()), test->isolate(), test->zone()->New<Graph>(test->zone()),
MakeCallDescriptor(test->zone(), return_type, parameter0_type), MakeCallDescriptor(test->zone(), return_type, parameter0_type),
MachineType::PointerRepresentation(), MachineType::PointerRepresentation(),
MachineOperatorBuilder::kAllOptionalOps, MachineOperatorBuilder::kAllOptionalOps,
@ -54,7 +54,7 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
StreamBuilder(InstructionSelectorTest* test, MachineType return_type, StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
MachineType parameter0_type, MachineType parameter1_type) MachineType parameter0_type, MachineType parameter1_type)
: RawMachineAssembler( : RawMachineAssembler(
test->isolate(), new (test->zone()) Graph(test->zone()), test->isolate(), test->zone()->New<Graph>(test->zone()),
MakeCallDescriptor(test->zone(), return_type, parameter0_type, MakeCallDescriptor(test->zone(), return_type, parameter0_type,
parameter1_type), parameter1_type),
MachineType::PointerRepresentation(), MachineType::PointerRepresentation(),
@ -64,7 +64,7 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
MachineType parameter0_type, MachineType parameter1_type, MachineType parameter0_type, MachineType parameter1_type,
MachineType parameter2_type) MachineType parameter2_type)
: RawMachineAssembler( : RawMachineAssembler(
test->isolate(), new (test->zone()) Graph(test->zone()), test->isolate(), test->zone()->New<Graph>(test->zone()),
MakeCallDescriptor(test->zone(), return_type, parameter0_type, MakeCallDescriptor(test->zone(), return_type, parameter0_type,
parameter1_type, parameter2_type), parameter1_type, parameter2_type),
MachineType::PointerRepresentation(), MachineType::PointerRepresentation(),
@ -121,7 +121,7 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
MachineType target_type = MachineType::Pointer(); MachineType target_type = MachineType::Pointer();
LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
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

View File

@ -80,8 +80,8 @@ const RegisterConfiguration* InstructionSequenceTest::config() {
InstructionSequence* InstructionSequenceTest::sequence() { InstructionSequence* InstructionSequenceTest::sequence() {
if (sequence_ == nullptr) { if (sequence_ == nullptr) {
sequence_ = new (zone()) sequence_ = zone()->New<InstructionSequence>(isolate(), zone(),
InstructionSequence(isolate(), zone(), &instruction_blocks_); &instruction_blocks_);
sequence_->SetRegisterConfigurationForTesting( sequence_->SetRegisterConfigurationForTesting(
InstructionSequenceTest::config()); InstructionSequenceTest::config());
} }
@ -170,7 +170,7 @@ PhiInstruction* InstructionSequenceTest::Phi(VReg incoming_vreg_0,
if (inputs[input_count].value_ == kNoValue) break; if (inputs[input_count].value_ == kNoValue) break;
} }
CHECK_LT(0, input_count); CHECK_LT(0, input_count);
auto phi = new (zone()) PhiInstruction(zone(), NewReg().value_, input_count); auto phi = zone()->New<PhiInstruction>(zone(), NewReg().value_, input_count);
for (size_t i = 0; i < input_count; ++i) { for (size_t i = 0; i < input_count; ++i) {
SetInput(phi, i, inputs[i]); SetInput(phi, i, inputs[i]);
} }
@ -180,7 +180,7 @@ PhiInstruction* InstructionSequenceTest::Phi(VReg incoming_vreg_0,
PhiInstruction* InstructionSequenceTest::Phi(VReg incoming_vreg_0, PhiInstruction* InstructionSequenceTest::Phi(VReg incoming_vreg_0,
size_t input_count) { size_t input_count) {
auto phi = new (zone()) PhiInstruction(zone(), NewReg().value_, input_count); auto phi = zone()->New<PhiInstruction>(zone(), NewReg().value_, input_count);
SetInput(phi, 0, incoming_vreg_0); SetInput(phi, 0, incoming_vreg_0);
current_block_->AddPhi(phi); current_block_->AddPhi(phi);
return phi; return phi;
@ -441,8 +441,8 @@ InstructionBlock* InstructionSequenceTest::NewBlock(bool deferred) {
} }
} }
// Construct instruction block. // Construct instruction block.
auto instruction_block = new (zone()) auto instruction_block = zone()->New<InstructionBlock>(
InstructionBlock(zone(), rpo, loop_header, loop_end, deferred, false); zone(), rpo, loop_header, loop_end, deferred, false);
instruction_blocks_.push_back(instruction_block); instruction_blocks_.push_back(instruction_block);
current_block_ = instruction_block; current_block_ = instruction_block;
sequence()->StartBlock(rpo); sequence()->StartBlock(rpo);

View File

@ -43,7 +43,7 @@ class InstructionTest : public TestWithZone {
ParallelMove* CreateParallelMove( ParallelMove* CreateParallelMove(
const std::vector<InstructionOperand>& operand_pairs) { const std::vector<InstructionOperand>& operand_pairs) {
ParallelMove* parallel_move = new (zone()) ParallelMove(zone()); ParallelMove* parallel_move = zone()->New<ParallelMove>(zone());
for (size_t i = 0; i < operand_pairs.size(); i += 2) for (size_t i = 0; i < operand_pairs.size(); i += 2)
parallel_move->AddMove(operand_pairs[i + 1], operand_pairs[i]); parallel_move->AddMove(operand_pairs[i + 1], operand_pairs[i]);
return parallel_move; return parallel_move;

View File

@ -48,7 +48,7 @@ class TestRangeBuilder {
TopLevelLiveRange* Build() { TopLevelLiveRange* Build() {
TopLevelLiveRange* range = TopLevelLiveRange* range =
new (zone_) TopLevelLiveRange(id_, MachineRepresentation::kTagged); zone_->New<TopLevelLiveRange>(id_, MachineRepresentation::kTagged);
// Traverse the provided interval specifications backwards, because that is // Traverse the provided interval specifications backwards, because that is
// what LiveRange expects. // what LiveRange expects.
for (int i = static_cast<int>(pairs_.size()) - 1; i >= 0; --i) { for (int i = static_cast<int>(pairs_.size()) - 1; i >= 0; --i) {
@ -60,7 +60,7 @@ class TestRangeBuilder {
} }
for (int pos : uses_) { for (int pos : uses_) {
UsePosition* use_position = UsePosition* use_position =
new (zone_) UsePosition(LifetimePosition::FromInt(pos), nullptr, zone_->New<UsePosition>(LifetimePosition::FromInt(pos), nullptr,
nullptr, UsePositionHintType::kNone); nullptr, UsePositionHintType::kNone);
range->AddUsePosition(use_position, FLAG_trace_turbo_alloc); range->AddUsePosition(use_position, FLAG_trace_turbo_alloc);
} }
@ -88,8 +88,8 @@ class LiveRangeUnitTest : public TestWithZone {
TopLevelLiveRange* Splinter(TopLevelLiveRange* top, int start, int end, TopLevelLiveRange* Splinter(TopLevelLiveRange* top, int start, int end,
int new_id = 0) { int new_id = 0) {
if (top->splinter() == nullptr) { if (top->splinter() == nullptr) {
TopLevelLiveRange* ret = new (zone()) TopLevelLiveRange* ret = zone()->New<TopLevelLiveRange>(
TopLevelLiveRange(new_id, MachineRepresentation::kTagged); new_id, MachineRepresentation::kTagged);
top->SetSplinter(ret); top->SetSplinter(ret);
} }
top->Splinter(LifetimePosition::FromInt(start), top->Splinter(LifetimePosition::FromInt(start),
@ -128,7 +128,7 @@ class LiveRangeUnitTest : public TestWithZone {
TEST_F(LiveRangeUnitTest, InvalidConstruction) { TEST_F(LiveRangeUnitTest, InvalidConstruction) {
// Build a range manually, because the builder guards against empty cases. // Build a range manually, because the builder guards against empty cases.
TopLevelLiveRange* range = TopLevelLiveRange* range =
new (zone()) TopLevelLiveRange(1, MachineRepresentation::kTagged); zone()->New<TopLevelLiveRange>(1, MachineRepresentation::kTagged);
V8_ASSERT_DEBUG_DEATH(range->AddUseInterval(LifetimePosition::FromInt(0), V8_ASSERT_DEBUG_DEATH(range->AddUseInterval(LifetimePosition::FromInt(0),
LifetimePosition::FromInt(0), LifetimePosition::FromInt(0),
zone(), FLAG_trace_turbo_alloc), zone(), FLAG_trace_turbo_alloc),
@ -465,7 +465,7 @@ TEST_F(LiveRangeUnitTest, IDGeneration) {
EXPECT_EQ(0, vreg->relative_id()); EXPECT_EQ(0, vreg->relative_id());
TopLevelLiveRange* splinter = TopLevelLiveRange* splinter =
new (zone()) TopLevelLiveRange(101, MachineRepresentation::kTagged); zone()->New<TopLevelLiveRange>(101, MachineRepresentation::kTagged);
vreg->SetSplinter(splinter); vreg->SetSplinter(splinter);
vreg->Splinter(LifetimePosition::FromInt(4), LifetimePosition::FromInt(12), vreg->Splinter(LifetimePosition::FromInt(4), LifetimePosition::FromInt(12),
zone()); zone());

View File

@ -58,10 +58,11 @@ class BackgroundCompileTaskTest : public TestWithNativeContext {
const AstRawString* function_name = const AstRawString* function_name =
ast_value_factory->GetOneByteString("f"); ast_value_factory->GetOneByteString("f");
DeclarationScope* script_scope = new (outer_parse_info->zone()) DeclarationScope* script_scope =
DeclarationScope(outer_parse_info->zone(), ast_value_factory); outer_parse_info->zone()->New<DeclarationScope>(
outer_parse_info->zone(), ast_value_factory);
DeclarationScope* function_scope = DeclarationScope* function_scope =
new (outer_parse_info->zone()) DeclarationScope( outer_parse_info->zone()->New<DeclarationScope>(
outer_parse_info->zone(), script_scope, FUNCTION_SCOPE); outer_parse_info->zone(), script_scope, FUNCTION_SCOPE);
function_scope->set_start_position(shared->StartPosition()); function_scope->set_start_position(shared->StartPosition());
function_scope->set_end_position(shared->EndPosition()); function_scope->set_end_position(shared->EndPosition());