| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 dominator_(NULL), | 64 dominator_(NULL), |
| 65 dominated_blocks_(4, graph->zone()), | 65 dominated_blocks_(4, graph->zone()), |
| 66 last_environment_(NULL), | 66 last_environment_(NULL), |
| 67 argument_count_(-1), | 67 argument_count_(-1), |
| 68 first_instruction_index_(-1), | 68 first_instruction_index_(-1), |
| 69 last_instruction_index_(-1), | 69 last_instruction_index_(-1), |
| 70 deleted_phis_(4, graph->zone()), | 70 deleted_phis_(4, graph->zone()), |
| 71 parent_loop_header_(NULL), | 71 parent_loop_header_(NULL), |
| 72 is_inline_return_target_(false), | 72 is_inline_return_target_(false), |
| 73 is_deoptimizing_(false), | 73 is_deoptimizing_(false), |
| 74 dominates_loop_successors_(false) { } | 74 dominates_loop_successors_(false), |
| 75 is_osr_entry_(false) { } |
| 75 | 76 |
| 76 | 77 |
| 77 void HBasicBlock::AttachLoopInformation() { | 78 void HBasicBlock::AttachLoopInformation() { |
| 78 ASSERT(!IsLoopHeader()); | 79 ASSERT(!IsLoopHeader()); |
| 79 loop_information_ = new(zone()) HLoopInformation(this, zone()); | 80 loop_information_ = new(zone()) HLoopInformation(this, zone()); |
| 80 } | 81 } |
| 81 | 82 |
| 82 | 83 |
| 83 void HBasicBlock::DetachLoopInformation() { | 84 void HBasicBlock::DetachLoopInformation() { |
| 84 ASSERT(IsLoopHeader()); | 85 ASSERT(IsLoopHeader()); |
| (...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3786 } | 3787 } |
| 3787 } | 3788 } |
| 3788 } | 3789 } |
| 3789 | 3790 |
| 3790 | 3791 |
| 3791 bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { | 3792 bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { |
| 3792 *bailout_reason = SmartArrayPointer<char>(); | 3793 *bailout_reason = SmartArrayPointer<char>(); |
| 3793 OrderBlocks(); | 3794 OrderBlocks(); |
| 3794 AssignDominators(); | 3795 AssignDominators(); |
| 3795 | 3796 |
| 3797 // We need to create a HConstant "zero" now so that GVN will fold every |
| 3798 // zero-valued constant in the graph together. |
| 3799 // The constant is needed to make idef-based bounds check work: the pass |
| 3800 // evaluates relations with "zero" and that zero cannot be created after GVN. |
| 3801 GetConstant0(); |
| 3802 |
| 3796 #ifdef DEBUG | 3803 #ifdef DEBUG |
| 3797 // Do a full verify after building the graph and computing dominators. | 3804 // Do a full verify after building the graph and computing dominators. |
| 3798 Verify(true); | 3805 Verify(true); |
| 3799 #endif | 3806 #endif |
| 3800 | 3807 |
| 3801 PropagateDeoptimizingMark(); | 3808 PropagateDeoptimizingMark(); |
| 3802 if (!CheckConstPhiUses()) { | 3809 if (!CheckConstPhiUses()) { |
| 3803 *bailout_reason = SmartArrayPointer<char>(StrDup( | 3810 *bailout_reason = SmartArrayPointer<char>(StrDup( |
| 3804 "Unsupported phi use of const variable")); | 3811 "Unsupported phi use of const variable")); |
| 3805 return false; | 3812 return false; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3863 RestoreActualValues(); | 3870 RestoreActualValues(); |
| 3864 | 3871 |
| 3865 return true; | 3872 return true; |
| 3866 } | 3873 } |
| 3867 | 3874 |
| 3868 | 3875 |
| 3869 void HGraph::SetupInformativeDefinitionsInBlock(HBasicBlock* block) { | 3876 void HGraph::SetupInformativeDefinitionsInBlock(HBasicBlock* block) { |
| 3870 for (int phi_index = 0; phi_index < block->phis()->length(); phi_index++) { | 3877 for (int phi_index = 0; phi_index < block->phis()->length(); phi_index++) { |
| 3871 HPhi* phi = block->phis()->at(phi_index); | 3878 HPhi* phi = block->phis()->at(phi_index); |
| 3872 phi->AddInformativeDefinitions(); | 3879 phi->AddInformativeDefinitions(); |
| 3880 phi->SetFlag(HValue::kIDefsProcessingDone); |
| 3873 // We do not support phis that "redefine just one operand". | 3881 // We do not support phis that "redefine just one operand". |
| 3874 ASSERT(!phi->IsInformativeDefinition()); | 3882 ASSERT(!phi->IsInformativeDefinition()); |
| 3875 } | 3883 } |
| 3876 | 3884 |
| 3877 for (HInstruction* i = block->first(); i != NULL; i = i->next()) { | 3885 for (HInstruction* i = block->first(); i != NULL; i = i->next()) { |
| 3878 i->AddInformativeDefinitions(); | 3886 i->AddInformativeDefinitions(); |
| 3887 i->SetFlag(HValue::kIDefsProcessingDone); |
| 3879 i->UpdateRedefinedUsesWhileSettingUpInformativeDefinitions(); | 3888 i->UpdateRedefinedUsesWhileSettingUpInformativeDefinitions(); |
| 3880 } | 3889 } |
| 3881 } | 3890 } |
| 3882 | 3891 |
| 3883 | 3892 |
| 3884 // This method is recursive, so if its stack frame is large it could | 3893 // This method is recursive, so if its stack frame is large it could |
| 3885 // cause a stack overflow. | 3894 // cause a stack overflow. |
| 3886 // To keep the individual stack frames small we do the actual work inside | 3895 // To keep the individual stack frames small we do the actual work inside |
| 3887 // SetupInformativeDefinitionsInBlock(); | 3896 // SetupInformativeDefinitionsInBlock(); |
| 3888 void HGraph::SetupInformativeDefinitionsRecursively(HBasicBlock* block) { | 3897 void HGraph::SetupInformativeDefinitionsRecursively(HBasicBlock* block) { |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4889 HBasicBlock* non_osr_entry = graph()->CreateBasicBlock(); | 4898 HBasicBlock* non_osr_entry = graph()->CreateBasicBlock(); |
| 4890 HBasicBlock* osr_entry = graph()->CreateBasicBlock(); | 4899 HBasicBlock* osr_entry = graph()->CreateBasicBlock(); |
| 4891 HValue* true_value = graph()->GetConstantTrue(); | 4900 HValue* true_value = graph()->GetConstantTrue(); |
| 4892 HBranch* test = new(zone()) HBranch(true_value, non_osr_entry, osr_entry); | 4901 HBranch* test = new(zone()) HBranch(true_value, non_osr_entry, osr_entry); |
| 4893 current_block()->Finish(test); | 4902 current_block()->Finish(test); |
| 4894 | 4903 |
| 4895 HBasicBlock* loop_predecessor = graph()->CreateBasicBlock(); | 4904 HBasicBlock* loop_predecessor = graph()->CreateBasicBlock(); |
| 4896 non_osr_entry->Goto(loop_predecessor); | 4905 non_osr_entry->Goto(loop_predecessor); |
| 4897 | 4906 |
| 4898 set_current_block(osr_entry); | 4907 set_current_block(osr_entry); |
| 4908 osr_entry->set_osr_entry(); |
| 4899 BailoutId osr_entry_id = statement->OsrEntryId(); | 4909 BailoutId osr_entry_id = statement->OsrEntryId(); |
| 4900 int first_expression_index = environment()->first_expression_index(); | 4910 int first_expression_index = environment()->first_expression_index(); |
| 4901 int length = environment()->length(); | 4911 int length = environment()->length(); |
| 4902 ZoneList<HUnknownOSRValue*>* osr_values = | 4912 ZoneList<HUnknownOSRValue*>* osr_values = |
| 4903 new(zone()) ZoneList<HUnknownOSRValue*>(length, zone()); | 4913 new(zone()) ZoneList<HUnknownOSRValue*>(length, zone()); |
| 4904 | 4914 |
| 4905 for (int i = 0; i < first_expression_index; ++i) { | 4915 for (int i = 0; i < first_expression_index; ++i) { |
| 4906 HUnknownOSRValue* osr_value = new(zone()) HUnknownOSRValue; | 4916 HUnknownOSRValue* osr_value = new(zone()) HUnknownOSRValue; |
| 4907 AddInstruction(osr_value); | 4917 AddInstruction(osr_value); |
| 4908 environment()->Bind(i, osr_value); | 4918 environment()->Bind(i, osr_value); |
| (...skipping 5721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10630 } | 10640 } |
| 10631 } | 10641 } |
| 10632 | 10642 |
| 10633 #ifdef DEBUG | 10643 #ifdef DEBUG |
| 10634 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10644 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 10635 if (allocator_ != NULL) allocator_->Verify(); | 10645 if (allocator_ != NULL) allocator_->Verify(); |
| 10636 #endif | 10646 #endif |
| 10637 } | 10647 } |
| 10638 | 10648 |
| 10639 } } // namespace v8::internal | 10649 } } // namespace v8::internal |
| OLD | NEW |