OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 #include "lithium.h" | 29 #include "lithium.h" |
30 #include "scopes.h" | 30 #include "scopes.h" |
31 | 31 |
32 #if V8_TARGET_ARCH_IA32 | 32 #if V8_TARGET_ARCH_IA32 |
33 #include "ia32/lithium-ia32.h" | 33 #include "ia32/lithium-ia32.h" |
| 34 #include "ia32/lithium-codegen-ia32.h" |
34 #elif V8_TARGET_ARCH_X64 | 35 #elif V8_TARGET_ARCH_X64 |
35 #include "x64/lithium-x64.h" | 36 #include "x64/lithium-x64.h" |
| 37 #include "x64/lithium-codegen-x64.h" |
36 #elif V8_TARGET_ARCH_ARM | 38 #elif V8_TARGET_ARCH_ARM |
37 #include "arm/lithium-arm.h" | 39 #include "arm/lithium-arm.h" |
| 40 #include "arm/lithium-codegen-arm.h" |
38 #elif V8_TARGET_ARCH_MIPS | 41 #elif V8_TARGET_ARCH_MIPS |
39 #include "mips/lithium-mips.h" | 42 #include "mips/lithium-mips.h" |
| 43 #include "mips/lithium-codegen-mips.h" |
40 #else | 44 #else |
41 #error "Unknown architecture." | 45 #error "Unknown architecture." |
42 #endif | 46 #endif |
43 | 47 |
44 namespace v8 { | 48 namespace v8 { |
45 namespace internal { | 49 namespace internal { |
46 | 50 |
47 | 51 |
48 void LOperand::PrintTo(StringStream* stream) { | 52 void LOperand::PrintTo(StringStream* stream) { |
49 LUnallocated* unalloc = NULL; | 53 LUnallocated* unalloc = NULL; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return HConstant::cast(graph_->LookupValue(operand->index())); | 383 return HConstant::cast(graph_->LookupValue(operand->index())); |
380 } | 384 } |
381 | 385 |
382 | 386 |
383 Representation LChunkBase::LookupLiteralRepresentation( | 387 Representation LChunkBase::LookupLiteralRepresentation( |
384 LConstantOperand* operand) const { | 388 LConstantOperand* operand) const { |
385 return graph_->LookupValue(operand->index())->representation(); | 389 return graph_->LookupValue(operand->index())->representation(); |
386 } | 390 } |
387 | 391 |
388 | 392 |
| 393 LChunkBase* LChunkBase::NewChunk(HGraph* graph) { |
| 394 int values = graph->GetMaximumValueID(); |
| 395 if (values > LUnallocated::kMaxVirtualRegisters) { |
| 396 if (FLAG_trace_bailout) { |
| 397 PrintF("Not enough virtual registers for (values).\n"); |
| 398 } |
| 399 return NULL; |
| 400 } |
| 401 LAllocator allocator(values, graph); |
| 402 LChunkBuilder builder(graph->info(), graph, &allocator); |
| 403 LChunkBase* chunk = builder.Build(); |
| 404 if (chunk == NULL) return NULL; |
| 405 |
| 406 if (!allocator.Allocate(chunk)) { |
| 407 if (FLAG_trace_bailout) { |
| 408 PrintF("Not enough virtual registers (regalloc).\n"); |
| 409 } |
| 410 return NULL; |
| 411 } |
| 412 |
| 413 return chunk; |
| 414 } |
| 415 |
| 416 |
| 417 Handle<Code> LChunkBase::Codegen() { |
| 418 MacroAssembler assembler(info()->isolate(), NULL, 0); |
| 419 LCodeGen generator(this, &assembler, info()); |
| 420 |
| 421 MarkEmptyBlocks(); |
| 422 |
| 423 if (generator.GenerateCode()) { |
| 424 if (FLAG_trace_codegen) { |
| 425 PrintF("Crankshaft Compiler - "); |
| 426 } |
| 427 CodeGenerator::MakeCodePrologue(info()); |
| 428 Code::Flags flags = Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); |
| 429 Handle<Code> code = |
| 430 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); |
| 431 generator.FinishCode(code); |
| 432 CodeGenerator::PrintCode(code, info()); |
| 433 return code; |
| 434 } |
| 435 return Handle<Code>::null(); |
| 436 } |
| 437 |
| 438 |
389 } } // namespace v8::internal | 439 } } // namespace v8::internal |
OLD | NEW |