| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 ASSERT(predecessors()->length() > 0); | 300 ASSERT(predecessors()->length() > 0); |
| 301 for (int i = 1; i < predecessors()->length(); i++) { | 301 for (int i = 1; i < predecessors()->length(); i++) { |
| 302 HBasicBlock* pred = predecessors()->at(i); | 302 HBasicBlock* pred = predecessors()->at(i); |
| 303 HValue* top = pred->last_environment()->Top(); | 303 HValue* top = pred->last_environment()->Top(); |
| 304 ASSERT(top->IsConstant()); | 304 ASSERT(top->IsConstant()); |
| 305 Object* a = *HConstant::cast(top)->handle(); | 305 Object* a = *HConstant::cast(top)->handle(); |
| 306 Object* b = *cond(); | 306 Object* b = *cond(); |
| 307 ASSERT(a == b); | 307 ASSERT(a == b); |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 |
| 311 // Check that the incoming edges are in edge split form. |
| 312 if (predecessors_.length() > 1) { |
| 313 for (int i = 0; i < predecessors_.length(); ++i) { |
| 314 ASSERT(predecessors_[i]->end()->SecondSuccessor() == NULL); |
| 315 } |
| 316 } |
| 310 } | 317 } |
| 311 #endif | 318 #endif |
| 312 | 319 |
| 313 | 320 |
| 314 void HLoopInformation::RegisterBackEdge(HBasicBlock* block) { | 321 void HLoopInformation::RegisterBackEdge(HBasicBlock* block) { |
| 315 this->back_edges_.Add(block); | 322 this->back_edges_.Add(block); |
| 316 AddBlock(block); | 323 AddBlock(block); |
| 317 } | 324 } |
| 318 | 325 |
| 319 | 326 |
| (...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2893 } | 2900 } |
| 2894 | 2901 |
| 2895 | 2902 |
| 2896 void HGraphBuilder::VisitConditional(Conditional* expr) { | 2903 void HGraphBuilder::VisitConditional(Conditional* expr) { |
| 2897 HSubgraph* then_graph = CreateEmptySubgraph(); | 2904 HSubgraph* then_graph = CreateEmptySubgraph(); |
| 2898 HSubgraph* else_graph = CreateEmptySubgraph(); | 2905 HSubgraph* else_graph = CreateEmptySubgraph(); |
| 2899 VISIT_FOR_CONTROL(expr->condition(), | 2906 VISIT_FOR_CONTROL(expr->condition(), |
| 2900 then_graph->entry_block(), | 2907 then_graph->entry_block(), |
| 2901 else_graph->entry_block()); | 2908 else_graph->entry_block()); |
| 2902 | 2909 |
| 2910 // Visit the true and false subexpressions in the same AST context as the |
| 2911 // whole expression. |
| 2903 then_graph->entry_block()->SetJoinId(expr->ThenId()); | 2912 then_graph->entry_block()->SetJoinId(expr->ThenId()); |
| 2904 ADD_TO_SUBGRAPH(then_graph, expr->then_expression()); | 2913 { SubgraphScope scope(this, then_graph); |
| 2914 Visit(expr->then_expression()); |
| 2915 CHECK_BAILOUT; |
| 2916 } |
| 2905 | 2917 |
| 2906 else_graph->entry_block()->SetJoinId(expr->ElseId()); | 2918 else_graph->entry_block()->SetJoinId(expr->ElseId()); |
| 2907 ADD_TO_SUBGRAPH(else_graph, expr->else_expression()); | 2919 { SubgraphScope scope(this, else_graph); |
| 2920 Visit(expr->else_expression()); |
| 2921 CHECK_BAILOUT; |
| 2922 } |
| 2908 | 2923 |
| 2909 current_subgraph_->AppendJoin(then_graph, else_graph, expr); | 2924 if (!ast_context()->IsTest()) { |
| 2910 ast_context()->ReturnValue(Pop()); | 2925 subgraph()->AppendJoin(then_graph, else_graph, expr); |
| 2926 } |
| 2911 } | 2927 } |
| 2912 | 2928 |
| 2913 | 2929 |
| 2914 void HGraphBuilder::LookupGlobalPropertyCell(Variable* var, | 2930 void HGraphBuilder::LookupGlobalPropertyCell(Variable* var, |
| 2915 LookupResult* lookup, | 2931 LookupResult* lookup, |
| 2916 bool is_store) { | 2932 bool is_store) { |
| 2917 if (var->is_this()) { | 2933 if (var->is_this()) { |
| 2918 BAILOUT("global this reference"); | 2934 BAILOUT("global this reference"); |
| 2919 } | 2935 } |
| 2920 if (!graph()->info()->has_global_object()) { | 2936 if (!graph()->info()->has_global_object()) { |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3735 return false; | 3751 return false; |
| 3736 } | 3752 } |
| 3737 | 3753 |
| 3738 HInstruction* result = NULL; | 3754 HInstruction* result = NULL; |
| 3739 if (expr->key()->IsPropertyName()) { | 3755 if (expr->key()->IsPropertyName()) { |
| 3740 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); | 3756 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); |
| 3741 if (!name->IsEqualTo(CStrVector("length"))) return false; | 3757 if (!name->IsEqualTo(CStrVector("length"))) return false; |
| 3742 HInstruction* elements = AddInstruction(new HArgumentsElements); | 3758 HInstruction* elements = AddInstruction(new HArgumentsElements); |
| 3743 result = new HArgumentsLength(elements); | 3759 result = new HArgumentsLength(elements); |
| 3744 } else { | 3760 } else { |
| 3761 Push(graph()->GetArgumentsObject()); |
| 3745 VisitForValue(expr->key()); | 3762 VisitForValue(expr->key()); |
| 3746 if (HasStackOverflow()) return false; | 3763 if (HasStackOverflow()) return false; |
| 3747 HValue* key = Pop(); | 3764 HValue* key = Pop(); |
| 3765 Drop(1); // Arguments object. |
| 3748 HInstruction* elements = AddInstruction(new HArgumentsElements); | 3766 HInstruction* elements = AddInstruction(new HArgumentsElements); |
| 3749 HInstruction* length = AddInstruction(new HArgumentsLength(elements)); | 3767 HInstruction* length = AddInstruction(new HArgumentsLength(elements)); |
| 3750 AddInstruction(new HBoundsCheck(key, length)); | 3768 AddInstruction(new HBoundsCheck(key, length)); |
| 3751 result = new HAccessArgumentsAt(elements, length, key); | 3769 result = new HAccessArgumentsAt(elements, length, key); |
| 3752 } | 3770 } |
| 3753 ast_context()->ReturnInstruction(result, expr->id()); | 3771 ast_context()->ReturnInstruction(result, expr->id()); |
| 3754 return true; | 3772 return true; |
| 3755 } | 3773 } |
| 3756 | 3774 |
| 3757 | 3775 |
| (...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5929 } | 5947 } |
| 5930 } | 5948 } |
| 5931 | 5949 |
| 5932 #ifdef DEBUG | 5950 #ifdef DEBUG |
| 5933 if (graph_ != NULL) graph_->Verify(); | 5951 if (graph_ != NULL) graph_->Verify(); |
| 5934 if (allocator_ != NULL) allocator_->Verify(); | 5952 if (allocator_ != NULL) allocator_->Verify(); |
| 5935 #endif | 5953 #endif |
| 5936 } | 5954 } |
| 5937 | 5955 |
| 5938 } } // namespace v8::internal | 5956 } } // namespace v8::internal |
| OLD | NEW |