[test] Remove pesky MachineCallHelper from inheritance chain.
R=titzer@chromium.org Review URL: https://codereview.chromium.org/1109853003 Cr-Commit-Position: refs/heads/master@{#28173}
This commit is contained in:
parent
b0dcf6abf2
commit
986e242976
@ -48,7 +48,6 @@
|
||||
'compiler/codegen-tester.cc',
|
||||
'compiler/codegen-tester.h',
|
||||
'compiler/function-tester.h',
|
||||
'compiler/graph-builder-tester.cc',
|
||||
'compiler/graph-builder-tester.h',
|
||||
'compiler/simplified-graph-builder.cc',
|
||||
'compiler/simplified-graph-builder.h',
|
||||
|
@ -1,56 +0,0 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "test/cctest/compiler/graph-builder-tester.h"
|
||||
|
||||
#include "src/compiler/linkage.h"
|
||||
#include "src/compiler/pipeline.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
MachineCallHelper::MachineCallHelper(Isolate* isolate,
|
||||
MachineSignature* machine_sig)
|
||||
: CallHelper(isolate, machine_sig),
|
||||
parameters_(NULL),
|
||||
isolate_(isolate),
|
||||
graph_(NULL) {}
|
||||
|
||||
|
||||
void MachineCallHelper::InitParameters(GraphBuilder* builder,
|
||||
CommonOperatorBuilder* common) {
|
||||
DCHECK(!parameters_);
|
||||
graph_ = builder->graph();
|
||||
int param_count = static_cast<int>(parameter_count());
|
||||
if (param_count == 0) return;
|
||||
parameters_ = graph_->zone()->NewArray<Node*>(param_count);
|
||||
for (int i = 0; i < param_count; ++i) {
|
||||
parameters_[i] = builder->NewNode(common->Parameter(i), graph_->start());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
byte* MachineCallHelper::Generate() {
|
||||
DCHECK(parameter_count() == 0 || parameters_ != NULL);
|
||||
if (!Pipeline::SupportedBackend()) return NULL;
|
||||
if (code_.is_null()) {
|
||||
Zone* zone = graph_->zone();
|
||||
CallDescriptor* desc =
|
||||
Linkage::GetSimplifiedCDescriptor(zone, machine_sig_);
|
||||
code_ = Pipeline::GenerateCodeForTesting(isolate_, desc, graph_);
|
||||
}
|
||||
return code_.ToHandleChecked()->entry();
|
||||
}
|
||||
|
||||
|
||||
Node* MachineCallHelper::Parameter(size_t index) {
|
||||
DCHECK(parameters_);
|
||||
DCHECK(index < parameter_count());
|
||||
return parameters_[index];
|
||||
}
|
||||
|
||||
} // namespace compiler
|
||||
} // namespace internal
|
||||
} // namespace v8
|
@ -10,7 +10,9 @@
|
||||
|
||||
#include "src/compiler/common-operator.h"
|
||||
#include "src/compiler/graph-builder.h"
|
||||
#include "src/compiler/linkage.h"
|
||||
#include "src/compiler/machine-operator.h"
|
||||
#include "src/compiler/pipeline.h"
|
||||
#include "src/compiler/simplified-operator.h"
|
||||
#include "test/cctest/compiler/call-tester.h"
|
||||
#include "test/cctest/compiler/simplified-graph-builder.h"
|
||||
@ -19,30 +21,6 @@ namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
class MachineCallHelper : public CallHelper {
|
||||
public:
|
||||
MachineCallHelper(Isolate* isolate, MachineSignature* machine_sig);
|
||||
|
||||
Node* Parameter(size_t index);
|
||||
|
||||
void GenerateCode() { Generate(); }
|
||||
|
||||
protected:
|
||||
virtual byte* Generate();
|
||||
void InitParameters(GraphBuilder* builder, CommonOperatorBuilder* common);
|
||||
|
||||
protected:
|
||||
size_t parameter_count() const { return machine_sig_->parameter_count(); }
|
||||
|
||||
private:
|
||||
Node** parameters_;
|
||||
// TODO(dcarney): shouldn't need graph stored.
|
||||
Isolate* isolate_;
|
||||
Graph* graph_;
|
||||
MaybeHandle<Code> code_;
|
||||
};
|
||||
|
||||
|
||||
class GraphAndBuilders {
|
||||
public:
|
||||
explicit GraphAndBuilders(Zone* zone)
|
||||
@ -52,7 +30,7 @@ class GraphAndBuilders {
|
||||
main_simplified_(zone) {}
|
||||
|
||||
protected:
|
||||
// Prefixed with main_ to avoid naiming conflicts.
|
||||
// Prefixed with main_ to avoid naming conflicts.
|
||||
Graph* main_graph_;
|
||||
CommonOperatorBuilder main_common_;
|
||||
MachineOperatorBuilder main_machine_;
|
||||
@ -64,7 +42,7 @@ template <typename ReturnType>
|
||||
class GraphBuilderTester
|
||||
: public HandleAndZoneScope,
|
||||
private GraphAndBuilders,
|
||||
public MachineCallHelper,
|
||||
public CallHelper,
|
||||
public SimplifiedGraphBuilder,
|
||||
public CallHelper2<ReturnType, GraphBuilderTester<ReturnType> > {
|
||||
public:
|
||||
@ -74,20 +52,53 @@ class GraphBuilderTester
|
||||
MachineType p3 = kMachNone,
|
||||
MachineType p4 = kMachNone)
|
||||
: GraphAndBuilders(main_zone()),
|
||||
MachineCallHelper(
|
||||
CallHelper(
|
||||
main_isolate(),
|
||||
MakeMachineSignature(
|
||||
main_zone(), ReturnValueTraits<ReturnType>::Representation(),
|
||||
p0, p1, p2, p3, p4)),
|
||||
SimplifiedGraphBuilder(main_isolate(), main_graph_, &main_common_,
|
||||
&main_machine_, &main_simplified_) {
|
||||
&main_machine_, &main_simplified_),
|
||||
parameters_(main_zone()->template NewArray<Node*>(parameter_count())) {
|
||||
Begin(static_cast<int>(parameter_count()));
|
||||
InitParameters(this, &main_common_);
|
||||
InitParameters();
|
||||
}
|
||||
virtual ~GraphBuilderTester() {}
|
||||
|
||||
void GenerateCode() { Generate(); }
|
||||
Node* Parameter(size_t index) {
|
||||
DCHECK(index < parameter_count());
|
||||
return parameters_[index];
|
||||
}
|
||||
|
||||
Factory* factory() const { return isolate()->factory(); }
|
||||
|
||||
protected:
|
||||
virtual byte* Generate() {
|
||||
if (!Pipeline::SupportedBackend()) return NULL;
|
||||
if (code_.is_null()) {
|
||||
Zone* zone = graph()->zone();
|
||||
CallDescriptor* desc =
|
||||
Linkage::GetSimplifiedCDescriptor(zone, machine_sig_);
|
||||
code_ = Pipeline::GenerateCodeForTesting(main_isolate(), desc, graph());
|
||||
}
|
||||
return code_.ToHandleChecked()->entry();
|
||||
}
|
||||
|
||||
void InitParameters() {
|
||||
int param_count = static_cast<int>(parameter_count());
|
||||
for (int i = 0; i < param_count; ++i) {
|
||||
parameters_[i] = this->NewNode(common()->Parameter(i), graph()->start());
|
||||
}
|
||||
}
|
||||
|
||||
size_t parameter_count() const { return machine_sig_->parameter_count(); }
|
||||
|
||||
private:
|
||||
Node** parameters_;
|
||||
MaybeHandle<Code> code_;
|
||||
};
|
||||
|
||||
} // namespace compiler
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
Loading…
Reference in New Issue
Block a user