 Chromium Code Reviews
 Chromium Code Reviews Issue 10700115:
  Break Crankshaft into phases.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 10700115:
  Break Crankshaft into phases.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| 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 | 
| 11 // with the distribution. | 11 // with the distribution. | 
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its | 
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived | 
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. | 
| 15 // | 15 // | 
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
| 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 "lithium-allocator.h" | |
| 31 #include "lithium-allocator-inl.h" | |
| 32 | |
| 33 #if V8_TARGET_ARCH_IA32 | |
| 34 #include "ia32/lithium-codegen-ia32.h" | |
| 35 #elif V8_TARGET_ARCH_X64 | |
| 36 #include "x64/lithium-codegen-x64.h" | |
| 37 #elif V8_TARGET_ARCH_ARM | |
| 38 #include "arm/lithium-codegen-arm.h" | |
| 39 #elif V8_TARGET_ARCH_MIPS | |
| 40 #include "mips/lithium-codegen-mips.h" | |
| 41 #else | |
| 42 #error Unsupported target architecture. | |
| 43 #endif | |
| 30 | 44 | 
| 31 namespace v8 { | 45 namespace v8 { | 
| 32 namespace internal { | 46 namespace internal { | 
| 33 | 47 | 
| 34 | 48 | 
| 35 void LOperand::PrintTo(StringStream* stream) { | 49 void LOperand::PrintTo(StringStream* stream) { | 
| 36 LUnallocated* unalloc = NULL; | 50 LUnallocated* unalloc = NULL; | 
| 37 switch (kind()) { | 51 switch (kind()) { | 
| 38 case INVALID: | 52 case INVALID: | 
| 39 stream->Add("(0)"); | 53 stream->Add("(0)"); | 
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 case FAST_HOLEY_ELEMENTS: | 247 case FAST_HOLEY_ELEMENTS: | 
| 234 case DICTIONARY_ELEMENTS: | 248 case DICTIONARY_ELEMENTS: | 
| 235 case NON_STRICT_ARGUMENTS_ELEMENTS: | 249 case NON_STRICT_ARGUMENTS_ELEMENTS: | 
| 236 return kPointerSizeLog2; | 250 return kPointerSizeLog2; | 
| 237 } | 251 } | 
| 238 UNREACHABLE(); | 252 UNREACHABLE(); | 
| 239 return 0; | 253 return 0; | 
| 240 } | 254 } | 
| 241 | 255 | 
| 242 | 256 | 
| 257 LChunk* Lithium::CreateChunk(HGraph* graph, HGraphBuilder* graph_builder) { | |
| 
danno
2012/07/11 10:04:57
Again, adding a dependency on graph builder here i
 | |
| 258 int values = graph->GetMaximumValueID(); | |
| 259 if (values > LUnallocated::kMaxVirtualRegisters) { | |
| 260 graph_builder->Bailout("Not enough virtual registers for (values).\n"); | |
| 261 return NULL; | |
| 262 } | |
| 263 LAllocator allocator(values, graph); | |
| 264 LChunkBuilder builder(graph->info(), graph, &allocator); | |
| 265 LChunk* chunk = builder.Build(); | |
| 266 if (chunk == NULL) return NULL; | |
| 267 | |
| 268 if (!allocator.Allocate(chunk)) { | |
| 269 graph_builder->Bailout("Not enough virtual registers (regalloc).\n"); | |
| 270 return NULL; | |
| 271 } | |
| 272 | |
| 273 return chunk; | |
| 274 } | |
| 275 | |
| 276 | |
| 277 Handle<Code> Lithium::Codegen(LChunk* chunk) { | |
| 278 MacroAssembler assembler(chunk->info()->isolate(), NULL, 0); | |
| 279 LCodeGen generator(chunk, &assembler, chunk->info()); | |
| 280 | |
| 281 chunk->MarkEmptyBlocks(); | |
| 282 | |
| 283 if (generator.GenerateCode()) { | |
| 284 if (FLAG_trace_codegen) { | |
| 285 PrintF("Crankshaft Compiler - "); | |
| 286 } | |
| 287 CodeGenerator::MakeCodePrologue(chunk->info()); | |
| 288 Code::Flags flags = Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); | |
| 289 Handle<Code> code = | |
| 290 CodeGenerator::MakeCodeEpilogue(&assembler, flags, chunk->info()); | |
| 291 generator.FinishCode(code); | |
| 292 CodeGenerator::PrintCode(code, chunk->info()); | |
| 293 return code; | |
| 294 } | |
| 295 return Handle<Code>::null(); | |
| 296 } | |
| 297 | |
| 298 | |
| 243 } } // namespace v8::internal | 299 } } // namespace v8::internal | 
| OLD | NEW |