Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(954)

Side by Side Diff: src/hydrogen.h

Issue 22876009: Improve and simplify removal of unreachable code (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review feedback Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // LeaveInlined 163 // LeaveInlined
164 // Simulate (caller's environment) 164 // Simulate (caller's environment)
165 // Goto (target block) 165 // Goto (target block)
166 bool IsInlineReturnTarget() const { return is_inline_return_target_; } 166 bool IsInlineReturnTarget() const { return is_inline_return_target_; }
167 void MarkAsInlineReturnTarget(HBasicBlock* inlined_entry_block) { 167 void MarkAsInlineReturnTarget(HBasicBlock* inlined_entry_block) {
168 is_inline_return_target_ = true; 168 is_inline_return_target_ = true;
169 inlined_entry_block_ = inlined_entry_block; 169 inlined_entry_block_ = inlined_entry_block;
170 } 170 }
171 HBasicBlock* inlined_entry_block() { return inlined_entry_block_; } 171 HBasicBlock* inlined_entry_block() { return inlined_entry_block_; }
172 172
173 bool IsDeoptimizing() const { return is_deoptimizing_; } 173 bool IsDeoptimizing() const {
174 void MarkAsDeoptimizing() { is_deoptimizing_ = true; } 174 return end() != NULL && end()->IsDeoptimize();
175 }
176
177 void MarkUnreachable();
178 bool IsUnreachable() const { return !is_reachable_; }
179 bool IsReachable() const { return is_reachable_; }
175 180
176 bool IsLoopSuccessorDominator() const { 181 bool IsLoopSuccessorDominator() const {
177 return dominates_loop_successors_; 182 return dominates_loop_successors_;
178 } 183 }
179 void MarkAsLoopSuccessorDominator() { 184 void MarkAsLoopSuccessorDominator() {
180 dominates_loop_successors_ = true; 185 dominates_loop_successors_ = true;
181 } 186 }
182 187
183 inline Zone* zone() const; 188 inline Zone* zone() const;
184 189
(...skipping 23 matching lines...) Expand all
208 // Outgoing parameter count at block exit, set during lithium translation. 213 // Outgoing parameter count at block exit, set during lithium translation.
209 int argument_count_; 214 int argument_count_;
210 // Instruction indices into the lithium code stream. 215 // Instruction indices into the lithium code stream.
211 int first_instruction_index_; 216 int first_instruction_index_;
212 int last_instruction_index_; 217 int last_instruction_index_;
213 ZoneList<int> deleted_phis_; 218 ZoneList<int> deleted_phis_;
214 HBasicBlock* parent_loop_header_; 219 HBasicBlock* parent_loop_header_;
215 // For blocks marked as inline return target: the block with HEnterInlined. 220 // For blocks marked as inline return target: the block with HEnterInlined.
216 HBasicBlock* inlined_entry_block_; 221 HBasicBlock* inlined_entry_block_;
217 bool is_inline_return_target_ : 1; 222 bool is_inline_return_target_ : 1;
218 bool is_deoptimizing_ : 1; 223 bool is_reachable_ : 1;
219 bool dominates_loop_successors_ : 1; 224 bool dominates_loop_successors_ : 1;
220 bool is_osr_entry_ : 1; 225 bool is_osr_entry_ : 1;
221 }; 226 };
222 227
223 228
224 class HPredecessorIterator V8_FINAL BASE_EMBEDDED { 229 class HPredecessorIterator V8_FINAL BASE_EMBEDDED {
225 public: 230 public:
226 explicit HPredecessorIterator(HBasicBlock* block) 231 explicit HPredecessorIterator(HBasicBlock* block)
227 : predecessor_list_(block->predecessors()), current_(0) { } 232 : predecessor_list_(block->predecessors()), current_(0) { }
228 233
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 int maximum_environment_size() { return maximum_environment_size_; } 404 int maximum_environment_size() { return maximum_environment_size_; }
400 405
401 bool use_optimistic_licm() { 406 bool use_optimistic_licm() {
402 return use_optimistic_licm_; 407 return use_optimistic_licm_;
403 } 408 }
404 409
405 void set_use_optimistic_licm(bool value) { 410 void set_use_optimistic_licm(bool value) {
406 use_optimistic_licm_ = value; 411 use_optimistic_licm_ = value;
407 } 412 }
408 413
409 bool has_soft_deoptimize() {
410 return has_soft_deoptimize_;
411 }
412
413 void set_has_soft_deoptimize(bool value) {
414 has_soft_deoptimize_ = value;
415 }
416
417 void MarkRecursive() { 414 void MarkRecursive() {
418 is_recursive_ = true; 415 is_recursive_ = true;
419 } 416 }
420 417
421 bool is_recursive() const { 418 bool is_recursive() const {
422 return is_recursive_; 419 return is_recursive_;
423 } 420 }
424 421
425 void MarkDependsOnEmptyArrayProtoElements() { 422 void MarkDependsOnEmptyArrayProtoElements() {
426 // Add map dependency if not already added. 423 // Add map dependency if not already added.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 SetOncePointer<HConstant> constant_invalid_context_; 486 SetOncePointer<HConstant> constant_invalid_context_;
490 SetOncePointer<HArgumentsObject> arguments_object_; 487 SetOncePointer<HArgumentsObject> arguments_object_;
491 488
492 HOsrBuilder* osr_; 489 HOsrBuilder* osr_;
493 490
494 CompilationInfo* info_; 491 CompilationInfo* info_;
495 Zone* zone_; 492 Zone* zone_;
496 493
497 bool is_recursive_; 494 bool is_recursive_;
498 bool use_optimistic_licm_; 495 bool use_optimistic_licm_;
499 bool has_soft_deoptimize_;
500 bool depends_on_empty_array_proto_elements_; 496 bool depends_on_empty_array_proto_elements_;
501 int type_change_checksum_; 497 int type_change_checksum_;
502 int maximum_environment_size_; 498 int maximum_environment_size_;
503 int no_side_effects_scope_count_; 499 int no_side_effects_scope_count_;
504 500
505 DISALLOW_COPY_AND_ASSIGN(HGraph); 501 DISALLOW_COPY_AND_ASSIGN(HGraph);
506 }; 502 };
507 503
508 504
509 Zone* HBasicBlock::zone() const { return graph_->zone(); } 505 Zone* HBasicBlock::zone() const { return graph_->zone(); }
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 1646
1651 1647
1652 template<> 1648 template<>
1653 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( 1649 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>(
1654 const char* reason, Deoptimizer::BailoutType type) { 1650 const char* reason, Deoptimizer::BailoutType type) {
1655 if (type == Deoptimizer::SOFT) { 1651 if (type == Deoptimizer::SOFT) {
1656 isolate()->counters()->soft_deopts_requested()->Increment(); 1652 isolate()->counters()->soft_deopts_requested()->Increment();
1657 if (FLAG_always_opt) return NULL; 1653 if (FLAG_always_opt) return NULL;
1658 } 1654 }
1659 if (current_block()->IsDeoptimizing()) return NULL; 1655 if (current_block()->IsDeoptimizing()) return NULL;
1660 HDeoptimize* instr = New<HDeoptimize>(reason, type); 1656 HBasicBlock* after_deopt_block = CreateBasicBlock(
1661 AddInstruction(instr); 1657 current_block()->last_environment());
1658 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block);
1662 if (type == Deoptimizer::SOFT) { 1659 if (type == Deoptimizer::SOFT) {
1663 isolate()->counters()->soft_deopts_inserted()->Increment(); 1660 isolate()->counters()->soft_deopts_inserted()->Increment();
1664 graph()->set_has_soft_deoptimize(true);
1665 } 1661 }
1666 current_block()->MarkAsDeoptimizing(); 1662 current_block()->Finish(instr);
1663 set_current_block(after_deopt_block);
1667 return instr; 1664 return instr;
1668 } 1665 }
1669 1666
1670 1667
1671 template<> 1668 template<>
1672 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( 1669 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>(
1673 const char* reason, Deoptimizer::BailoutType type) { 1670 const char* reason, Deoptimizer::BailoutType type) {
1674 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type)); 1671 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type));
1675 } 1672 }
1676 1673
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 } 2473 }
2477 2474
2478 private: 2475 private:
2479 HGraphBuilder* builder_; 2476 HGraphBuilder* builder_;
2480 }; 2477 };
2481 2478
2482 2479
2483 } } // namespace v8::internal 2480 } } // namespace v8::internal
2484 2481
2485 #endif // V8_HYDROGEN_H_ 2482 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698