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
This commit is contained in:
svenpanne@chromium.org 2013-01-28 13:24:41 +00:00
parent c8636a2809
commit 8a86ce7ef6
2 changed files with 17 additions and 13 deletions

View File

@ -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);
}

View File

@ -274,9 +274,6 @@ class HydrogenCodeStub : public CodeStub {
virtual void InitializeInterfaceDescriptor(
Isolate* isolate,
CodeStubInterfaceDescriptor* descriptor) = 0;
protected:
Handle<Code> CodeFromGraph(HGraph* graph);
};