| 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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 | 1704 |
| 1705 class HGlobalValueNumberer BASE_EMBEDDED { | 1705 class HGlobalValueNumberer BASE_EMBEDDED { |
| 1706 public: | 1706 public: |
| 1707 explicit HGlobalValueNumberer(HGraph* graph, CompilationInfo* info) | 1707 explicit HGlobalValueNumberer(HGraph* graph, CompilationInfo* info) |
| 1708 : graph_(graph), | 1708 : graph_(graph), |
| 1709 info_(info), | 1709 info_(info), |
| 1710 removed_side_effects_(false), | 1710 removed_side_effects_(false), |
| 1711 block_side_effects_(graph->blocks()->length(), graph->zone()), | 1711 block_side_effects_(graph->blocks()->length(), graph->zone()), |
| 1712 loop_side_effects_(graph->blocks()->length(), graph->zone()), | 1712 loop_side_effects_(graph->blocks()->length(), graph->zone()), |
| 1713 visited_on_paths_(graph->zone(), graph->blocks()->length()) { | 1713 visited_on_paths_(graph->zone(), graph->blocks()->length()) { |
| 1714 ASSERT(!info->isolate()->heap()->IsAllocationAllowed()); | |
| 1715 block_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length(), | 1714 block_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length(), |
| 1716 graph_->zone()); | 1715 graph_->zone()); |
| 1717 loop_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length(), | 1716 loop_side_effects_.AddBlock(GVNFlagSet(), graph_->blocks()->length(), |
| 1718 graph_->zone()); | 1717 graph_->zone()); |
| 1719 } | 1718 } |
| 1720 | 1719 |
| 1721 // Returns true if values with side effects are removed. | 1720 // Returns true if values with side effects are removed. |
| 1722 bool Analyze(); | 1721 bool Analyze(); |
| 1723 | 1722 |
| 1724 private: | 1723 private: |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 } | 3010 } |
| 3012 } | 3011 } |
| 3013 | 3012 |
| 3014 | 3013 |
| 3015 HGraph* HGraphBuilder::CreateGraph() { | 3014 HGraph* HGraphBuilder::CreateGraph() { |
| 3016 graph_ = new(zone()) HGraph(info()); | 3015 graph_ = new(zone()) HGraph(info()); |
| 3017 if (FLAG_hydrogen_stats) HStatistics::Instance()->Initialize(info()); | 3016 if (FLAG_hydrogen_stats) HStatistics::Instance()->Initialize(info()); |
| 3018 | 3017 |
| 3019 { | 3018 { |
| 3020 HPhase phase("H_Block building"); | 3019 HPhase phase("H_Block building"); |
| 3021 CompilationHandleScope handle_scope(info()); | |
| 3022 current_block_ = graph()->entry_block(); | 3020 current_block_ = graph()->entry_block(); |
| 3023 | 3021 |
| 3024 Scope* scope = info()->scope(); | 3022 Scope* scope = info()->scope(); |
| 3025 if (scope->HasIllegalRedeclaration()) { | 3023 if (scope->HasIllegalRedeclaration()) { |
| 3026 Bailout("function with illegal redeclaration"); | 3024 Bailout("function with illegal redeclaration"); |
| 3027 return NULL; | 3025 return NULL; |
| 3028 } | 3026 } |
| 3029 if (scope->calls_eval()) { | 3027 if (scope->calls_eval()) { |
| 3030 Bailout("function calls eval"); | 3028 Bailout("function calls eval"); |
| 3031 return NULL; | 3029 return NULL; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); | 3070 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); |
| 3073 current_block()->FinishExit(instr); | 3071 current_block()->FinishExit(instr); |
| 3074 set_current_block(NULL); | 3072 set_current_block(NULL); |
| 3075 } | 3073 } |
| 3076 } | 3074 } |
| 3077 | 3075 |
| 3078 return graph(); | 3076 return graph(); |
| 3079 } | 3077 } |
| 3080 | 3078 |
| 3081 bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { | 3079 bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { |
| 3082 NoHandleAllocation no_handles; | |
| 3083 AssertNoAllocation no_gc; | |
| 3084 | |
| 3085 *bailout_reason = SmartArrayPointer<char>(); | 3080 *bailout_reason = SmartArrayPointer<char>(); |
| 3086 OrderBlocks(); | 3081 OrderBlocks(); |
| 3087 AssignDominators(); | 3082 AssignDominators(); |
| 3088 | 3083 |
| 3089 #ifdef DEBUG | 3084 #ifdef DEBUG |
| 3090 // Do a full verify after building the graph and computing dominators. | 3085 // Do a full verify after building the graph and computing dominators. |
| 3091 Verify(true); | 3086 Verify(true); |
| 3092 #endif | 3087 #endif |
| 3093 | 3088 |
| 3094 PropagateDeoptimizingMark(); | 3089 PropagateDeoptimizingMark(); |
| (...skipping 6478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9573 } | 9568 } |
| 9574 } | 9569 } |
| 9575 | 9570 |
| 9576 #ifdef DEBUG | 9571 #ifdef DEBUG |
| 9577 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9572 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 9578 if (allocator_ != NULL) allocator_->Verify(); | 9573 if (allocator_ != NULL) allocator_->Verify(); |
| 9579 #endif | 9574 #endif |
| 9580 } | 9575 } |
| 9581 | 9576 |
| 9582 } } // namespace v8::internal | 9577 } } // namespace v8::internal |
| OLD | NEW |