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_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
6 #define V8_HYDROGEN_H_ | 6 #define V8_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.h" | 10 #include "src/ast.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 606 |
607 HValue* ExpressionStackAt(int index_from_top) const { | 607 HValue* ExpressionStackAt(int index_from_top) const { |
608 int index = length() - index_from_top - 1; | 608 int index = length() - index_from_top - 1; |
609 DCHECK(HasExpressionAt(index)); | 609 DCHECK(HasExpressionAt(index)); |
610 return values_[index]; | 610 return values_[index]; |
611 } | 611 } |
612 | 612 |
613 void SetExpressionStackAt(int index_from_top, HValue* value); | 613 void SetExpressionStackAt(int index_from_top, HValue* value); |
614 HValue* RemoveExpressionStackAt(int index_from_top); | 614 HValue* RemoveExpressionStackAt(int index_from_top); |
615 | 615 |
| 616 void Print() const; |
| 617 |
616 HEnvironment* Copy() const; | 618 HEnvironment* Copy() const; |
617 HEnvironment* CopyWithoutHistory() const; | 619 HEnvironment* CopyWithoutHistory() const; |
618 HEnvironment* CopyAsLoopHeader(HBasicBlock* block) const; | 620 HEnvironment* CopyAsLoopHeader(HBasicBlock* block) const; |
619 | 621 |
620 // Create an "inlined version" of this environment, where the original | 622 // Create an "inlined version" of this environment, where the original |
621 // environment is the outer environment but the top expression stack | 623 // environment is the outer environment but the top expression stack |
622 // elements are moved to an inner environment as parameters. | 624 // elements are moved to an inner environment as parameters. |
623 HEnvironment* CopyForInlining(Handle<JSFunction> target, | 625 HEnvironment* CopyForInlining(Handle<JSFunction> target, |
624 int arguments, | 626 int arguments, |
625 FunctionLiteral* function, | 627 FunctionLiteral* function, |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 | 2021 |
2020 template<> | 2022 template<> |
2021 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( | 2023 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( |
2022 Handle<String> name, | 2024 Handle<String> name, |
2023 const Runtime::Function* c_function, | 2025 const Runtime::Function* c_function, |
2024 int argument_count) { | 2026 int argument_count) { |
2025 return Add<HCallRuntime>(c_function, argument_count); | 2027 return Add<HCallRuntime>(c_function, argument_count); |
2026 } | 2028 } |
2027 | 2029 |
2028 | 2030 |
2029 template<> | 2031 template <> |
| 2032 inline HParameter* HGraphBuilder::New<HParameter>(unsigned index) { |
| 2033 return HParameter::New(isolate(), zone(), nullptr, index); |
| 2034 } |
| 2035 |
| 2036 |
| 2037 template <> |
| 2038 inline HParameter* HGraphBuilder::New<HParameter>( |
| 2039 unsigned index, HParameter::ParameterKind kind) { |
| 2040 return HParameter::New(isolate(), zone(), nullptr, index, kind); |
| 2041 } |
| 2042 |
| 2043 |
| 2044 template <> |
| 2045 inline HParameter* HGraphBuilder::New<HParameter>( |
| 2046 unsigned index, HParameter::ParameterKind kind, Representation r) { |
| 2047 return HParameter::New(isolate(), zone(), nullptr, index, kind, r); |
| 2048 } |
| 2049 |
| 2050 |
| 2051 template <> |
| 2052 inline HPrologue* HGraphBuilder::New<HPrologue>() { |
| 2053 return HPrologue::New(zone()); |
| 2054 } |
| 2055 |
| 2056 |
| 2057 template <> |
2030 inline HContext* HGraphBuilder::New<HContext>() { | 2058 inline HContext* HGraphBuilder::New<HContext>() { |
2031 return HContext::New(zone()); | 2059 return HContext::New(zone()); |
2032 } | 2060 } |
2033 | 2061 |
2034 | 2062 |
2035 template<> | |
2036 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { | |
2037 return New<HContext>(); | |
2038 } | |
2039 | |
2040 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { | 2063 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { |
2041 public: | 2064 public: |
2042 // A class encapsulating (lazily-allocated) break and continue blocks for | 2065 // A class encapsulating (lazily-allocated) break and continue blocks for |
2043 // a breakable statement. Separated from BreakAndContinueScope so that it | 2066 // a breakable statement. Separated from BreakAndContinueScope so that it |
2044 // can have a separate lifetime. | 2067 // can have a separate lifetime. |
2045 class BreakAndContinueInfo final BASE_EMBEDDED { | 2068 class BreakAndContinueInfo final BASE_EMBEDDED { |
2046 public: | 2069 public: |
2047 explicit BreakAndContinueInfo(BreakableStatement* target, | 2070 explicit BreakAndContinueInfo(BreakableStatement* target, |
2048 Scope* scope, | 2071 Scope* scope, |
2049 int drop_extra = 0) | 2072 int drop_extra = 0) |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 } | 3065 } |
3043 | 3066 |
3044 private: | 3067 private: |
3045 HGraphBuilder* builder_; | 3068 HGraphBuilder* builder_; |
3046 }; | 3069 }; |
3047 | 3070 |
3048 | 3071 |
3049 } } // namespace v8::internal | 3072 } } // namespace v8::internal |
3050 | 3073 |
3051 #endif // V8_HYDROGEN_H_ | 3074 #endif // V8_HYDROGEN_H_ |
OLD | NEW |