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