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 { ...@@ -35,16 +35,22 @@ namespace v8 {
namespace internal { namespace internal {
Handle<Code> HydrogenCodeStub::CodeFromGraph(HGraph* graph) { // TODO(svenpanne) Merge with OptimizingCompiler::OptimizeGraph().
graph->OrderBlocks(); static LChunk* OptimizeGraph(HGraph* graph) {
graph->AssignDominators(); AssertNoAllocation no_gc;
graph->CollectPhis(); NoHandleAllocation no_handles;
graph->InsertRepresentationChanges(); NoHandleDereference no_deref;
graph->EliminateRedundantBoundsChecks();
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); LChunk* chunk = LChunk::NewChunk(graph);
ASSERT(chunk != NULL); if (chunk == NULL) {
Handle<Code> stub = chunk->Codegen(Code::COMPILED_STUB); FATAL(graph->info()->bailout_reason());
return stub; }
return chunk;
} }
...@@ -133,7 +139,8 @@ void CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { ...@@ -133,7 +139,8 @@ void CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() {
Handle<Code> KeyedLoadFastElementStub::GenerateCode() { Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this); 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 { ...@@ -274,9 +274,6 @@ class HydrogenCodeStub : public CodeStub {
virtual void InitializeInterfaceDescriptor( virtual void InitializeInterfaceDescriptor(
Isolate* isolate, Isolate* isolate,
CodeStubInterfaceDescriptor* descriptor) = 0; 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