| 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.h" | 10 #include "src/ast.h" |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 AstContext* outer_; | 781 AstContext* outer_; |
| 782 TypeofMode typeof_mode_; | 782 TypeofMode typeof_mode_; |
| 783 }; | 783 }; |
| 784 | 784 |
| 785 | 785 |
| 786 class EffectContext final : public AstContext { | 786 class EffectContext final : public AstContext { |
| 787 public: | 787 public: |
| 788 explicit EffectContext(HOptimizedGraphBuilder* owner) | 788 explicit EffectContext(HOptimizedGraphBuilder* owner) |
| 789 : AstContext(owner, Expression::kEffect) { | 789 : AstContext(owner, Expression::kEffect) { |
| 790 } | 790 } |
| 791 virtual ~EffectContext(); | 791 ~EffectContext() override; |
| 792 | 792 |
| 793 void ReturnValue(HValue* value) override; | 793 void ReturnValue(HValue* value) override; |
| 794 virtual void ReturnInstruction(HInstruction* instr, | 794 void ReturnInstruction(HInstruction* instr, BailoutId ast_id) override; |
| 795 BailoutId ast_id) override; | 795 void ReturnControl(HControlInstruction* instr, BailoutId ast_id) override; |
| 796 virtual void ReturnControl(HControlInstruction* instr, | 796 void ReturnContinuation(HIfContinuation* continuation, |
| 797 BailoutId ast_id) override; | 797 BailoutId ast_id) override; |
| 798 virtual void ReturnContinuation(HIfContinuation* continuation, | |
| 799 BailoutId ast_id) override; | |
| 800 }; | 798 }; |
| 801 | 799 |
| 802 | 800 |
| 803 class ValueContext final : public AstContext { | 801 class ValueContext final : public AstContext { |
| 804 public: | 802 public: |
| 805 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag) | 803 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag) |
| 806 : AstContext(owner, Expression::kValue), flag_(flag) { | 804 : AstContext(owner, Expression::kValue), flag_(flag) { |
| 807 } | 805 } |
| 808 virtual ~ValueContext(); | 806 ~ValueContext() override; |
| 809 | 807 |
| 810 void ReturnValue(HValue* value) override; | 808 void ReturnValue(HValue* value) override; |
| 811 virtual void ReturnInstruction(HInstruction* instr, | 809 void ReturnInstruction(HInstruction* instr, BailoutId ast_id) override; |
| 812 BailoutId ast_id) override; | 810 void ReturnControl(HControlInstruction* instr, BailoutId ast_id) override; |
| 813 virtual void ReturnControl(HControlInstruction* instr, | 811 void ReturnContinuation(HIfContinuation* continuation, |
| 814 BailoutId ast_id) override; | 812 BailoutId ast_id) override; |
| 815 virtual void ReturnContinuation(HIfContinuation* continuation, | |
| 816 BailoutId ast_id) override; | |
| 817 | 813 |
| 818 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } | 814 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } |
| 819 | 815 |
| 820 private: | 816 private: |
| 821 ArgumentsAllowedFlag flag_; | 817 ArgumentsAllowedFlag flag_; |
| 822 }; | 818 }; |
| 823 | 819 |
| 824 | 820 |
| 825 class TestContext final : public AstContext { | 821 class TestContext final : public AstContext { |
| 826 public: | 822 public: |
| 827 TestContext(HOptimizedGraphBuilder* owner, | 823 TestContext(HOptimizedGraphBuilder* owner, |
| 828 Expression* condition, | 824 Expression* condition, |
| 829 HBasicBlock* if_true, | 825 HBasicBlock* if_true, |
| 830 HBasicBlock* if_false) | 826 HBasicBlock* if_false) |
| 831 : AstContext(owner, Expression::kTest), | 827 : AstContext(owner, Expression::kTest), |
| 832 condition_(condition), | 828 condition_(condition), |
| 833 if_true_(if_true), | 829 if_true_(if_true), |
| 834 if_false_(if_false) { | 830 if_false_(if_false) { |
| 835 } | 831 } |
| 836 | 832 |
| 837 void ReturnValue(HValue* value) override; | 833 void ReturnValue(HValue* value) override; |
| 838 virtual void ReturnInstruction(HInstruction* instr, | 834 void ReturnInstruction(HInstruction* instr, BailoutId ast_id) override; |
| 839 BailoutId ast_id) override; | 835 void ReturnControl(HControlInstruction* instr, BailoutId ast_id) override; |
| 840 virtual void ReturnControl(HControlInstruction* instr, | 836 void ReturnContinuation(HIfContinuation* continuation, |
| 841 BailoutId ast_id) override; | 837 BailoutId ast_id) override; |
| 842 virtual void ReturnContinuation(HIfContinuation* continuation, | |
| 843 BailoutId ast_id) override; | |
| 844 | 838 |
| 845 static TestContext* cast(AstContext* context) { | 839 static TestContext* cast(AstContext* context) { |
| 846 DCHECK(context->IsTest()); | 840 DCHECK(context->IsTest()); |
| 847 return reinterpret_cast<TestContext*>(context); | 841 return reinterpret_cast<TestContext*>(context); |
| 848 } | 842 } |
| 849 | 843 |
| 850 Expression* condition() const { return condition_; } | 844 Expression* condition() const { return condition_; } |
| 851 HBasicBlock* if_true() const { return if_true_; } | 845 HBasicBlock* if_true() const { return if_true_; } |
| 852 HBasicBlock* if_false() const { return if_false_; } | 846 HBasicBlock* if_false() const { return if_false_; } |
| 853 | 847 |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2385 ArgumentsAllowedFlag flag); | 2379 ArgumentsAllowedFlag flag); |
| 2386 | 2380 |
| 2387 // Remove the arguments from the bailout environment and emit instructions | 2381 // Remove the arguments from the bailout environment and emit instructions |
| 2388 // to push them as outgoing parameters. | 2382 // to push them as outgoing parameters. |
| 2389 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 2383 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
| 2390 void PushArgumentsFromEnvironment(int count); | 2384 void PushArgumentsFromEnvironment(int count); |
| 2391 | 2385 |
| 2392 void SetUpScope(Scope* scope); | 2386 void SetUpScope(Scope* scope); |
| 2393 void VisitStatements(ZoneList<Statement*>* statements) override; | 2387 void VisitStatements(ZoneList<Statement*>* statements) override; |
| 2394 | 2388 |
| 2395 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; | 2389 #define DECLARE_VISIT(type) void Visit##type(type* node) override; |
| 2396 AST_NODE_LIST(DECLARE_VISIT) | 2390 AST_NODE_LIST(DECLARE_VISIT) |
| 2397 #undef DECLARE_VISIT | 2391 #undef DECLARE_VISIT |
| 2398 | 2392 |
| 2399 private: | 2393 private: |
| 2400 // Helpers for flow graph construction. | 2394 // Helpers for flow graph construction. |
| 2401 enum GlobalPropertyAccess { | 2395 enum GlobalPropertyAccess { |
| 2402 kUseCell, | 2396 kUseCell, |
| 2403 kUseGeneric | 2397 kUseGeneric |
| 2404 }; | 2398 }; |
| 2405 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it, | 2399 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it, |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 | 3066 |
| 3073 private: | 3067 private: |
| 3074 HGraphBuilder* builder_; | 3068 HGraphBuilder* builder_; |
| 3075 }; | 3069 }; |
| 3076 | 3070 |
| 3077 | 3071 |
| 3078 } // namespace internal | 3072 } // namespace internal |
| 3079 } // namespace v8 | 3073 } // namespace v8 |
| 3080 | 3074 |
| 3081 #endif // V8_CRANKSHAFT_HYDROGEN_H_ | 3075 #endif // V8_CRANKSHAFT_HYDROGEN_H_ |
| OLD | NEW |