Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: src/compiler/pipeline.cc

Issue 1890803002: [wasm] Generate source position information (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-throw-error
Patch Set: drop empty line ;) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/pipeline.h ('k') | src/compiler/source-position.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 5a2b9584b96d1fca5900709c19656c5158d4f127..deac01df24719b6d435ade8a4462a405f3539e7b 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -83,25 +83,12 @@ class PipelineData {
outer_zone_(info_->zone()),
zone_pool_(zone_pool),
pipeline_statistics_(pipeline_statistics),
- compilation_failed_(false),
- code_(Handle<Code>::null()),
graph_zone_scope_(zone_pool_),
graph_zone_(graph_zone_scope_.zone()),
- graph_(nullptr),
- loop_assignment_(nullptr),
- simplified_(nullptr),
- machine_(nullptr),
- common_(nullptr),
- javascript_(nullptr),
- jsgraph_(nullptr),
- schedule_(nullptr),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()),
- sequence_(nullptr),
- frame_(nullptr),
register_allocation_zone_scope_(zone_pool_),
- register_allocation_zone_(register_allocation_zone_scope_.zone()),
- register_allocation_data_(nullptr) {
+ register_allocation_zone_(register_allocation_zone_scope_.zone()) {
PhaseScope scope(pipeline_statistics, "init pipeline data");
graph_ = new (graph_zone_) Graph(graph_zone_);
source_positions_ = new (graph_zone_->New(sizeof(SourcePositionTable)))
@@ -116,63 +103,48 @@ class PipelineData {
JSGraph(isolate_, graph_, common_, javascript_, simplified_, machine_);
}
+ // For WASM compile entry point.
+ PipelineData(ZonePool* zone_pool, CompilationInfo* info, Graph* graph,
+ SourcePositionTable* source_positions)
+ : isolate_(info->isolate()),
+ info_(info),
+ zone_pool_(zone_pool),
+ graph_zone_scope_(zone_pool_),
+ graph_(graph),
+ source_positions_(source_positions),
+ instruction_zone_scope_(zone_pool_),
+ instruction_zone_(instruction_zone_scope_.zone()),
+ register_allocation_zone_scope_(zone_pool_),
+ register_allocation_zone_(register_allocation_zone_scope_.zone()) {}
+
// For machine graph testing entry point.
PipelineData(ZonePool* zone_pool, CompilationInfo* info, Graph* graph,
Schedule* schedule)
: isolate_(info->isolate()),
info_(info),
- outer_zone_(nullptr),
zone_pool_(zone_pool),
- pipeline_statistics_(nullptr),
- compilation_failed_(false),
- code_(Handle<Code>::null()),
graph_zone_scope_(zone_pool_),
- graph_zone_(nullptr),
graph_(graph),
source_positions_(new (info->zone()->New(sizeof(SourcePositionTable)))
SourcePositionTable(graph_)),
- loop_assignment_(nullptr),
- simplified_(nullptr),
- machine_(nullptr),
- common_(nullptr),
- javascript_(nullptr),
- jsgraph_(nullptr),
schedule_(schedule),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()),
- sequence_(nullptr),
- frame_(nullptr),
register_allocation_zone_scope_(zone_pool_),
- register_allocation_zone_(register_allocation_zone_scope_.zone()),
- register_allocation_data_(nullptr) {}
+ register_allocation_zone_(register_allocation_zone_scope_.zone()) {}
// For register allocation testing entry point.
PipelineData(ZonePool* zone_pool, CompilationInfo* info,
InstructionSequence* sequence)
: isolate_(info->isolate()),
info_(info),
- outer_zone_(nullptr),
zone_pool_(zone_pool),
- pipeline_statistics_(nullptr),
- compilation_failed_(false),
- code_(Handle<Code>::null()),
graph_zone_scope_(zone_pool_),
- graph_zone_(nullptr),
- graph_(nullptr),
- loop_assignment_(nullptr),
- simplified_(nullptr),
- machine_(nullptr),
- common_(nullptr),
- javascript_(nullptr),
- jsgraph_(nullptr),
- schedule_(nullptr),
instruction_zone_scope_(zone_pool_),
instruction_zone_(sequence->zone()),
sequence_(sequence),
- frame_(nullptr),
register_allocation_zone_scope_(zone_pool_),
- register_allocation_zone_(register_allocation_zone_scope_.zone()),
- register_allocation_data_(nullptr) {}
+ register_allocation_zone_(register_allocation_zone_scope_.zone()) {}
~PipelineData() {
DeleteRegisterAllocationZone();
@@ -197,7 +169,10 @@ class PipelineData {
Zone* graph_zone() const { return graph_zone_; }
Graph* graph() const { return graph_; }
- SourcePositionTable* source_positions() const { return source_positions_; }
+ SourcePositionTable* source_positions() const {
+ DCHECK_NOT_NULL(source_positions_);
+ return source_positions_;
+ }
MachineOperatorBuilder* machine() const { return machine_; }
CommonOperatorBuilder* common() const { return common_; }
JSOperatorBuilder* javascript() const { return javascript_; }
@@ -304,26 +279,26 @@ class PipelineData {
private:
Isolate* isolate_;
CompilationInfo* info_;
- Zone* outer_zone_;
+ Zone* outer_zone_ = nullptr;
ZonePool* const zone_pool_;
- PipelineStatistics* pipeline_statistics_;
- bool compilation_failed_;
+ PipelineStatistics* pipeline_statistics_ = nullptr;
+ bool compilation_failed_ = false;
Handle<Code> code_;
// All objects in the following group of fields are allocated in graph_zone_.
// They are all set to nullptr when the graph_zone_ is destroyed.
ZonePool::Scope graph_zone_scope_;
- Zone* graph_zone_;
- Graph* graph_;
- SourcePositionTable* source_positions_;
- LoopAssignmentAnalysis* loop_assignment_;
+ Zone* graph_zone_ = nullptr;
+ Graph* graph_ = nullptr;
+ SourcePositionTable* source_positions_ = nullptr;
+ LoopAssignmentAnalysis* loop_assignment_ = nullptr;
TypeHintAnalysis* type_hint_analysis_ = nullptr;
- SimplifiedOperatorBuilder* simplified_;
- MachineOperatorBuilder* machine_;
- CommonOperatorBuilder* common_;
- JSOperatorBuilder* javascript_;
- JSGraph* jsgraph_;
- Schedule* schedule_;
+ SimplifiedOperatorBuilder* simplified_ = nullptr;
+ MachineOperatorBuilder* machine_ = nullptr;
+ CommonOperatorBuilder* common_ = nullptr;
+ JSOperatorBuilder* javascript_ = nullptr;
+ JSGraph* jsgraph_ = nullptr;
+ Schedule* schedule_ = nullptr;
// All objects in the following group of fields are allocated in
// instruction_zone_. They are all set to nullptr when the instruction_zone_
@@ -331,15 +306,15 @@ class PipelineData {
// destroyed.
ZonePool::Scope instruction_zone_scope_;
Zone* instruction_zone_;
- InstructionSequence* sequence_;
- Frame* frame_;
+ InstructionSequence* sequence_ = nullptr;
+ Frame* frame_ = nullptr;
// All objects in the following group of fields are allocated in
// register_allocation_zone_. They are all set to nullptr when the zone is
// destroyed.
ZonePool::Scope register_allocation_zone_scope_;
Zone* register_allocation_zone_;
- RegisterAllocationData* register_allocation_data_;
+ RegisterAllocationData* register_allocation_data_ = nullptr;
int CalculateFixedFrameSize(CallDescriptor* descriptor) {
if (descriptor->IsJSFunctionCall()) {
@@ -1311,6 +1286,29 @@ Handle<Code> Pipeline::GenerateCode() {
Linkage::ComputeIncoming(data.instruction_zone(), info()));
}
+Handle<Code> Pipeline::GenerateWASMCode(CompilationInfo* info,
+ CallDescriptor* call_descriptor,
+ Graph* graph,
+ SourcePositionTable* source_positions) {
+ // Construct a pipeline for scheduling and code generation.
+ ZonePool zone_pool(info->isolate()->allocator());
+ PipelineData data(&zone_pool, info, graph, source_positions);
+ base::SmartPointer<PipelineStatistics> pipeline_statistics;
+ if (FLAG_turbo_stats) {
+ pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool));
+ pipeline_statistics->BeginPhaseKind("test codegen");
Michael Starzinger 2016/04/25 17:42:17 nit: s/test codegen/WASM codegen/ here.
+ }
+
+ Pipeline pipeline(info);
+ pipeline.data_ = &data;
+ if (data.schedule() == nullptr) {
Michael Starzinger 2016/04/25 17:42:17 nit: Guaranteed to always be null for WASM.
+ // TODO(rossberg): Should this really be untyped?
+ pipeline.RunPrintAndVerify("Machine", true);
+ }
+
+ Handle<Code> code = pipeline.ScheduleAndGenerateCode(call_descriptor);
+ return code;
+}
Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate,
CallDescriptor* call_descriptor,
« no previous file with comments | « src/compiler/pipeline.h ('k') | src/compiler/source-position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698