OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) { | 462 LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) { |
463 return LConstantOperand::Create(constant->id()); | 463 return LConstantOperand::Create(constant->id()); |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 int LChunk::GetParameterStackSlot(int index) const { | 467 int LChunk::GetParameterStackSlot(int index) const { |
468 // The receiver is at index 0, the first parameter at index 1, so we | 468 // The receiver is at index 0, the first parameter at index 1, so we |
469 // shift all parameter indexes down by the number of parameters, and | 469 // shift all parameter indexes down by the number of parameters, and |
470 // make sure they end up negative so they are distinguishable from | 470 // make sure they end up negative so they are distinguishable from |
471 // spill slots. | 471 // spill slots. |
472 int result = index - graph()->info()->scope()->num_parameters() - 1; | 472 int result = index - info()->scope()->num_parameters() - 1; |
473 ASSERT(result < 0); | 473 ASSERT(result < 0); |
474 return result; | 474 return result; |
475 } | 475 } |
476 | 476 |
477 // A parameter relative to ebp in the arguments stub. | 477 // A parameter relative to ebp in the arguments stub. |
478 int LChunk::ParameterAt(int index) { | 478 int LChunk::ParameterAt(int index) { |
479 ASSERT(-1 <= index); // -1 is the receiver. | 479 ASSERT(-1 <= index); // -1 is the receiver. |
480 return (1 + graph()->info()->scope()->num_parameters() - index) * | 480 return (1 + info()->scope()->num_parameters() - index) * |
481 kPointerSize; | 481 kPointerSize; |
482 } | 482 } |
483 | 483 |
484 | 484 |
485 LGap* LChunk::GetGapAt(int index) const { | 485 LGap* LChunk::GetGapAt(int index) const { |
486 return LGap::cast(instructions_[index]); | 486 return LGap::cast(instructions_[index]); |
487 } | 487 } |
488 | 488 |
489 | 489 |
490 bool LChunk::IsGapAt(int index) const { | 490 bool LChunk::IsGapAt(int index) const { |
(...skipping 18 matching lines...) Expand all Loading... |
509 | 509 |
510 | 510 |
511 Representation LChunk::LookupLiteralRepresentation( | 511 Representation LChunk::LookupLiteralRepresentation( |
512 LConstantOperand* operand) const { | 512 LConstantOperand* operand) const { |
513 return graph_->LookupValue(operand->index())->representation(); | 513 return graph_->LookupValue(operand->index())->representation(); |
514 } | 514 } |
515 | 515 |
516 | 516 |
517 LChunk* LChunkBuilder::Build() { | 517 LChunk* LChunkBuilder::Build() { |
518 ASSERT(is_unused()); | 518 ASSERT(is_unused()); |
519 chunk_ = new LChunk(graph()); | 519 chunk_ = new LChunk(info(), graph()); |
520 HPhase phase("Building chunk", chunk_); | 520 HPhase phase("Building chunk", chunk_); |
521 status_ = BUILDING; | 521 status_ = BUILDING; |
522 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); | 522 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); |
523 for (int i = 0; i < blocks->length(); i++) { | 523 for (int i = 0; i < blocks->length(); i++) { |
524 HBasicBlock* next = NULL; | 524 HBasicBlock* next = NULL; |
525 if (i < blocks->length() - 1) next = blocks->at(i + 1); | 525 if (i < blocks->length() - 1) next = blocks->at(i + 1); |
526 DoBasicBlock(blocks->at(i), next); | 526 DoBasicBlock(blocks->at(i), next); |
527 if (is_aborted()) return NULL; | 527 if (is_aborted()) return NULL; |
528 } | 528 } |
529 status_ = DONE; | 529 status_ = DONE; |
530 return chunk_; | 530 return chunk_; |
531 } | 531 } |
532 | 532 |
533 | 533 |
534 void LChunkBuilder::Abort(const char* format, ...) { | 534 void LChunkBuilder::Abort(const char* format, ...) { |
535 if (FLAG_trace_bailout) { | 535 if (FLAG_trace_bailout) { |
536 SmartPointer<char> debug_name = graph()->debug_name()->ToCString(); | 536 SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString()); |
537 PrintF("Aborting LChunk building in @\"%s\": ", *debug_name); | 537 PrintF("Aborting LChunk building in @\"%s\": ", *name); |
538 va_list arguments; | 538 va_list arguments; |
539 va_start(arguments, format); | 539 va_start(arguments, format); |
540 OS::VPrint(format, arguments); | 540 OS::VPrint(format, arguments); |
541 va_end(arguments); | 541 va_end(arguments); |
542 PrintF("\n"); | 542 PrintF("\n"); |
543 } | 543 } |
544 status_ = ABORTED; | 544 status_ = ABORTED; |
545 } | 545 } |
546 | 546 |
547 | 547 |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2081 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2082 HEnvironment* outer = current_block_->last_environment()->outer(); | 2082 HEnvironment* outer = current_block_->last_environment()->outer(); |
2083 current_block_->UpdateEnvironment(outer); | 2083 current_block_->UpdateEnvironment(outer); |
2084 return NULL; | 2084 return NULL; |
2085 } | 2085 } |
2086 | 2086 |
2087 | 2087 |
2088 } } // namespace v8::internal | 2088 } } // namespace v8::internal |
2089 | 2089 |
2090 #endif // V8_TARGET_ARCH_IA32 | 2090 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |