Do not duplicate the compilation pipeline for stub compilation.

The previous duplication is quite bad from an architectural point of
view. Furthermore, it messes up the output of --hydrogen-stats.

As remarked in a comment, there is still more unification work to do, but at
least this CL is a step in the right direction...

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13527 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c8636a28
......@@ -35,16 +35,22 @@ namespace v8 {
namespace internal {
Handle<Code> HydrogenCodeStub::CodeFromGraph(HGraph* graph) {
graph->OrderBlocks();
graph->AssignDominators();
graph->CollectPhis();
graph->InsertRepresentationChanges();
graph->EliminateRedundantBoundsChecks();
// TODO(svenpanne) Merge with OptimizingCompiler::OptimizeGraph().
static LChunk* OptimizeGraph(HGraph* graph) {
AssertNoAllocation no_gc;
NoHandleAllocation no_handles;
NoHandleDereference no_deref;
ASSERT(graph != NULL);
SmartArrayPointer<char> bailout_reason;
if (!graph->Optimize(&bailout_reason)) {
FATAL(bailout_reason.is_empty() ? "unknown" : *bailout_reason);
}
LChunk* chunk = LChunk::NewChunk(graph);
ASSERT(chunk != NULL);
Handle<Code> stub = chunk->Codegen(Code::COMPILED_STUB);
return stub;
if (chunk == NULL) {
FATAL(graph->info()->bailout_reason());
}
return chunk;
}
......@@ -133,7 +139,8 @@ void CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() {
Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this);
return CodeFromGraph(builder.CreateGraph());
LChunk* chunk = OptimizeGraph(builder.CreateGraph());
return chunk->Codegen(Code::COMPILED_STUB);
}
......
......@@ -274,9 +274,6 @@ class HydrogenCodeStub : public CodeStub {
virtual void InitializeInterfaceDescriptor(
Isolate* isolate,
CodeStubInterfaceDescriptor* descriptor) = 0;
protected:
Handle<Code> CodeFromGraph(HGraph* graph);
};
......
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