OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 class FullCodeGenerator: public AstVisitor { | 73 class FullCodeGenerator: public AstVisitor { |
74 public: | 74 public: |
75 enum State { | 75 enum State { |
76 NO_REGISTERS, | 76 NO_REGISTERS, |
77 TOS_REG | 77 TOS_REG |
78 }; | 78 }; |
79 | 79 |
80 explicit FullCodeGenerator(MacroAssembler* masm) | 80 explicit FullCodeGenerator(MacroAssembler* masm) |
81 : masm_(masm), | 81 : masm_(masm), |
82 info_(NULL), | 82 info_(NULL), |
| 83 scope_(NULL), |
83 nesting_stack_(NULL), | 84 nesting_stack_(NULL), |
84 loop_depth_(0), | 85 loop_depth_(0), |
85 context_(NULL), | 86 context_(NULL), |
86 bailout_entries_(0), | 87 bailout_entries_(0), |
87 stack_checks_(2), // There's always at least one. | 88 stack_checks_(2), // There's always at least one. |
88 forward_bailout_stack_(NULL), | 89 forward_bailout_stack_(NULL), |
89 forward_bailout_pending_(NULL) { | 90 forward_bailout_pending_(NULL) { |
90 } | 91 } |
91 | 92 |
92 static bool MakeCode(CompilationInfo* info); | 93 static bool MakeCode(CompilationInfo* info); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 const ExpressionContext* context() { return context_; } | 525 const ExpressionContext* context() { return context_; } |
525 void set_new_context(const ExpressionContext* context) { context_ = context; } | 526 void set_new_context(const ExpressionContext* context) { context_ = context; } |
526 | 527 |
527 Handle<Script> script() { return info_->script(); } | 528 Handle<Script> script() { return info_->script(); } |
528 bool is_eval() { return info_->is_eval(); } | 529 bool is_eval() { return info_->is_eval(); } |
529 bool is_strict_mode() { return function()->strict_mode(); } | 530 bool is_strict_mode() { return function()->strict_mode(); } |
530 StrictModeFlag strict_mode_flag() { | 531 StrictModeFlag strict_mode_flag() { |
531 return is_strict_mode() ? kStrictMode : kNonStrictMode; | 532 return is_strict_mode() ? kStrictMode : kNonStrictMode; |
532 } | 533 } |
533 FunctionLiteral* function() { return info_->function(); } | 534 FunctionLiteral* function() { return info_->function(); } |
534 Scope* scope() { return info_->scope(); } | 535 Scope* scope() { return scope_; } |
535 | 536 |
536 static Register result_register(); | 537 static Register result_register(); |
537 static Register context_register(); | 538 static Register context_register(); |
538 | 539 |
539 // Helper for calling an IC stub. | 540 // Helper for calling an IC stub. |
540 void EmitCallIC(Handle<Code> ic, | 541 void EmitCallIC(Handle<Code> ic, |
541 RelocInfo::Mode mode, | 542 RelocInfo::Mode mode, |
542 unsigned ast_id); | 543 unsigned ast_id); |
543 | 544 |
544 // Set fields in the stack frame. Offsets are the frame pointer relative | 545 // Set fields in the stack frame. Offsets are the frame pointer relative |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 virtual void PrepareTest(Label* materialize_true, | 745 virtual void PrepareTest(Label* materialize_true, |
745 Label* materialize_false, | 746 Label* materialize_false, |
746 Label** if_true, | 747 Label** if_true, |
747 Label** if_false, | 748 Label** if_false, |
748 Label** fall_through) const; | 749 Label** fall_through) const; |
749 virtual bool IsEffect() const { return true; } | 750 virtual bool IsEffect() const { return true; } |
750 }; | 751 }; |
751 | 752 |
752 MacroAssembler* masm_; | 753 MacroAssembler* masm_; |
753 CompilationInfo* info_; | 754 CompilationInfo* info_; |
| 755 Scope* scope_; |
754 Label return_label_; | 756 Label return_label_; |
755 NestedStatement* nesting_stack_; | 757 NestedStatement* nesting_stack_; |
756 int loop_depth_; | 758 int loop_depth_; |
757 const ExpressionContext* context_; | 759 const ExpressionContext* context_; |
758 ZoneList<BailoutEntry> bailout_entries_; | 760 ZoneList<BailoutEntry> bailout_entries_; |
759 ZoneList<BailoutEntry> stack_checks_; | 761 ZoneList<BailoutEntry> stack_checks_; |
760 ForwardBailoutStack* forward_bailout_stack_; | 762 ForwardBailoutStack* forward_bailout_stack_; |
761 ForwardBailoutStack* forward_bailout_pending_; | 763 ForwardBailoutStack* forward_bailout_pending_; |
762 | 764 |
763 friend class NestedStatement; | 765 friend class NestedStatement; |
764 | 766 |
765 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 767 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
766 }; | 768 }; |
767 | 769 |
768 | 770 |
769 } } // namespace v8::internal | 771 } } // namespace v8::internal |
770 | 772 |
771 #endif // V8_FULL_CODEGEN_H_ | 773 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |