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

Unified Diff: src/lithium.cc

Issue 10700115: Break Crankshaft into phases. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Clean up dependencies Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« src/lithium.h ('K') | « src/lithium.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lithium.cc
diff --git a/src/lithium.cc b/src/lithium.cc
index fd8b7965f1d7497cb1ae29fc05636a47be7a84a3..441d5b1ae610081d0922b316259b222d9e207106 100644
--- a/src/lithium.cc
+++ b/src/lithium.cc
@@ -27,6 +27,20 @@
#include "v8.h"
#include "lithium.h"
+#include "lithium-allocator.h"
+#include "lithium-allocator-inl.h"
+
+#if V8_TARGET_ARCH_IA32
+#include "ia32/lithium-codegen-ia32.h"
+#elif V8_TARGET_ARCH_X64
+#include "x64/lithium-codegen-x64.h"
+#elif V8_TARGET_ARCH_ARM
+#include "arm/lithium-codegen-arm.h"
+#elif V8_TARGET_ARCH_MIPS
+#include "mips/lithium-codegen-mips.h"
+#else
+#error Unsupported target architecture.
+#endif
namespace v8 {
namespace internal {
@@ -240,4 +254,46 @@ int ElementsKindToShiftSize(ElementsKind elements_kind) {
}
+LChunk* Lithium::CreateChunk(HGraph* graph, HGraphBuilder* graph_builder) {
danno 2012/07/11 10:04:57 Again, adding a dependency on graph builder here i
+ int values = graph->GetMaximumValueID();
+ if (values > LUnallocated::kMaxVirtualRegisters) {
+ graph_builder->Bailout("Not enough virtual registers for (values).\n");
+ return NULL;
+ }
+ LAllocator allocator(values, graph);
+ LChunkBuilder builder(graph->info(), graph, &allocator);
+ LChunk* chunk = builder.Build();
+ if (chunk == NULL) return NULL;
+
+ if (!allocator.Allocate(chunk)) {
+ graph_builder->Bailout("Not enough virtual registers (regalloc).\n");
+ return NULL;
+ }
+
+ return chunk;
+}
+
+
+Handle<Code> Lithium::Codegen(LChunk* chunk) {
+ MacroAssembler assembler(chunk->info()->isolate(), NULL, 0);
+ LCodeGen generator(chunk, &assembler, chunk->info());
+
+ chunk->MarkEmptyBlocks();
+
+ if (generator.GenerateCode()) {
+ if (FLAG_trace_codegen) {
+ PrintF("Crankshaft Compiler - ");
+ }
+ CodeGenerator::MakeCodePrologue(chunk->info());
+ Code::Flags flags = Code::ComputeFlags(Code::OPTIMIZED_FUNCTION);
+ Handle<Code> code =
+ CodeGenerator::MakeCodeEpilogue(&assembler, flags, chunk->info());
+ generator.FinishCode(code);
+ CodeGenerator::PrintCode(code, chunk->info());
+ return code;
+ }
+ return Handle<Code>::null();
+}
+
+
} } // namespace v8::internal
« src/lithium.h ('K') | « src/lithium.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698