OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Full code generator. | 70 // Full code generator. |
71 | 71 |
72 class FullCodeGenerator: public AstVisitor { | 72 class FullCodeGenerator: public AstVisitor { |
73 public: | 73 public: |
74 enum State { | 74 enum State { |
75 NO_REGISTERS, | 75 NO_REGISTERS, |
76 TOS_REG | 76 TOS_REG |
77 }; | 77 }; |
78 | 78 |
79 explicit FullCodeGenerator(MacroAssembler* masm) | 79 explicit FullCodeGenerator(MacroAssembler* masm) |
80 : isolate_(Isolate::Current()), | 80 : masm_(masm), |
81 masm_(masm), | |
82 info_(NULL), | 81 info_(NULL), |
83 nesting_stack_(NULL), | 82 nesting_stack_(NULL), |
84 loop_depth_(0), | 83 loop_depth_(0), |
85 context_(NULL), | 84 context_(NULL), |
86 bailout_entries_(0), | 85 bailout_entries_(0), |
87 stack_checks_(2), // There's always at least one. | 86 stack_checks_(2), // There's always at least one. |
88 forward_bailout_stack_(NULL), | 87 forward_bailout_stack_(NULL), |
89 forward_bailout_pending_(NULL) { | 88 forward_bailout_pending_(NULL) { |
90 } | 89 } |
91 | 90 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 void ExitFinallyBlock(); | 486 void ExitFinallyBlock(); |
488 | 487 |
489 // Loop nesting counter. | 488 // Loop nesting counter. |
490 int loop_depth() { return loop_depth_; } | 489 int loop_depth() { return loop_depth_; } |
491 void increment_loop_depth() { loop_depth_++; } | 490 void increment_loop_depth() { loop_depth_++; } |
492 void decrement_loop_depth() { | 491 void decrement_loop_depth() { |
493 ASSERT(loop_depth_ > 0); | 492 ASSERT(loop_depth_ > 0); |
494 loop_depth_--; | 493 loop_depth_--; |
495 } | 494 } |
496 | 495 |
497 Isolate* isolate() { return isolate_; } | |
498 MacroAssembler* masm() { return masm_; } | 496 MacroAssembler* masm() { return masm_; } |
499 | 497 |
500 class ExpressionContext; | 498 class ExpressionContext; |
501 const ExpressionContext* context() { return context_; } | 499 const ExpressionContext* context() { return context_; } |
502 void set_new_context(const ExpressionContext* context) { context_ = context; } | 500 void set_new_context(const ExpressionContext* context) { context_ = context; } |
503 | 501 |
504 Handle<Script> script() { return info_->script(); } | 502 Handle<Script> script() { return info_->script(); } |
505 bool is_eval() { return info_->is_eval(); } | 503 bool is_eval() { return info_->is_eval(); } |
506 bool is_strict_mode() { return function()->strict_mode(); } | 504 bool is_strict_mode() { return function()->strict_mode(); } |
507 StrictModeFlag strict_mode_flag() { | 505 StrictModeFlag strict_mode_flag() { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 Label* done) const; | 724 Label* done) const; |
727 virtual void PrepareTest(Label* materialize_true, | 725 virtual void PrepareTest(Label* materialize_true, |
728 Label* materialize_false, | 726 Label* materialize_false, |
729 Label** if_true, | 727 Label** if_true, |
730 Label** if_false, | 728 Label** if_false, |
731 Label** fall_through) const; | 729 Label** fall_through) const; |
732 virtual void HandleExpression(Expression* expr) const; | 730 virtual void HandleExpression(Expression* expr) const; |
733 virtual bool IsEffect() const { return true; } | 731 virtual bool IsEffect() const { return true; } |
734 }; | 732 }; |
735 | 733 |
736 Isolate* isolate_; | |
737 MacroAssembler* masm_; | 734 MacroAssembler* masm_; |
738 CompilationInfo* info_; | 735 CompilationInfo* info_; |
739 Label return_label_; | 736 Label return_label_; |
740 NestedStatement* nesting_stack_; | 737 NestedStatement* nesting_stack_; |
741 int loop_depth_; | 738 int loop_depth_; |
742 const ExpressionContext* context_; | 739 const ExpressionContext* context_; |
743 ZoneList<BailoutEntry> bailout_entries_; | 740 ZoneList<BailoutEntry> bailout_entries_; |
744 ZoneList<BailoutEntry> stack_checks_; | 741 ZoneList<BailoutEntry> stack_checks_; |
745 ForwardBailoutStack* forward_bailout_stack_; | 742 ForwardBailoutStack* forward_bailout_stack_; |
746 ForwardBailoutStack* forward_bailout_pending_; | 743 ForwardBailoutStack* forward_bailout_pending_; |
747 | 744 |
748 friend class NestedStatement; | 745 friend class NestedStatement; |
749 | 746 |
750 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 747 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
751 }; | 748 }; |
752 | 749 |
753 | 750 |
754 } } // namespace v8::internal | 751 } } // namespace v8::internal |
755 | 752 |
756 #endif // V8_FULL_CODEGEN_H_ | 753 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |