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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 return HConstant::cast(graph_->LookupValue(operand->index())); | 383 return HConstant::cast(graph_->LookupValue(operand->index())); |
384 } | 384 } |
385 | 385 |
386 | 386 |
387 Representation LChunk::LookupLiteralRepresentation( | 387 Representation LChunk::LookupLiteralRepresentation( |
388 LConstantOperand* operand) const { | 388 LConstantOperand* operand) const { |
389 return graph_->LookupValue(operand->index())->representation(); | 389 return graph_->LookupValue(operand->index())->representation(); |
390 } | 390 } |
391 | 391 |
392 | 392 |
393 LChunk* LChunk::NewChunk(HGraph* graph) { | 393 LChunk* LChunk::NewChunk(HGraph* graph, CompilationInfo* info) { |
Jakob Kummerow
2012/08/27 14:26:02
Instead of passing in |info|, can't you just use g
Sven Panne
2012/08/28 07:17:08
Good point, I missed that one after refactoring ba
| |
394 NoHandleAllocation no_handles; | 394 NoHandleAllocation no_handles; |
395 AssertNoAllocation no_gc; | 395 AssertNoAllocation no_gc; |
396 | 396 |
397 int values = graph->GetMaximumValueID(); | 397 int values = graph->GetMaximumValueID(); |
398 if (values > LUnallocated::kMaxVirtualRegisters) { | 398 if (values > LUnallocated::kMaxVirtualRegisters) { |
399 if (FLAG_trace_bailout) { | 399 info->set_bailout_reason("not enough virtual registers for values"); |
400 PrintF("Not enough virtual registers for (values).\n"); | |
401 } | |
402 return NULL; | 400 return NULL; |
403 } | 401 } |
404 LAllocator allocator(values, graph); | 402 LAllocator allocator(values, graph); |
405 LChunkBuilder builder(graph->info(), graph, &allocator); | 403 LChunkBuilder builder(graph->info(), graph, &allocator); |
406 LChunk* chunk = builder.Build(); | 404 LChunk* chunk = builder.Build(); |
407 if (chunk == NULL) return NULL; | 405 if (chunk == NULL) return NULL; |
408 | 406 |
409 if (!allocator.Allocate(chunk)) { | 407 if (!allocator.Allocate(chunk)) { |
410 if (FLAG_trace_bailout) { | 408 info->set_bailout_reason("not enough virtual registers (regalloc)"); |
411 PrintF("Not enough virtual registers (regalloc).\n"); | |
412 } | |
413 return NULL; | 409 return NULL; |
414 } | 410 } |
415 | 411 |
416 return chunk; | 412 return chunk; |
417 } | 413 } |
418 | 414 |
419 | 415 |
420 Handle<Code> LChunk::Codegen() { | 416 Handle<Code> LChunk::Codegen() { |
421 MacroAssembler assembler(info()->isolate(), NULL, 0); | 417 MacroAssembler assembler(info()->isolate(), NULL, 0); |
422 LCodeGen generator(this, &assembler, info()); | 418 LCodeGen generator(this, &assembler, info()); |
(...skipping 10 matching lines...) Expand all Loading... | |
433 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); | 429 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); |
434 generator.FinishCode(code); | 430 generator.FinishCode(code); |
435 CodeGenerator::PrintCode(code, info()); | 431 CodeGenerator::PrintCode(code, info()); |
436 return code; | 432 return code; |
437 } | 433 } |
438 return Handle<Code>::null(); | 434 return Handle<Code>::null(); |
439 } | 435 } |
440 | 436 |
441 | 437 |
442 } } // namespace v8::internal | 438 } } // namespace v8::internal |
OLD | NEW |