| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 UNREACHABLE(); | 295 UNREACHABLE(); |
| 296 return -1; | 296 return -1; |
| 297 } | 297 } |
| 298 | 298 |
| 299 | 299 |
| 300 #ifdef DEBUG | 300 #ifdef DEBUG |
| 301 void HBasicBlock::Verify() { | 301 void HBasicBlock::Verify() { |
| 302 // Check that every block is finished. | 302 // Check that every block is finished. |
| 303 ASSERT(IsFinished()); | 303 ASSERT(IsFinished()); |
| 304 ASSERT(block_id() >= 0); | 304 ASSERT(block_id() >= 0); |
| 305 |
| 306 // Check that the incoming edges are in edge split form. |
| 307 if (predecessors_.length() > 1) { |
| 308 for (int i = 0; i < predecessors_.length(); ++i) { |
| 309 ASSERT(predecessors_[i]->end()->SecondSuccessor() == NULL); |
| 310 } |
| 311 } |
| 305 } | 312 } |
| 306 #endif | 313 #endif |
| 307 | 314 |
| 308 | 315 |
| 309 void HLoopInformation::RegisterBackEdge(HBasicBlock* block) { | 316 void HLoopInformation::RegisterBackEdge(HBasicBlock* block) { |
| 310 this->back_edges_.Add(block); | 317 this->back_edges_.Add(block); |
| 311 AddBlock(block); | 318 AddBlock(block); |
| 312 } | 319 } |
| 313 | 320 |
| 314 | 321 |
| (...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 } | 2827 } |
| 2821 | 2828 |
| 2822 | 2829 |
| 2823 void HGraphBuilder::VisitConditional(Conditional* expr) { | 2830 void HGraphBuilder::VisitConditional(Conditional* expr) { |
| 2824 HBasicBlock* cond_true = graph()->CreateBasicBlock(); | 2831 HBasicBlock* cond_true = graph()->CreateBasicBlock(); |
| 2825 HBasicBlock* cond_false = graph()->CreateBasicBlock(); | 2832 HBasicBlock* cond_false = graph()->CreateBasicBlock(); |
| 2826 VISIT_FOR_CONTROL(expr->condition(), cond_true, cond_false); | 2833 VISIT_FOR_CONTROL(expr->condition(), cond_true, cond_false); |
| 2827 cond_true->SetJoinId(expr->ThenId()); | 2834 cond_true->SetJoinId(expr->ThenId()); |
| 2828 cond_false->SetJoinId(expr->ElseId()); | 2835 cond_false->SetJoinId(expr->ElseId()); |
| 2829 | 2836 |
| 2830 // TOOD(kmillikin): Visit the subexpressions in the same AST context as | 2837 // Visit the true and false subexpressions in the same AST context as the |
| 2831 // the whole expression. | 2838 // whole expression. |
| 2832 set_current_block(cond_true); | 2839 set_current_block(cond_true); |
| 2833 VISIT_FOR_VALUE(expr->then_expression()); | 2840 Visit(expr->then_expression()); |
| 2841 CHECK_BAILOUT; |
| 2834 HBasicBlock* other = current_block(); | 2842 HBasicBlock* other = current_block(); |
| 2835 | 2843 |
| 2836 set_current_block(cond_false); | 2844 set_current_block(cond_false); |
| 2837 VISIT_FOR_VALUE(expr->else_expression()); | 2845 Visit(expr->else_expression()); |
| 2846 CHECK_BAILOUT; |
| 2838 | 2847 |
| 2839 HBasicBlock* join = CreateJoin(other, current_block(), expr->id()); | 2848 if (!ast_context()->IsTest()) { |
| 2840 set_current_block(join); | 2849 HBasicBlock* join = CreateJoin(other, current_block(), expr->id()); |
| 2841 ast_context()->ReturnValue(Pop()); | 2850 set_current_block(join); |
| 2851 if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop()); |
| 2852 } |
| 2842 } | 2853 } |
| 2843 | 2854 |
| 2844 | 2855 |
| 2845 void HGraphBuilder::LookupGlobalPropertyCell(Variable* var, | 2856 void HGraphBuilder::LookupGlobalPropertyCell(Variable* var, |
| 2846 LookupResult* lookup, | 2857 LookupResult* lookup, |
| 2847 bool is_store) { | 2858 bool is_store) { |
| 2848 if (var->is_this()) { | 2859 if (var->is_this()) { |
| 2849 BAILOUT("global this reference"); | 2860 BAILOUT("global this reference"); |
| 2850 } | 2861 } |
| 2851 if (!info()->has_global_object()) { | 2862 if (!info()->has_global_object()) { |
| (...skipping 3087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5939 } | 5950 } |
| 5940 } | 5951 } |
| 5941 | 5952 |
| 5942 #ifdef DEBUG | 5953 #ifdef DEBUG |
| 5943 if (graph_ != NULL) graph_->Verify(); | 5954 if (graph_ != NULL) graph_->Verify(); |
| 5944 if (allocator_ != NULL) allocator_->Verify(); | 5955 if (allocator_ != NULL) allocator_->Verify(); |
| 5945 #endif | 5956 #endif |
| 5946 } | 5957 } |
| 5947 | 5958 |
| 5948 } } // namespace v8::internal | 5959 } } // namespace v8::internal |
| OLD | NEW |