Remove overly complex MachineNodeFactory.

R=titzer@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23702 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 447f2839
......@@ -512,7 +512,6 @@ source_set("v8_base") {
"src/compiler/linkage-impl.h",
"src/compiler/linkage.cc",
"src/compiler/linkage.h",
"src/compiler/machine-node-factory.h",
"src/compiler/machine-operator-reducer.cc",
"src/compiler/machine-operator-reducer.h",
"src/compiler/machine-operator.h",
......
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,6 @@
#include "src/compiler/common-operator.h"
#include "src/compiler/graph-builder.h"
#include "src/compiler/machine-node-factory.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/simplified-operator.h"
#include "test/cctest/compiler/call-tester.h"
......
......@@ -7,7 +7,6 @@
#include "src/compiler/common-operator.h"
#include "src/compiler/graph-builder.h"
#include "src/compiler/machine-node-factory.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/simplified-operator.h"
#include "test/cctest/cctest.h"
......@@ -17,9 +16,7 @@ namespace v8 {
namespace internal {
namespace compiler {
class SimplifiedGraphBuilder
: public GraphBuilder,
public MachineNodeFactory<SimplifiedGraphBuilder> {
class SimplifiedGraphBuilder : public GraphBuilder {
public:
SimplifiedGraphBuilder(Graph* graph, CommonOperatorBuilder* common,
MachineOperatorBuilder* machine,
......@@ -40,6 +37,19 @@ class SimplifiedGraphBuilder
// Close the graph.
void End();
Node* PointerConstant(void* value) {
intptr_t intptr_value = reinterpret_cast<intptr_t>(value);
return kPointerSize == 8 ? NewNode(common()->Int64Constant(intptr_value))
: Int32Constant(static_cast<int>(intptr_value));
}
Node* Int32Constant(int32_t value) {
return NewNode(common()->Int32Constant(value));
}
Node* HeapConstant(Handle<Object> object) {
Unique<Object> val = Unique<Object>::CreateUninitialized(object);
return NewNode(common()->HeapConstant(val));
}
Node* BooleanNot(Node* a) { return NewNode(simplified()->BooleanNot(), a); }
Node* NumberEqual(Node* a, Node* b) {
......
......@@ -18,44 +18,10 @@ void Variable::Set(Node* value) const { smasm_->SetVariable(offset_, value); }
StructuredMachineAssembler::StructuredMachineAssembler(
Graph* graph, MachineSignature* machine_sig, MachineType word)
: GraphBuilder(graph),
schedule_(new (zone()) Schedule(zone())),
machine_(zone(), word),
common_(zone()),
machine_sig_(machine_sig),
call_descriptor_(
Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)),
parameters_(NULL),
: RawMachineAssembler(graph, machine_sig, word),
current_environment_(new (zone())
Environment(zone(), schedule()->start(), false)),
number_of_variables_(0) {
int param_count = static_cast<int>(parameter_count());
Node* s = graph->NewNode(common_.Start(param_count));
graph->SetStart(s);
if (parameter_count() == 0) return;
parameters_ = zone()->NewArray<Node*>(param_count);
for (size_t i = 0; i < parameter_count(); ++i) {
parameters_[i] =
NewNode(common()->Parameter(static_cast<int>(i)), graph->start());
}
}
Schedule* StructuredMachineAssembler::Export() {
// Compute the correct codegen order.
DCHECK(schedule_->rpo_order()->empty());
Scheduler::ComputeSpecialRPO(schedule_);
// Invalidate MachineAssembler.
Schedule* schedule = schedule_;
schedule_ = NULL;
return schedule;
}
Node* StructuredMachineAssembler::Parameter(size_t index) {
DCHECK(index < parameter_count());
return parameters_[index];
}
number_of_variables_(0) {}
Node* StructuredMachineAssembler::MakeNode(Operator* op, int input_count,
......
......@@ -9,10 +9,10 @@
#include "src/compiler/common-operator.h"
#include "src/compiler/graph-builder.h"
#include "src/compiler/machine-node-factory.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node.h"
#include "src/compiler/operator.h"
#include "src/compiler/raw-machine-assembler.h"
namespace v8 {
......@@ -40,9 +40,7 @@ class Variable : public ZoneObject {
};
class StructuredMachineAssembler
: public GraphBuilder,
public MachineNodeFactory<StructuredMachineAssembler> {
class StructuredMachineAssembler : public RawMachineAssembler {
public:
class Environment : public ZoneObject {
public:
......@@ -65,35 +63,15 @@ class StructuredMachineAssembler
MachineType word = kMachPtr);
virtual ~StructuredMachineAssembler() {}
Isolate* isolate() const { return zone()->isolate(); }
Zone* zone() const { return graph()->zone(); }
MachineOperatorBuilder* machine() { return &machine_; }
CommonOperatorBuilder* common() { return &common_; }
CallDescriptor* call_descriptor() const { return call_descriptor_; }
size_t parameter_count() const { return machine_sig_->parameter_count(); }
MachineSignature* machine_sig() const { return machine_sig_; }
// Parameters.
Node* Parameter(size_t index);
// Variables.
Variable NewVariable(Node* initial_value);
// Control flow.
void Return(Node* value);
// MachineAssembler is invalid after export.
Schedule* Export();
protected:
virtual Node* MakeNode(Operator* op, int input_count, Node** inputs);
Schedule* schedule() {
DCHECK(ScheduleValid());
return schedule_;
}
private:
bool ScheduleValid() { return schedule_ != NULL; }
typedef ZoneVector<Environment*> EnvironmentVector;
NodeVector* CurrentVars() { return &current_environment_->variables_; }
......@@ -116,12 +94,6 @@ class StructuredMachineAssembler
void MergeBackEdgesToLoopHeader(Environment* header,
EnvironmentVector* environments);
Schedule* schedule_;
MachineOperatorBuilder machine_;
CommonOperatorBuilder common_;
MachineSignature* machine_sig_;
CallDescriptor* call_descriptor_;
Node** parameters_;
Environment* current_environment_;
int number_of_variables_;
......
......@@ -424,7 +424,6 @@
'../../src/compiler/linkage-impl.h',
'../../src/compiler/linkage.cc',
'../../src/compiler/linkage.h',
'../../src/compiler/machine-node-factory.h',
'../../src/compiler/machine-operator-reducer.cc',
'../../src/compiler/machine-operator-reducer.h',
'../../src/compiler/machine-operator.h',
......
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