OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Forward declarations. | 42 // Forward declarations. |
43 class JumpPatchSite; | 43 class JumpPatchSite; |
44 | 44 |
45 // AST node visitor which can tell whether a given statement will be breakable | 45 // AST node visitor which can tell whether a given statement will be breakable |
46 // when the code is compiled by the full compiler in the debugger. This means | 46 // when the code is compiled by the full compiler in the debugger. This means |
47 // that there will be an IC (load/store/call) in the code generated for the | 47 // that there will be an IC (load/store/call) in the code generated for the |
48 // debugger to piggybag on. | 48 // debugger to piggybag on. |
49 class BreakableStatementChecker: public AstVisitor { | 49 class BreakableStatementChecker: public AstVisitor { |
50 public: | 50 public: |
51 BreakableStatementChecker() : is_breakable_(false) {} | 51 BreakableStatementChecker() : is_breakable_(false) { |
| 52 InitializeAstVisitor(); |
| 53 } |
52 | 54 |
53 void Check(Statement* stmt); | 55 void Check(Statement* stmt); |
54 void Check(Expression* stmt); | 56 void Check(Expression* stmt); |
55 | 57 |
56 bool is_breakable() { return is_breakable_; } | 58 bool is_breakable() { return is_breakable_; } |
57 | 59 |
58 private: | 60 private: |
59 // AST node visit functions. | 61 // AST node visit functions. |
60 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 62 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
61 AST_NODE_LIST(DECLARE_VISIT) | 63 AST_NODE_LIST(DECLARE_VISIT) |
62 #undef DECLARE_VISIT | 64 #undef DECLARE_VISIT |
63 | 65 |
64 bool is_breakable_; | 66 bool is_breakable_; |
65 | 67 |
| 68 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
66 DISALLOW_COPY_AND_ASSIGN(BreakableStatementChecker); | 69 DISALLOW_COPY_AND_ASSIGN(BreakableStatementChecker); |
67 }; | 70 }; |
68 | 71 |
69 | 72 |
70 // ----------------------------------------------------------------------------- | 73 // ----------------------------------------------------------------------------- |
71 // Full code generator. | 74 // Full code generator. |
72 | 75 |
73 class FullCodeGenerator: public AstVisitor { | 76 class FullCodeGenerator: public AstVisitor { |
74 public: | 77 public: |
75 enum State { | 78 enum State { |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 ZoneList<BailoutEntry> stack_checks_; | 820 ZoneList<BailoutEntry> stack_checks_; |
818 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; | 821 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; |
819 int ic_total_count_; | 822 int ic_total_count_; |
820 Handle<FixedArray> handler_table_; | 823 Handle<FixedArray> handler_table_; |
821 Handle<JSGlobalPropertyCell> profiling_counter_; | 824 Handle<JSGlobalPropertyCell> profiling_counter_; |
822 bool generate_debug_code_; | 825 bool generate_debug_code_; |
823 Zone* zone_; | 826 Zone* zone_; |
824 | 827 |
825 friend class NestedStatement; | 828 friend class NestedStatement; |
826 | 829 |
| 830 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
827 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 831 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
828 }; | 832 }; |
829 | 833 |
830 | 834 |
831 // A map from property names to getter/setter pairs allocated in the zone. | 835 // A map from property names to getter/setter pairs allocated in the zone. |
832 class AccessorTable: public TemplateHashMap<Literal, | 836 class AccessorTable: public TemplateHashMap<Literal, |
833 ObjectLiteral::Accessors, | 837 ObjectLiteral::Accessors, |
834 ZoneAllocationPolicy> { | 838 ZoneAllocationPolicy> { |
835 public: | 839 public: |
836 explicit AccessorTable(Zone* zone) : | 840 explicit AccessorTable(Zone* zone) : |
837 TemplateHashMap<Literal, ObjectLiteral::Accessors, | 841 TemplateHashMap<Literal, ObjectLiteral::Accessors, |
838 ZoneAllocationPolicy>(Literal::Match, | 842 ZoneAllocationPolicy>(Literal::Match, |
839 ZoneAllocationPolicy(zone)), | 843 ZoneAllocationPolicy(zone)), |
840 zone_(zone) { } | 844 zone_(zone) { } |
841 | 845 |
842 Iterator lookup(Literal* literal) { | 846 Iterator lookup(Literal* literal) { |
843 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_)); | 847 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_)); |
844 if (it->second == NULL) it->second = new(zone_) ObjectLiteral::Accessors(); | 848 if (it->second == NULL) it->second = new(zone_) ObjectLiteral::Accessors(); |
845 return it; | 849 return it; |
846 } | 850 } |
847 | 851 |
848 private: | 852 private: |
849 Zone* zone_; | 853 Zone* zone_; |
850 }; | 854 }; |
851 | 855 |
852 | 856 |
853 } } // namespace v8::internal | 857 } } // namespace v8::internal |
854 | 858 |
855 #endif // V8_FULL_CODEGEN_H_ | 859 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |