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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // ----------------------------------------------------------------------------- | 70 // ----------------------------------------------------------------------------- |
71 // Full code generator. | 71 // Full code generator. |
72 | 72 |
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 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info, | 80 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info) |
81 Zone* zone) | |
82 : masm_(masm), | 81 : masm_(masm), |
83 info_(info), | 82 info_(info), |
84 scope_(info->scope()), | 83 scope_(info->scope()), |
85 nesting_stack_(NULL), | 84 nesting_stack_(NULL), |
86 loop_depth_(0), | 85 loop_depth_(0), |
87 globals_(NULL), | 86 globals_(NULL), |
88 context_(NULL), | 87 context_(NULL), |
89 bailout_entries_(info->HasDeoptimizationSupport() | 88 bailout_entries_(info->HasDeoptimizationSupport() |
90 ? info->function()->ast_node_count() : 0, zone), | 89 ? info->function()->ast_node_count() : 0, |
91 stack_checks_(2, zone), // There's always at least one. | 90 info->zone()), |
| 91 stack_checks_(2, info->zone()), // There's always at least one. |
92 type_feedback_cells_(info->HasDeoptimizationSupport() | 92 type_feedback_cells_(info->HasDeoptimizationSupport() |
93 ? info->function()->ast_node_count() : 0, zone), | 93 ? info->function()->ast_node_count() : 0, |
| 94 info->zone()), |
94 ic_total_count_(0), | 95 ic_total_count_(0), |
95 zone_(zone) { } | 96 zone_(info->zone()) { } |
96 | 97 |
97 static bool MakeCode(CompilationInfo* info); | 98 static bool MakeCode(CompilationInfo* info); |
98 | 99 |
99 // Encode state and pc-offset as a BitField<type, start, size>. | 100 // Encode state and pc-offset as a BitField<type, start, size>. |
100 // Only use 30 bits because we encode the result as a smi. | 101 // Only use 30 bits because we encode the result as a smi. |
101 class StateField : public BitField<State, 0, 1> { }; | 102 class StateField : public BitField<State, 0, 1> { }; |
102 class PcField : public BitField<unsigned, 1, 30-1> { }; | 103 class PcField : public BitField<unsigned, 1, 30-1> { }; |
103 | 104 |
104 static const char* State2String(State state) { | 105 static const char* State2String(State state) { |
105 switch (state) { | 106 switch (state) { |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 } | 817 } |
817 | 818 |
818 private: | 819 private: |
819 Zone* zone_; | 820 Zone* zone_; |
820 }; | 821 }; |
821 | 822 |
822 | 823 |
823 } } // namespace v8::internal | 824 } } // namespace v8::internal |
824 | 825 |
825 #endif // V8_FULL_CODEGEN_H_ | 826 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |