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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 values_(16), | 680 values_(16), |
681 phi_list_(NULL) { | 681 phi_list_(NULL) { |
682 start_environment_ = | 682 start_environment_ = |
683 new(zone()) HEnvironment(NULL, info->scope(), info->closure()); | 683 new(zone()) HEnvironment(NULL, info->scope(), info->closure()); |
684 start_environment_->set_ast_id(AstNode::kFunctionEntryId); | 684 start_environment_->set_ast_id(AstNode::kFunctionEntryId); |
685 entry_block_ = CreateBasicBlock(); | 685 entry_block_ = CreateBasicBlock(); |
686 entry_block_->SetInitialEnvironment(start_environment_); | 686 entry_block_->SetInitialEnvironment(start_environment_); |
687 } | 687 } |
688 | 688 |
689 | 689 |
690 Handle<Code> HGraph::Compile(CompilationInfo* info) { | 690 Handle<Code> HGraph::Compile(CompilationInfo* info, Zone* zone) { |
691 int values = GetMaximumValueID(); | 691 int values = GetMaximumValueID(); |
692 if (values > LUnallocated::kMaxVirtualRegisters) { | 692 if (values > LUnallocated::kMaxVirtualRegisters) { |
693 if (FLAG_trace_bailout) { | 693 if (FLAG_trace_bailout) { |
694 PrintF("Not enough virtual registers for (values).\n"); | 694 PrintF("Not enough virtual registers for (values).\n"); |
695 } | 695 } |
696 return Handle<Code>::null(); | 696 return Handle<Code>::null(); |
697 } | 697 } |
698 LAllocator allocator(values, this); | 698 LAllocator allocator(values, this); |
699 LChunkBuilder builder(info, this, &allocator); | 699 LChunkBuilder builder(info, this, &allocator); |
700 LChunk* chunk = builder.Build(); | 700 LChunk* chunk = builder.Build(); |
701 if (chunk == NULL) return Handle<Code>::null(); | 701 if (chunk == NULL) return Handle<Code>::null(); |
702 | 702 |
703 if (!allocator.Allocate(chunk)) { | 703 if (!allocator.Allocate(chunk)) { |
704 if (FLAG_trace_bailout) { | 704 if (FLAG_trace_bailout) { |
705 PrintF("Not enough virtual registers (regalloc).\n"); | 705 PrintF("Not enough virtual registers (regalloc).\n"); |
706 } | 706 } |
707 return Handle<Code>::null(); | 707 return Handle<Code>::null(); |
708 } | 708 } |
709 | 709 |
710 MacroAssembler assembler(info->isolate(), NULL, 0); | 710 MacroAssembler assembler(info->isolate(), NULL, 0); |
711 LCodeGen generator(chunk, &assembler, info); | 711 LCodeGen generator(chunk, &assembler, info, zone); |
712 | 712 |
713 chunk->MarkEmptyBlocks(); | 713 chunk->MarkEmptyBlocks(); |
714 | 714 |
715 if (generator.GenerateCode()) { | 715 if (generator.GenerateCode()) { |
716 if (FLAG_trace_codegen) { | 716 if (FLAG_trace_codegen) { |
717 PrintF("Crankshaft Compiler - "); | 717 PrintF("Crankshaft Compiler - "); |
718 } | 718 } |
719 CodeGenerator::MakeCodePrologue(info); | 719 CodeGenerator::MakeCodePrologue(info); |
720 Code::Flags flags = Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); | 720 Code::Flags flags = Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); |
721 Handle<Code> code = | 721 Handle<Code> code = |
(...skipping 8272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8994 } | 8994 } |
8995 } | 8995 } |
8996 | 8996 |
8997 #ifdef DEBUG | 8997 #ifdef DEBUG |
8998 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 8998 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
8999 if (allocator_ != NULL) allocator_->Verify(); | 8999 if (allocator_ != NULL) allocator_->Verify(); |
9000 #endif | 9000 #endif |
9001 } | 9001 } |
9002 | 9002 |
9003 } } // namespace v8::internal | 9003 } } // namespace v8::internal |
OLD | NEW |