OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ |
6 #define V8_CRANKSHAFT_HYDROGEN_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_H_ |
7 | 7 |
8 #include "src/accessors.h" | 8 #include "src/accessors.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/ast/ast-type-bounds.h" | 10 #include "src/ast/ast-type-bounds.h" |
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1510 |
1511 HLoadNamedField* AddLoadArrayLength(HValue *object, | 1511 HLoadNamedField* AddLoadArrayLength(HValue *object, |
1512 ElementsKind kind, | 1512 ElementsKind kind, |
1513 HValue *dependency = NULL); | 1513 HValue *dependency = NULL); |
1514 | 1514 |
1515 HValue* AddLoadJSBuiltin(int context_index); | 1515 HValue* AddLoadJSBuiltin(int context_index); |
1516 | 1516 |
1517 HValue* EnforceNumberType(HValue* number, Type* expected); | 1517 HValue* EnforceNumberType(HValue* number, Type* expected); |
1518 HValue* TruncateToNumber(HValue* value, Type** expected); | 1518 HValue* TruncateToNumber(HValue* value, Type** expected); |
1519 | 1519 |
1520 void FinishExitWithHardDeoptimization(Deoptimizer::DeoptReason reason); | 1520 void FinishExitWithHardDeoptimization(DeoptimizeReason reason); |
1521 | 1521 |
1522 void AddIncrementCounter(StatsCounter* counter); | 1522 void AddIncrementCounter(StatsCounter* counter); |
1523 | 1523 |
1524 class IfBuilder final { | 1524 class IfBuilder final { |
1525 public: | 1525 public: |
1526 // If using this constructor, Initialize() must be called explicitly! | 1526 // If using this constructor, Initialize() must be called explicitly! |
1527 IfBuilder(); | 1527 IfBuilder(); |
1528 | 1528 |
1529 explicit IfBuilder(HGraphBuilder* builder); | 1529 explicit IfBuilder(HGraphBuilder* builder); |
1530 IfBuilder(HGraphBuilder* builder, | 1530 IfBuilder(HGraphBuilder* builder, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 // // continues after else code of if_whatever or if_something. | 1659 // // continues after else code of if_whatever or if_something. |
1660 // ... | 1660 // ... |
1661 // if_finally.End(); | 1661 // if_finally.End(); |
1662 void JoinContinuation(HIfContinuation* continuation); | 1662 void JoinContinuation(HIfContinuation* continuation); |
1663 | 1663 |
1664 void Then(); | 1664 void Then(); |
1665 void Else(); | 1665 void Else(); |
1666 void End(); | 1666 void End(); |
1667 void EndUnreachable(); | 1667 void EndUnreachable(); |
1668 | 1668 |
1669 void Deopt(Deoptimizer::DeoptReason reason); | 1669 void Deopt(DeoptimizeReason reason); |
1670 void ThenDeopt(Deoptimizer::DeoptReason reason) { | 1670 void ThenDeopt(DeoptimizeReason reason) { |
1671 Then(); | 1671 Then(); |
1672 Deopt(reason); | 1672 Deopt(reason); |
1673 } | 1673 } |
1674 void ElseDeopt(Deoptimizer::DeoptReason reason) { | 1674 void ElseDeopt(DeoptimizeReason reason) { |
1675 Else(); | 1675 Else(); |
1676 Deopt(reason); | 1676 Deopt(reason); |
1677 } | 1677 } |
1678 | 1678 |
1679 void Return(HValue* value); | 1679 void Return(HValue* value); |
1680 | 1680 |
1681 private: | 1681 private: |
1682 void InitializeDontCreateBlocks(HGraphBuilder* builder); | 1682 void InitializeDontCreateBlocks(HGraphBuilder* builder); |
1683 | 1683 |
1684 HControlInstruction* AddCompare(HControlInstruction* compare); | 1684 HControlInstruction* AddCompare(HControlInstruction* compare); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 | 1921 |
1922 CompilationInfo* info_; | 1922 CompilationInfo* info_; |
1923 CallInterfaceDescriptor descriptor_; | 1923 CallInterfaceDescriptor descriptor_; |
1924 HGraph* graph_; | 1924 HGraph* graph_; |
1925 HBasicBlock* current_block_; | 1925 HBasicBlock* current_block_; |
1926 Scope* scope_; | 1926 Scope* scope_; |
1927 SourcePosition position_; | 1927 SourcePosition position_; |
1928 int start_position_; | 1928 int start_position_; |
1929 }; | 1929 }; |
1930 | 1930 |
1931 | |
1932 template <> | 1931 template <> |
1933 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( | 1932 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( |
1934 Deoptimizer::DeoptReason reason, Deoptimizer::BailoutType type) { | 1933 DeoptimizeReason reason, Deoptimizer::BailoutType type) { |
1935 if (type == Deoptimizer::SOFT) { | 1934 if (type == Deoptimizer::SOFT) { |
1936 isolate()->counters()->soft_deopts_requested()->Increment(); | 1935 isolate()->counters()->soft_deopts_requested()->Increment(); |
1937 if (FLAG_always_opt) return NULL; | 1936 if (FLAG_always_opt) return NULL; |
1938 } | 1937 } |
1939 if (current_block()->IsDeoptimizing()) return NULL; | 1938 if (current_block()->IsDeoptimizing()) return NULL; |
1940 HBasicBlock* after_deopt_block = CreateBasicBlock( | 1939 HBasicBlock* after_deopt_block = CreateBasicBlock( |
1941 current_block()->last_environment()); | 1940 current_block()->last_environment()); |
1942 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); | 1941 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); |
1943 if (type == Deoptimizer::SOFT) { | 1942 if (type == Deoptimizer::SOFT) { |
1944 isolate()->counters()->soft_deopts_inserted()->Increment(); | 1943 isolate()->counters()->soft_deopts_inserted()->Increment(); |
1945 } | 1944 } |
1946 FinishCurrentBlock(instr); | 1945 FinishCurrentBlock(instr); |
1947 set_current_block(after_deopt_block); | 1946 set_current_block(after_deopt_block); |
1948 return instr; | 1947 return instr; |
1949 } | 1948 } |
1950 | 1949 |
1951 | |
1952 template <> | 1950 template <> |
1953 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( | 1951 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( |
1954 Deoptimizer::DeoptReason reason, Deoptimizer::BailoutType type) { | 1952 DeoptimizeReason reason, Deoptimizer::BailoutType type) { |
1955 return Add<HDeoptimize>(reason, type); | 1953 return Add<HDeoptimize>(reason, type); |
1956 } | 1954 } |
1957 | 1955 |
1958 | 1956 |
1959 template<> | 1957 template<> |
1960 inline HSimulate* HGraphBuilder::Add<HSimulate>( | 1958 inline HSimulate* HGraphBuilder::Add<HSimulate>( |
1961 BailoutId id, | 1959 BailoutId id, |
1962 RemovableSimulate removable) { | 1960 RemovableSimulate removable) { |
1963 HSimulate* instr = current_block()->CreateSimulate(id, removable); | 1961 HSimulate* instr = current_block()->CreateSimulate(id, removable); |
1964 AddInstruction(instr); | 1962 AddInstruction(instr); |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3043 } | 3041 } |
3044 | 3042 |
3045 private: | 3043 private: |
3046 HOptimizedGraphBuilder* builder_; | 3044 HOptimizedGraphBuilder* builder_; |
3047 }; | 3045 }; |
3048 | 3046 |
3049 } // namespace internal | 3047 } // namespace internal |
3050 } // namespace v8 | 3048 } // namespace v8 |
3051 | 3049 |
3052 #endif // V8_CRANKSHAFT_HYDROGEN_H_ | 3050 #endif // V8_CRANKSHAFT_HYDROGEN_H_ |
OLD | NEW |