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