Commit 91f49623 authored by dcarney@chromium.org's avatar dcarney@chromium.org

[turbofan] reduce allocations outside of pipeline

BUG=
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/679793003

Cr-Commit-Position: refs/heads/master@{#24904}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24904 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a133780e
...@@ -682,7 +682,7 @@ void CodeGenerator::AssemblePrologue() { ...@@ -682,7 +682,7 @@ void CodeGenerator::AssemblePrologue() {
__ stm(db_w, sp, saves); __ stm(db_w, sp, saves);
} }
} else if (descriptor->IsJSFunctionCall()) { } else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
__ Prologue(info->IsCodePreAgingActive()); __ Prologue(info->IsCodePreAgingActive());
frame()->SetRegisterSaveAreaSize( frame()->SetRegisterSaveAreaSize(
StandardFrameConstants::kFixedFrameSizeFromFp); StandardFrameConstants::kFixedFrameSizeFromFp);
...@@ -914,7 +914,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { ...@@ -914,7 +914,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() {
void CodeGenerator::EnsureSpaceForLazyDeopt() { void CodeGenerator::EnsureSpaceForLazyDeopt() {
int space_needed = Deoptimizer::patch_size(); int space_needed = Deoptimizer::patch_size();
if (!linkage()->info()->IsStub()) { if (!info()->IsStub()) {
// Ensure that we have enough space after the previous lazy-bailout // Ensure that we have enough space after the previous lazy-bailout
// instruction for patching the code here. // instruction for patching the code here.
int current_pc = masm()->pc_offset(); int current_pc = masm()->pc_offset();
......
...@@ -752,7 +752,7 @@ void CodeGenerator::AssemblePrologue() { ...@@ -752,7 +752,7 @@ void CodeGenerator::AssemblePrologue() {
__ PushCalleeSavedRegisters(); __ PushCalleeSavedRegisters();
frame()->SetRegisterSaveAreaSize(20 * kPointerSize); frame()->SetRegisterSaveAreaSize(20 * kPointerSize);
} else if (descriptor->IsJSFunctionCall()) { } else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
__ SetStackPointer(jssp); __ SetStackPointer(jssp);
__ Prologue(info->IsCodePreAgingActive()); __ Prologue(info->IsCodePreAgingActive());
frame()->SetRegisterSaveAreaSize( frame()->SetRegisterSaveAreaSize(
...@@ -967,7 +967,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } ...@@ -967,7 +967,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); }
void CodeGenerator::EnsureSpaceForLazyDeopt() { void CodeGenerator::EnsureSpaceForLazyDeopt() {
int space_needed = Deoptimizer::patch_size(); int space_needed = Deoptimizer::patch_size();
if (!linkage()->info()->IsStub()) { if (!info()->IsStub()) {
// Ensure that we have enough space after the previous lazy-bailout // Ensure that we have enough space after the previous lazy-bailout
// instruction for patching the code here. // instruction for patching the code here.
intptr_t current_pc = masm()->pc_offset(); intptr_t current_pc = masm()->pc_offset();
......
...@@ -22,10 +22,10 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, ...@@ -22,10 +22,10 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
: StructuredGraphBuilder(local_zone, jsgraph->graph(), jsgraph->common()), : StructuredGraphBuilder(local_zone, jsgraph->graph(), jsgraph->common()),
info_(info), info_(info),
jsgraph_(jsgraph), jsgraph_(jsgraph),
globals_(0, info->zone()), globals_(0, local_zone),
breakable_(NULL), breakable_(NULL),
execution_context_(NULL) { execution_context_(NULL) {
InitializeAstVisitor(info->zone()); InitializeAstVisitor(local_zone);
} }
......
...@@ -13,10 +13,11 @@ namespace internal { ...@@ -13,10 +13,11 @@ namespace internal {
namespace compiler { namespace compiler {
CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
InstructionSequence* code) InstructionSequence* code, CompilationInfo* info)
: frame_(frame), : frame_(frame),
linkage_(linkage), linkage_(linkage),
code_(code), code_(code),
info_(info),
current_block_(BasicBlock::RpoNumber::Invalid()), current_block_(BasicBlock::RpoNumber::Invalid()),
current_source_position_(SourcePosition::Invalid()), current_source_position_(SourcePosition::Invalid()),
masm_(code->zone()->isolate(), NULL, 0), masm_(code->zone()->isolate(), NULL, 0),
...@@ -29,7 +30,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, ...@@ -29,7 +30,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
Handle<Code> CodeGenerator::GenerateCode() { Handle<Code> CodeGenerator::GenerateCode() {
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
// Emit a code line info recording start event. // Emit a code line info recording start event.
PositionsRecorder* recorder = masm()->positions_recorder(); PositionsRecorder* recorder = masm()->positions_recorder();
...@@ -166,7 +167,7 @@ void CodeGenerator::AssembleSourcePosition(SourcePositionInstruction* instr) { ...@@ -166,7 +167,7 @@ void CodeGenerator::AssembleSourcePosition(SourcePositionInstruction* instr) {
masm()->positions_recorder()->WriteRecordedPositions(); masm()->positions_recorder()->WriteRecordedPositions();
if (FLAG_code_comments) { if (FLAG_code_comments) {
Vector<char> buffer = Vector<char>::New(256); Vector<char> buffer = Vector<char>::New(256);
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
int ln = Script::GetLineNumber(info->script(), code_pos); int ln = Script::GetLineNumber(info->script(), code_pos);
int cn = Script::GetColumnNumber(info->script(), code_pos); int cn = Script::GetColumnNumber(info->script(), code_pos);
if (info->script()->name()->IsString()) { if (info->script()->name()->IsString()) {
...@@ -196,7 +197,7 @@ void CodeGenerator::AssembleGap(GapInstruction* instr) { ...@@ -196,7 +197,7 @@ void CodeGenerator::AssembleGap(GapInstruction* instr) {
void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) {
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
int deopt_count = static_cast<int>(deoptimization_states_.size()); int deopt_count = static_cast<int>(deoptimization_states_.size());
if (deopt_count == 0) return; if (deopt_count == 0) return;
Handle<DeoptimizationInputData> data = Handle<DeoptimizationInputData> data =
......
...@@ -21,7 +21,7 @@ namespace compiler { ...@@ -21,7 +21,7 @@ namespace compiler {
class CodeGenerator FINAL : public GapResolver::Assembler { class CodeGenerator FINAL : public GapResolver::Assembler {
public: public:
explicit CodeGenerator(Frame* frame, Linkage* linkage, explicit CodeGenerator(Frame* frame, Linkage* linkage,
InstructionSequence* code); InstructionSequence* code, CompilationInfo* info);
// Generate native code. // Generate native code.
Handle<Code> GenerateCode(); Handle<Code> GenerateCode();
...@@ -36,6 +36,7 @@ class CodeGenerator FINAL : public GapResolver::Assembler { ...@@ -36,6 +36,7 @@ class CodeGenerator FINAL : public GapResolver::Assembler {
GapResolver* resolver() { return &resolver_; } GapResolver* resolver() { return &resolver_; }
SafepointTableBuilder* safepoints() { return &safepoints_; } SafepointTableBuilder* safepoints() { return &safepoints_; }
Zone* zone() const { return code()->zone(); } Zone* zone() const { return code()->zone(); }
CompilationInfo* info() const { return info_; }
// Checks if {block} will appear directly after {current_block_} when // Checks if {block} will appear directly after {current_block_} when
// assembling code, in which case, a fall-through can be used. // assembling code, in which case, a fall-through can be used.
...@@ -118,6 +119,7 @@ class CodeGenerator FINAL : public GapResolver::Assembler { ...@@ -118,6 +119,7 @@ class CodeGenerator FINAL : public GapResolver::Assembler {
Frame* const frame_; Frame* const frame_;
Linkage* const linkage_; Linkage* const linkage_;
InstructionSequence* const code_; InstructionSequence* const code_;
CompilationInfo* const info_;
BasicBlock::RpoNumber current_block_; BasicBlock::RpoNumber current_block_;
SourcePosition current_source_position_; SourcePosition current_source_position_;
MacroAssembler masm_; MacroAssembler masm_;
......
...@@ -793,7 +793,7 @@ void CodeGenerator::AssemblePrologue() { ...@@ -793,7 +793,7 @@ void CodeGenerator::AssemblePrologue() {
frame->SetRegisterSaveAreaSize(register_save_area_size); frame->SetRegisterSaveAreaSize(register_save_area_size);
} }
} else if (descriptor->IsJSFunctionCall()) { } else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
__ Prologue(info->IsCodePreAgingActive()); __ Prologue(info->IsCodePreAgingActive());
frame->SetRegisterSaveAreaSize( frame->SetRegisterSaveAreaSize(
StandardFrameConstants::kFixedFrameSizeFromFp); StandardFrameConstants::kFixedFrameSizeFromFp);
...@@ -1023,7 +1023,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } ...@@ -1023,7 +1023,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); }
void CodeGenerator::EnsureSpaceForLazyDeopt() { void CodeGenerator::EnsureSpaceForLazyDeopt() {
int space_needed = Deoptimizer::patch_size(); int space_needed = Deoptimizer::patch_size();
if (!linkage()->info()->IsStub()) { if (!info()->IsStub()) {
// Ensure that we have enough space after the previous lazy-bailout // Ensure that we have enough space after the previous lazy-bailout
// instruction for patching the code here. // instruction for patching the code here.
int current_pc = masm()->pc_offset(); int current_pc = masm()->pc_offset();
......
...@@ -19,7 +19,7 @@ namespace compiler { ...@@ -19,7 +19,7 @@ namespace compiler {
JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph) JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph)
: info_(info), : info_(info),
jsgraph_(jsgraph), jsgraph_(jsgraph),
linkage_(new (jsgraph->zone()) Linkage(info)) {} linkage_(new (jsgraph->zone()) Linkage(jsgraph->zone(), info)) {}
void JSGenericLowering::PatchOperator(Node* node, const Operator* op) { void JSGenericLowering::PatchOperator(Node* node, const Operator* op) {
......
...@@ -39,28 +39,30 @@ std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { ...@@ -39,28 +39,30 @@ std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) {
} }
Linkage::Linkage(CompilationInfo* info) : info_(info) { CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) {
if (info->function() != NULL) { if (info->function() != NULL) {
// If we already have the function literal, use the number of parameters // If we already have the function literal, use the number of parameters
// plus the receiver. // plus the receiver.
incoming_ = GetJSCallDescriptor(1 + info->function()->parameter_count()); return GetJSCallDescriptor(1 + info->function()->parameter_count(), zone);
} else if (!info->closure().is_null()) { }
if (!info->closure().is_null()) {
// If we are compiling a JS function, use a JS call descriptor, // If we are compiling a JS function, use a JS call descriptor,
// plus the receiver. // plus the receiver.
SharedFunctionInfo* shared = info->closure()->shared(); SharedFunctionInfo* shared = info->closure()->shared();
incoming_ = GetJSCallDescriptor(1 + shared->formal_parameter_count()); return GetJSCallDescriptor(1 + shared->formal_parameter_count(), zone);
} else if (info->code_stub() != NULL) { }
if (info->code_stub() != NULL) {
// Use the code stub interface descriptor. // Use the code stub interface descriptor.
CallInterfaceDescriptor descriptor = CallInterfaceDescriptor descriptor =
info->code_stub()->GetCallInterfaceDescriptor(); info->code_stub()->GetCallInterfaceDescriptor();
incoming_ = GetStubCallDescriptor(descriptor); return GetStubCallDescriptor(descriptor, 0, CallDescriptor::kNoFlags, zone);
} else {
incoming_ = NULL; // TODO(titzer): ?
} }
return NULL; // TODO(titzer): ?
} }
FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, int extra) { FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame,
int extra) const {
if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() ||
incoming_->kind() == CallDescriptor::kCallAddress) { incoming_->kind() == CallDescriptor::kCallAddress) {
int offset; int offset;
...@@ -87,24 +89,22 @@ FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, int extra) { ...@@ -87,24 +89,22 @@ FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, int extra) {
} }
CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count) { CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count) const {
return GetJSCallDescriptor(parameter_count, this->info_->zone()); return GetJSCallDescriptor(parameter_count, zone_);
} }
CallDescriptor* Linkage::GetRuntimeCallDescriptor( CallDescriptor* Linkage::GetRuntimeCallDescriptor(
Runtime::FunctionId function, int parameter_count, Runtime::FunctionId function, int parameter_count,
Operator::Properties properties) { Operator::Properties properties) const {
return GetRuntimeCallDescriptor(function, parameter_count, properties, return GetRuntimeCallDescriptor(function, parameter_count, properties, zone_);
this->info_->zone());
} }
CallDescriptor* Linkage::GetStubCallDescriptor( CallDescriptor* Linkage::GetStubCallDescriptor(
CallInterfaceDescriptor descriptor, int stack_parameter_count, CallInterfaceDescriptor descriptor, int stack_parameter_count,
CallDescriptor::Flags flags) { CallDescriptor::Flags flags) const {
return GetStubCallDescriptor(descriptor, stack_parameter_count, flags, return GetStubCallDescriptor(descriptor, stack_parameter_count, flags, zone_);
this->info_->zone());
} }
......
...@@ -129,16 +129,18 @@ class CallDescriptor FINAL : public ZoneObject { ...@@ -129,16 +129,18 @@ class CallDescriptor FINAL : public ZoneObject {
private: private:
friend class Linkage; friend class Linkage;
Kind kind_; const Kind kind_;
MachineType target_type_; const MachineType target_type_;
LinkageLocation target_loc_; const LinkageLocation target_loc_;
MachineSignature* machine_sig_; const MachineSignature* const machine_sig_;
LocationSignature* location_sig_; const LocationSignature* const location_sig_;
size_t js_param_count_; const size_t js_param_count_;
Operator::Properties properties_; const Operator::Properties properties_;
RegList callee_saved_registers_; const RegList callee_saved_registers_;
Flags flags_; const Flags flags_;
const char* debug_name_; const char* const debug_name_;
DISALLOW_COPY_AND_ASSIGN(CallDescriptor);
}; };
DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags) DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags)
...@@ -161,25 +163,28 @@ std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k); ...@@ -161,25 +163,28 @@ std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k);
// Call[Runtime] CEntryStub, arg 1, arg 2, arg 3, [...], fun, #arg, context // Call[Runtime] CEntryStub, arg 1, arg 2, arg 3, [...], fun, #arg, context
class Linkage : public ZoneObject { class Linkage : public ZoneObject {
public: public:
explicit Linkage(CompilationInfo* info); Linkage(Zone* zone, CompilationInfo* info)
explicit Linkage(CompilationInfo* info, CallDescriptor* incoming) : zone_(zone), incoming_(ComputeIncoming(zone, info)) {}
: info_(info), incoming_(incoming) {} Linkage(Zone* zone, CallDescriptor* incoming)
: zone_(zone), incoming_(incoming) {}
static CallDescriptor* ComputeIncoming(Zone* zone, CompilationInfo* info);
// The call descriptor for this compilation unit describes the locations // The call descriptor for this compilation unit describes the locations
// of incoming parameters and the outgoing return value(s). // of incoming parameters and the outgoing return value(s).
CallDescriptor* GetIncomingDescriptor() { return incoming_; } CallDescriptor* GetIncomingDescriptor() const { return incoming_; }
CallDescriptor* GetJSCallDescriptor(int parameter_count); CallDescriptor* GetJSCallDescriptor(int parameter_count) const;
static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone); static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone);
CallDescriptor* GetRuntimeCallDescriptor(Runtime::FunctionId function, CallDescriptor* GetRuntimeCallDescriptor(
int parameter_count, Runtime::FunctionId function, int parameter_count,
Operator::Properties properties); Operator::Properties properties) const;
static CallDescriptor* GetRuntimeCallDescriptor( static CallDescriptor* GetRuntimeCallDescriptor(
Runtime::FunctionId function, int parameter_count, Runtime::FunctionId function, int parameter_count,
Operator::Properties properties, Zone* zone); Operator::Properties properties, Zone* zone);
CallDescriptor* GetStubCallDescriptor( CallDescriptor* GetStubCallDescriptor(
CallInterfaceDescriptor descriptor, int stack_parameter_count = 0, CallInterfaceDescriptor descriptor, int stack_parameter_count = 0,
CallDescriptor::Flags flags = CallDescriptor::kNoFlags); CallDescriptor::Flags flags = CallDescriptor::kNoFlags) const;
static CallDescriptor* GetStubCallDescriptor( static CallDescriptor* GetStubCallDescriptor(
CallInterfaceDescriptor descriptor, int stack_parameter_count, CallInterfaceDescriptor descriptor, int stack_parameter_count,
CallDescriptor::Flags flags, Zone* zone); CallDescriptor::Flags flags, Zone* zone);
...@@ -192,37 +197,37 @@ class Linkage : public ZoneObject { ...@@ -192,37 +197,37 @@ class Linkage : public ZoneObject {
MachineSignature* sig); MachineSignature* sig);
// Get the location of an (incoming) parameter to this function. // Get the location of an (incoming) parameter to this function.
LinkageLocation GetParameterLocation(int index) { LinkageLocation GetParameterLocation(int index) const {
return incoming_->GetInputLocation(index + 1); // + 1 to skip target. return incoming_->GetInputLocation(index + 1); // + 1 to skip target.
} }
// Get the machine type of an (incoming) parameter to this function. // Get the machine type of an (incoming) parameter to this function.
MachineType GetParameterType(int index) { MachineType GetParameterType(int index) const {
return incoming_->GetInputType(index + 1); // + 1 to skip target. return incoming_->GetInputType(index + 1); // + 1 to skip target.
} }
// Get the location where this function should place its return value. // Get the location where this function should place its return value.
LinkageLocation GetReturnLocation() { LinkageLocation GetReturnLocation() const {
return incoming_->GetReturnLocation(0); return incoming_->GetReturnLocation(0);
} }
// Get the machine type of this function's return value. // Get the machine type of this function's return value.
MachineType GetReturnType() { return incoming_->GetReturnType(0); } MachineType GetReturnType() const { return incoming_->GetReturnType(0); }
// Get the frame offset for a given spill slot. The location depends on the // Get the frame offset for a given spill slot. The location depends on the
// calling convention and the specific frame layout, and may thus be // calling convention and the specific frame layout, and may thus be
// architecture-specific. Negative spill slots indicate arguments on the // architecture-specific. Negative spill slots indicate arguments on the
// caller's frame. The {extra} parameter indicates an additional offset from // caller's frame. The {extra} parameter indicates an additional offset from
// the frame offset, e.g. to index into part of a double slot. // the frame offset, e.g. to index into part of a double slot.
FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0); FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0) const;
CompilationInfo* info() const { return info_; }
static bool NeedsFrameState(Runtime::FunctionId function); static bool NeedsFrameState(Runtime::FunctionId function);
private: private:
CompilationInfo* info_; Zone* const zone_;
CallDescriptor* incoming_; CallDescriptor* const incoming_;
DISALLOW_COPY_AND_ASSIGN(Linkage);
}; };
} // namespace compiler } // namespace compiler
......
...@@ -709,7 +709,7 @@ void CodeGenerator::AssemblePrologue() { ...@@ -709,7 +709,7 @@ void CodeGenerator::AssemblePrologue() {
__ MultiPush(saves); __ MultiPush(saves);
} }
} else if (descriptor->IsJSFunctionCall()) { } else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
__ Prologue(info->IsCodePreAgingActive()); __ Prologue(info->IsCodePreAgingActive());
frame()->SetRegisterSaveAreaSize( frame()->SetRegisterSaveAreaSize(
StandardFrameConstants::kFixedFrameSizeFromFp); StandardFrameConstants::kFixedFrameSizeFromFp);
...@@ -942,7 +942,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { ...@@ -942,7 +942,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() {
void CodeGenerator::EnsureSpaceForLazyDeopt() { void CodeGenerator::EnsureSpaceForLazyDeopt() {
int space_needed = Deoptimizer::patch_size(); int space_needed = Deoptimizer::patch_size();
if (!linkage()->info()->IsStub()) { if (!info()->IsStub()) {
// Ensure that we have enough space after the previous lazy-bailout // Ensure that we have enough space after the previous lazy-bailout
// instruction for patching the code here. // instruction for patching the code here.
int current_pc = masm()->pc_offset(); int current_pc = masm()->pc_offset();
......
...@@ -397,7 +397,7 @@ Handle<Code> Pipeline::GenerateCode() { ...@@ -397,7 +397,7 @@ Handle<Code> Pipeline::GenerateCode() {
PhaseScope phase_scope(pipeline_statistics.get(), "change lowering"); PhaseScope phase_scope(pipeline_statistics.get(), "change lowering");
SourcePositionTable::Scope pos(data.source_positions(), SourcePositionTable::Scope pos(data.source_positions(),
SourcePosition::Unknown()); SourcePosition::Unknown());
Linkage linkage(info()); Linkage linkage(data.graph_zone(), info());
ValueNumberingReducer vn_reducer(data.graph_zone()); ValueNumberingReducer vn_reducer(data.graph_zone());
SimplifiedOperatorReducer simple_reducer(data.jsgraph()); SimplifiedOperatorReducer simple_reducer(data.jsgraph());
ChangeLowering lowering(data.jsgraph(), &linkage); ChangeLowering lowering(data.jsgraph(), &linkage);
...@@ -452,7 +452,7 @@ Handle<Code> Pipeline::GenerateCode() { ...@@ -452,7 +452,7 @@ Handle<Code> Pipeline::GenerateCode() {
Handle<Code> code = Handle<Code>::null(); Handle<Code> code = Handle<Code>::null();
{ {
// Generate optimized code. // Generate optimized code.
Linkage linkage(info()); Linkage linkage(data.instruction_zone(), info());
code = GenerateCode(&linkage, &data); code = GenerateCode(&linkage, &data);
info()->SetCode(code); info()->SetCode(code);
} }
...@@ -552,14 +552,13 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, PipelineData* data) { ...@@ -552,14 +552,13 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, PipelineData* data) {
{ {
int node_count = sequence.VirtualRegisterCount(); int node_count = sequence.VirtualRegisterCount();
if (node_count > UnallocatedOperand::kMaxVirtualRegisters) { if (node_count > UnallocatedOperand::kMaxVirtualRegisters) {
linkage->info()->AbortOptimization(kNotEnoughVirtualRegistersForValues); info()->AbortOptimization(kNotEnoughVirtualRegistersForValues);
return Handle<Code>::null(); return Handle<Code>::null();
} }
ZonePool::Scope zone_scope(data->zone_pool()); ZonePool::Scope zone_scope(data->zone_pool());
RegisterAllocator allocator(zone_scope.zone(), &frame, linkage->info(), RegisterAllocator allocator(zone_scope.zone(), &frame, info(), &sequence);
&sequence);
if (!allocator.Allocate(data->pipeline_statistics())) { if (!allocator.Allocate(data->pipeline_statistics())) {
linkage->info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc);
return Handle<Code>::null(); return Handle<Code>::null();
} }
if (FLAG_trace_turbo) { if (FLAG_trace_turbo) {
...@@ -582,7 +581,7 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, PipelineData* data) { ...@@ -582,7 +581,7 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, PipelineData* data) {
Handle<Code> code; Handle<Code> code;
{ {
PhaseScope phase_scope(data->pipeline_statistics(), "generate code"); PhaseScope phase_scope(data->pipeline_statistics(), "generate code");
CodeGenerator generator(&frame, linkage, &sequence); CodeGenerator generator(&frame, linkage, &sequence, info());
code = generator.GenerateCode(); code = generator.GenerateCode();
} }
if (profiler_data != NULL) { if (profiler_data != NULL) {
......
...@@ -766,7 +766,7 @@ void CodeGenerator::AssemblePrologue() { ...@@ -766,7 +766,7 @@ void CodeGenerator::AssemblePrologue() {
frame()->SetRegisterSaveAreaSize(register_save_area_size); frame()->SetRegisterSaveAreaSize(register_save_area_size);
} }
} else if (descriptor->IsJSFunctionCall()) { } else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = linkage()->info(); CompilationInfo* info = this->info();
__ Prologue(info->IsCodePreAgingActive()); __ Prologue(info->IsCodePreAgingActive());
frame()->SetRegisterSaveAreaSize( frame()->SetRegisterSaveAreaSize(
StandardFrameConstants::kFixedFrameSizeFromFp); StandardFrameConstants::kFixedFrameSizeFromFp);
...@@ -992,7 +992,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } ...@@ -992,7 +992,7 @@ void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); }
void CodeGenerator::EnsureSpaceForLazyDeopt() { void CodeGenerator::EnsureSpaceForLazyDeopt() {
int space_needed = Deoptimizer::patch_size(); int space_needed = Deoptimizer::patch_size();
if (!linkage()->info()->IsStub()) { if (!info()->IsStub()) {
// Ensure that we have enough space after the previous lazy-bailout // Ensure that we have enough space after the previous lazy-bailout
// instruction for patching the code here. // instruction for patching the code here.
int current_pc = masm()->pc_offset(); int current_pc = masm()->pc_offset();
......
...@@ -66,7 +66,7 @@ class MachineAssemblerTester : public HandleAndZoneScope, ...@@ -66,7 +66,7 @@ class MachineAssemblerTester : public HandleAndZoneScope,
CallDescriptor* call_descriptor = this->call_descriptor(); CallDescriptor* call_descriptor = this->call_descriptor();
Graph* graph = this->graph(); Graph* graph = this->graph();
CompilationInfo info(graph->zone()->isolate(), graph->zone()); CompilationInfo info(graph->zone()->isolate(), graph->zone());
Linkage linkage(&info, call_descriptor); Linkage linkage(graph->zone(), call_descriptor);
Pipeline pipeline(&info); Pipeline pipeline(&info);
code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph, schedule); code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph, schedule);
} }
......
...@@ -221,7 +221,7 @@ class FunctionTester : public InitializedHandleScope { ...@@ -221,7 +221,7 @@ class FunctionTester : public InitializedHandleScope {
CHECK(Compiler::EnsureDeoptimizationSupport(&info)); CHECK(Compiler::EnsureDeoptimizationSupport(&info));
Pipeline pipeline(&info); Pipeline pipeline(&info);
Linkage linkage(&info); Linkage linkage(info.zone(), &info);
Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph); Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph);
CHECK(!code.is_null()); CHECK(!code.is_null());
function->ReplaceCode(*code); function->ReplaceCode(*code);
......
...@@ -36,7 +36,7 @@ byte* MachineCallHelper::Generate() { ...@@ -36,7 +36,7 @@ byte* MachineCallHelper::Generate() {
if (code_.is_null()) { if (code_.is_null()) {
Zone* zone = graph_->zone(); Zone* zone = graph_->zone();
CompilationInfo info(zone->isolate(), zone); CompilationInfo info(zone->isolate(), zone);
Linkage linkage(&info, Linkage linkage(zone,
Linkage::GetSimplifiedCDescriptor(zone, machine_sig_)); Linkage::GetSimplifiedCDescriptor(zone, machine_sig_));
Pipeline pipeline(&info); Pipeline pipeline(&info);
code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph_); code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph_);
......
...@@ -125,7 +125,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> { ...@@ -125,7 +125,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
void LowerChange(Node* change) { void LowerChange(Node* change) {
// Run the graph reducer with changes lowering on a single node. // Run the graph reducer with changes lowering on a single node.
CompilationInfo info(this->isolate(), this->zone()); CompilationInfo info(this->isolate(), this->zone());
Linkage linkage(&info); Linkage linkage(this->zone(), &info);
ChangeLowering lowering(&jsgraph, &linkage); ChangeLowering lowering(&jsgraph, &linkage);
GraphReducer reducer(this->graph()); GraphReducer reducer(this->graph());
reducer.AddReducer(&lowering); reducer.AddReducer(&lowering);
......
...@@ -66,7 +66,7 @@ class DeoptCodegenTester { ...@@ -66,7 +66,7 @@ class DeoptCodegenTester {
} }
// Initialize the codegen and generate code. // Initialize the codegen and generate code.
Linkage* linkage = new (scope_->main_zone()) Linkage(&info); Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info);
code = new v8::internal::compiler::InstructionSequence(scope_->main_zone(), code = new v8::internal::compiler::InstructionSequence(scope_->main_zone(),
graph, schedule); graph, schedule);
SourcePositionTable source_positions(graph); SourcePositionTable source_positions(graph);
...@@ -88,7 +88,7 @@ class DeoptCodegenTester { ...@@ -88,7 +88,7 @@ class DeoptCodegenTester {
<< *code; << *code;
} }
compiler::CodeGenerator generator(&frame, linkage, code); compiler::CodeGenerator generator(&frame, linkage, code, &info);
result_code = generator.GenerateCode(); result_code = generator.GenerateCode();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
......
...@@ -31,7 +31,7 @@ class InstructionTester : public HandleAndZoneScope { ...@@ -31,7 +31,7 @@ class InstructionTester : public HandleAndZoneScope {
graph(zone()), graph(zone()),
schedule(zone()), schedule(zone()),
info(static_cast<HydrogenCodeStub*>(NULL), main_isolate()), info(static_cast<HydrogenCodeStub*>(NULL), main_isolate()),
linkage(&info), linkage(zone(), &info),
common(zone()), common(zone()),
code(NULL) {} code(NULL) {}
......
...@@ -45,7 +45,7 @@ TEST(TestLinkageCreate) { ...@@ -45,7 +45,7 @@ TEST(TestLinkageCreate) {
InitializedHandleScope handles; InitializedHandleScope handles;
Handle<JSFunction> function = Compile("a + b"); Handle<JSFunction> function = Compile("a + b");
CompilationInfoWithZone info(function); CompilationInfoWithZone info(function);
Linkage linkage(&info); Linkage linkage(info.zone(), &info);
} }
...@@ -60,7 +60,7 @@ TEST(TestLinkageJSFunctionIncoming) { ...@@ -60,7 +60,7 @@ TEST(TestLinkageJSFunctionIncoming) {
Handle<JSFunction> function = v8::Utils::OpenHandle( Handle<JSFunction> function = v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CompileRun(sources[i]))); *v8::Handle<v8::Function>::Cast(CompileRun(sources[i])));
CompilationInfoWithZone info(function); CompilationInfoWithZone info(function);
Linkage linkage(&info); Linkage linkage(info.zone(), &info);
CallDescriptor* descriptor = linkage.GetIncomingDescriptor(); CallDescriptor* descriptor = linkage.GetIncomingDescriptor();
CHECK_NE(NULL, descriptor); CHECK_NE(NULL, descriptor);
...@@ -76,7 +76,7 @@ TEST(TestLinkageJSFunctionIncoming) { ...@@ -76,7 +76,7 @@ TEST(TestLinkageJSFunctionIncoming) {
TEST(TestLinkageCodeStubIncoming) { TEST(TestLinkageCodeStubIncoming) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
CompilationInfoWithZone info(static_cast<HydrogenCodeStub*>(NULL), isolate); CompilationInfoWithZone info(static_cast<HydrogenCodeStub*>(NULL), isolate);
Linkage linkage(&info); Linkage linkage(info.zone(), &info);
// TODO(titzer): test linkage creation with a bonafide code stub. // TODO(titzer): test linkage creation with a bonafide code stub.
// this just checks current behavior. // this just checks current behavior.
CHECK_EQ(NULL, linkage.GetIncomingDescriptor()); CHECK_EQ(NULL, linkage.GetIncomingDescriptor());
...@@ -87,7 +87,7 @@ TEST(TestLinkageJSCall) { ...@@ -87,7 +87,7 @@ TEST(TestLinkageJSCall) {
HandleAndZoneScope handles; HandleAndZoneScope handles;
Handle<JSFunction> function = Compile("a + c"); Handle<JSFunction> function = Compile("a + c");
CompilationInfoWithZone info(function); CompilationInfoWithZone info(function);
Linkage linkage(&info); Linkage linkage(info.zone(), &info);
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
CallDescriptor* descriptor = linkage.GetJSCallDescriptor(i); CallDescriptor* descriptor = linkage.GetJSCallDescriptor(i);
......
...@@ -61,7 +61,7 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { ...@@ -61,7 +61,7 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
Zone* zone = this->zone(); Zone* zone = this->zone();
CompilationInfo info(zone->isolate(), zone); CompilationInfo info(zone->isolate(), zone);
Linkage linkage( Linkage linkage(
&info, Linkage::GetSimplifiedCDescriptor(zone, this->machine_sig_)); zone, Linkage::GetSimplifiedCDescriptor(zone, this->machine_sig_));
ChangeLowering lowering(&jsgraph, &linkage); ChangeLowering lowering(&jsgraph, &linkage);
GraphReducer reducer(this->graph()); GraphReducer reducer(this->graph());
reducer.AddReducer(&lowering); reducer.AddReducer(&lowering);
......
...@@ -69,7 +69,7 @@ class ChangeLoweringTest : public GraphTest { ...@@ -69,7 +69,7 @@ class ChangeLoweringTest : public GraphTest {
JSOperatorBuilder javascript(zone()); JSOperatorBuilder javascript(zone());
JSGraph jsgraph(graph(), common(), &javascript, &machine); JSGraph jsgraph(graph(), common(), &javascript, &machine);
CompilationInfo info(isolate(), zone()); CompilationInfo info(isolate(), zone());
Linkage linkage(&info); Linkage linkage(zone(), &info);
ChangeLowering reducer(&jsgraph, &linkage); ChangeLowering reducer(&jsgraph, &linkage);
return reducer.Reduce(node); return reducer.Reduce(node);
} }
......
...@@ -36,8 +36,7 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( ...@@ -36,8 +36,7 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
} }
EXPECT_NE(0, graph()->NodeCount()); EXPECT_NE(0, graph()->NodeCount());
int initial_node_count = graph()->NodeCount(); int initial_node_count = graph()->NodeCount();
CompilationInfo info(test_->isolate(), test_->zone()); Linkage linkage(test_->zone(), call_descriptor());
Linkage linkage(&info, call_descriptor());
InstructionSequence sequence(test_->zone(), graph(), schedule); InstructionSequence sequence(test_->zone(), graph(), schedule);
SourcePositionTable source_position_table(graph()); SourcePositionTable source_position_table(graph());
InstructionSelector selector(test_->zone(), &linkage, &sequence, schedule, InstructionSelector selector(test_->zone(), &linkage, &sequence, schedule,
......
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