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