Chromium Code Reviews

Unified Diff: src/code-stubs-hydrogen.cc

Issue 12091016: Do not duplicate the compilation pipeline for stub compilation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/code-stubs.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 58e17f43f2adf7f98883e97db94b7297710949cb..db51b22896fefb2b5b95cf1394038b44769aa29d 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -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);
}
« no previous file with comments | « src/code-stubs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine