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

Side by Side 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, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 17 matching lines...) Expand all
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "code-stubs.h" 30 #include "code-stubs.h"
31 #include "hydrogen.h" 31 #include "hydrogen.h"
32 #include "lithium.h" 32 #include "lithium.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 37
38 Handle<Code> HydrogenCodeStub::CodeFromGraph(HGraph* graph) { 38 // TODO(svenpanne) Merge with OptimizingCompiler::OptimizeGraph().
39 graph->OrderBlocks(); 39 static LChunk* OptimizeGraph(HGraph* graph) {
40 graph->AssignDominators(); 40 AssertNoAllocation no_gc;
41 graph->CollectPhis(); 41 NoHandleAllocation no_handles;
42 graph->InsertRepresentationChanges(); 42 NoHandleDereference no_deref;
43 graph->EliminateRedundantBoundsChecks(); 43
44 ASSERT(graph != NULL);
45 SmartArrayPointer<char> bailout_reason;
46 if (!graph->Optimize(&bailout_reason)) {
47 FATAL(bailout_reason.is_empty() ? "unknown" : *bailout_reason);
48 }
44 LChunk* chunk = LChunk::NewChunk(graph); 49 LChunk* chunk = LChunk::NewChunk(graph);
45 ASSERT(chunk != NULL); 50 if (chunk == NULL) {
46 Handle<Code> stub = chunk->Codegen(Code::COMPILED_STUB); 51 FATAL(graph->info()->bailout_reason());
47 return stub; 52 }
53 return chunk;
48 } 54 }
49 55
50 56
51 class CodeStubGraphBuilderBase : public HGraphBuilder { 57 class CodeStubGraphBuilderBase : public HGraphBuilder {
52 public: 58 public:
53 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub) 59 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub)
54 : HGraphBuilder(&info_), info_(stub, isolate), context_(NULL) {} 60 : HGraphBuilder(&info_), info_(stub, isolate), context_(NULL) {}
55 virtual bool BuildGraph(); 61 virtual bool BuildGraph();
56 62
57 protected: 63 protected:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 casted_stub()->is_js_array(), casted_stub()->elements_kind(), false); 132 casted_stub()->is_js_array(), casted_stub()->elements_kind(), false);
127 AddInstruction(load); 133 AddInstruction(load);
128 134
129 HReturn* ret = new(zone) HReturn(load, context()); 135 HReturn* ret = new(zone) HReturn(load, context());
130 current_block()->Finish(ret); 136 current_block()->Finish(ret);
131 } 137 }
132 138
133 139
134 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { 140 Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
135 CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this); 141 CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this);
136 return CodeFromGraph(builder.CreateGraph()); 142 LChunk* chunk = OptimizeGraph(builder.CreateGraph());
143 return chunk->Codegen(Code::COMPILED_STUB);
137 } 144 }
138 145
139 146
140 } } // namespace v8::internal 147 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698