Commit c97a7acf authored by dcarney's avatar dcarney Committed by Commit bot

[turbofan] refactor pipeline to use hydrogen like Run calls

BUG=

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

Cr-Commit-Position: refs/heads/master@{#25361}
parent f3d5b13e
......@@ -58,10 +58,6 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor {
typedef StructuredGraphBuilder::Environment BaseEnvironment;
virtual BaseEnvironment* CopyEnvironment(BaseEnvironment* env) OVERRIDE;
// TODO(mstarzinger): The pipeline only needs to be a friend to access the
// function context. Remove as soon as the context is a parameter.
friend class Pipeline;
// Getters for values in the activation record.
Node* GetFunctionClosure();
Node* GetFunctionContext();
......
......@@ -17,7 +17,7 @@ namespace compiler {
// registers for a compiled function. Frames are usually populated by the
// register allocator and are used by Linkage to generate code for the prologue
// and epilogue to compiled code.
class Frame {
class Frame : public ZoneObject {
public:
Frame()
: register_save_area_size_(0),
......@@ -69,6 +69,8 @@ class Frame {
int double_spill_slot_count_;
BitVector* allocated_registers_;
BitVector* allocated_double_registers_;
DISALLOW_COPY_AND_ASSIGN(Frame);
};
......
......@@ -889,7 +889,7 @@ struct PrintableInstructionSequence;
// Represents architecture-specific generated code before, during, and after
// register allocation.
// TODO(titzer): s/IsDouble/IsFloat64/
class InstructionSequence FINAL {
class InstructionSequence FINAL : public ZoneObject {
public:
static InstructionBlocks* InstructionBlocksFor(Zone* zone,
const Schedule* schedule);
......@@ -1015,6 +1015,8 @@ class InstructionSequence FINAL {
VirtualRegisterSet doubles_;
VirtualRegisterSet references_;
DeoptimizationVector deoptimization_entries_;
DISALLOW_COPY_AND_ASSIGN(InstructionSequence);
};
......
This diff is collapsed.
......@@ -42,17 +42,25 @@ class Pipeline {
private:
CompilationInfo* info_;
PipelineData* data_;
// Helpers for executing pipeline phases.
template <typename Phase>
void Run();
template <typename Phase, typename Arg0>
void Run(Arg0 arg_0);
template <typename Phase, typename Arg0, typename Arg1>
void Run(Arg0 arg_0, Arg1 arg_1);
CompilationInfo* info() const { return info_; }
Isolate* isolate() { return info_->isolate(); }
void ComputeSchedule(PipelineData* data);
void VerifyAndPrintGraph(Graph* graph, const char* phase,
bool untyped = false);
Handle<Code> GenerateCode(Linkage* linkage, PipelineData* data);
void RunPrintAndVerify(const char* phase, bool untyped = false);
void GenerateCode(Linkage* linkage);
};
}
}
} // namespace v8::internal::compiler
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_PIPELINE_H_
......@@ -56,7 +56,7 @@ class DeoptCodegenTester {
graph = new (scope_->main_zone()) Graph(scope_->main_zone());
}
virtual ~DeoptCodegenTester() { delete code; }
virtual ~DeoptCodegenTester() {}
void GenerateCodeFromSchedule(Schedule* schedule) {
OFStream os(stdout);
......@@ -68,7 +68,8 @@ class DeoptCodegenTester {
Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info);
InstructionBlocks* instruction_blocks =
TestInstrSeq::InstructionBlocksFor(scope_->main_zone(), schedule);
code = new TestInstrSeq(scope_->main_zone(), instruction_blocks);
code = new (scope_->main_zone())
TestInstrSeq(scope_->main_zone(), instruction_blocks);
SourcePositionTable source_positions(graph);
InstructionSelector selector(scope_->main_zone(), graph, linkage, code,
schedule, &source_positions);
......
......@@ -36,8 +36,6 @@ class InstructionTester : public HandleAndZoneScope {
machine(zone()),
code(NULL) {}
~InstructionTester() { delete code; }
Isolate* isolate;
Graph graph;
Schedule schedule;
......@@ -57,7 +55,7 @@ class InstructionTester : public HandleAndZoneScope {
}
InstructionBlocks* instruction_blocks =
TestInstrSeq::InstructionBlocksFor(main_zone(), &schedule);
code = new TestInstrSeq(main_zone(), instruction_blocks);
code = new (main_zone()) TestInstrSeq(main_zone(), instruction_blocks);
}
Node* Int32Constant(int32_t val) {
......
......@@ -124,7 +124,9 @@ class RegisterAllocatorTest : public TestWithZone {
}
RegisterAllocatorTest()
: num_general_registers_(kDefaultNRegs),
: frame_(nullptr),
sequence_(nullptr),
num_general_registers_(kDefaultNRegs),
num_double_registers_(kDefaultNRegs),
instruction_blocks_(zone()),
current_instruction_index_(-1),
......@@ -151,17 +153,18 @@ class RegisterAllocatorTest : public TestWithZone {
}
Frame* frame() {
if (frame_.is_empty()) {
frame_.Reset(new Frame());
if (frame_ == nullptr) {
frame_ = new (zone()) Frame();
}
return frame_.get();
return frame_;
}
InstructionSequence* sequence() {
if (sequence_.is_empty()) {
sequence_.Reset(new InstructionSequence(zone(), &instruction_blocks_));
if (sequence_ == nullptr) {
sequence_ =
new (zone()) InstructionSequence(zone(), &instruction_blocks_);
}
return sequence_.get();
return sequence_;
}
RegisterAllocator* allocator() {
......@@ -516,9 +519,9 @@ class RegisterAllocatorTest : public TestWithZone {
typedef std::vector<BlockCompletion> Completions;
SmartPointer<RegisterConfiguration> config_;
SmartPointer<Frame> frame_;
Frame* frame_;
SmartPointer<RegisterAllocator> allocator_;
SmartPointer<InstructionSequence> sequence_;
InstructionSequence* sequence_;
int num_general_registers_;
int num_double_registers_;
......
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