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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_FULL_CODEGEN_H_ | 28 #ifndef V8_FULL_CODEGEN_H_ |
29 #define V8_FULL_CODEGEN_H_ | 29 #define V8_FULL_CODEGEN_H_ |
30 | 30 |
31 #include "v8.h" | 31 #include "v8.h" |
32 | 32 |
33 #include "allocation.h" | 33 #include "allocation.h" |
34 #include "assert-scope.h" | |
35 #include "ast.h" | 34 #include "ast.h" |
36 #include "code-stubs.h" | 35 #include "code-stubs.h" |
37 #include "codegen.h" | 36 #include "codegen.h" |
38 #include "compiler.h" | 37 #include "compiler.h" |
39 #include "data-flow.h" | 38 #include "data-flow.h" |
40 #include "globals.h" | |
41 #include "objects.h" | |
42 | 39 |
43 namespace v8 { | 40 namespace v8 { |
44 namespace internal { | 41 namespace internal { |
45 | 42 |
46 // Forward declarations. | 43 // Forward declarations. |
47 class JumpPatchSite; | 44 class JumpPatchSite; |
48 | 45 |
49 // AST node visitor which can tell whether a given statement will be breakable | 46 // AST node visitor which can tell whether a given statement will be breakable |
50 // when the code is compiled by the full compiler in the debugger. This means | 47 // when the code is compiled by the full compiler in the debugger. This means |
51 // that there will be an IC (load/store/call) in the code generated for the | 48 // that there will be an IC (load/store/call) in the code generated for the |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 #elif V8_TARGET_ARCH_X64 | 129 #elif V8_TARGET_ARCH_X64 |
133 static const int kCodeSizeMultiplier = 162; | 130 static const int kCodeSizeMultiplier = 162; |
134 #elif V8_TARGET_ARCH_ARM | 131 #elif V8_TARGET_ARCH_ARM |
135 static const int kCodeSizeMultiplier = 142; | 132 static const int kCodeSizeMultiplier = 142; |
136 #elif V8_TARGET_ARCH_MIPS | 133 #elif V8_TARGET_ARCH_MIPS |
137 static const int kCodeSizeMultiplier = 142; | 134 static const int kCodeSizeMultiplier = 142; |
138 #else | 135 #else |
139 #error Unsupported target architecture. | 136 #error Unsupported target architecture. |
140 #endif | 137 #endif |
141 | 138 |
142 class BackEdgeTableIterator { | 139 static const int kBackEdgeEntrySize = 3 * kIntSize; |
143 public: | |
144 explicit BackEdgeTableIterator(Code* unoptimized) { | |
145 ASSERT(unoptimized->kind() == Code::FUNCTION); | |
146 instruction_start_ = unoptimized->instruction_start(); | |
147 cursor_ = instruction_start_ + unoptimized->back_edge_table_offset(); | |
148 ASSERT(cursor_ < instruction_start_ + unoptimized->instruction_size()); | |
149 table_length_ = Memory::uint32_at(cursor_); | |
150 cursor_ += kTableLengthSize; | |
151 end_ = cursor_ + table_length_ * kEntrySize; | |
152 } | |
153 | |
154 bool Done() { return cursor_ >= end_; } | |
155 | |
156 void Next() { | |
157 ASSERT(!Done()); | |
158 cursor_ += kEntrySize; | |
159 } | |
160 | |
161 BailoutId ast_id() { | |
162 ASSERT(!Done()); | |
163 return BailoutId(static_cast<int>( | |
164 Memory::uint32_at(cursor_ + kAstIdOffset))); | |
165 } | |
166 | |
167 uint32_t loop_depth() { | |
168 ASSERT(!Done()); | |
169 return Memory::uint32_at(cursor_ + kLoopDepthOffset); | |
170 } | |
171 | |
172 uint32_t pc_offset() { | |
173 ASSERT(!Done()); | |
174 return Memory::uint32_at(cursor_ + kPcOffsetOffset); | |
175 } | |
176 | |
177 Address pc() { | |
178 ASSERT(!Done()); | |
179 return instruction_start_ + pc_offset(); | |
180 } | |
181 | |
182 uint32_t table_length() { return table_length_; } | |
183 | |
184 private: | |
185 static const int kTableLengthSize = kIntSize; | |
186 static const int kAstIdOffset = 0 * kIntSize; | |
187 static const int kPcOffsetOffset = 1 * kIntSize; | |
188 static const int kLoopDepthOffset = 2 * kIntSize; | |
189 static const int kEntrySize = 3 * kIntSize; | |
190 | |
191 Address cursor_; | |
192 Address end_; | |
193 Address instruction_start_; | |
194 uint32_t table_length_; | |
195 DisallowHeapAllocation no_gc_while_iterating_over_raw_addresses_; | |
196 | |
197 DISALLOW_COPY_AND_ASSIGN(BackEdgeTableIterator); | |
198 }; | |
199 | |
200 | 140 |
201 private: | 141 private: |
202 class Breakable; | 142 class Breakable; |
203 class Iteration; | 143 class Iteration; |
204 | 144 |
205 class TestContext; | 145 class TestContext; |
206 | 146 |
207 class NestedStatement BASE_EMBEDDED { | 147 class NestedStatement BASE_EMBEDDED { |
208 public: | 148 public: |
209 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) { | 149 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 618 |
679 // Push the function argument for the runtime functions PushWithContext | 619 // Push the function argument for the runtime functions PushWithContext |
680 // and PushCatchContext. | 620 // and PushCatchContext. |
681 void PushFunctionArgumentForContextAllocation(); | 621 void PushFunctionArgumentForContextAllocation(); |
682 | 622 |
683 // AST node visit functions. | 623 // AST node visit functions. |
684 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 624 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
685 AST_NODE_LIST(DECLARE_VISIT) | 625 AST_NODE_LIST(DECLARE_VISIT) |
686 #undef DECLARE_VISIT | 626 #undef DECLARE_VISIT |
687 | 627 |
| 628 void EmitUnaryOperation(UnaryOperation* expr, const char* comment); |
| 629 |
688 void VisitComma(BinaryOperation* expr); | 630 void VisitComma(BinaryOperation* expr); |
689 void VisitLogicalExpression(BinaryOperation* expr); | 631 void VisitLogicalExpression(BinaryOperation* expr); |
690 void VisitArithmeticExpression(BinaryOperation* expr); | 632 void VisitArithmeticExpression(BinaryOperation* expr); |
691 | 633 |
692 void VisitForTypeofValue(Expression* expr); | 634 void VisitForTypeofValue(Expression* expr); |
693 | 635 |
694 void Generate(); | 636 void Generate(); |
695 void PopulateDeoptimizationData(Handle<Code> code); | 637 void PopulateDeoptimizationData(Handle<Code> code); |
696 void PopulateTypeFeedbackInfo(Handle<Code> code); | 638 void PopulateTypeFeedbackInfo(Handle<Code> code); |
697 void PopulateTypeFeedbackCells(Handle<Code> code); | 639 void PopulateTypeFeedbackCells(Handle<Code> code); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 } | 878 } |
937 | 879 |
938 private: | 880 private: |
939 Zone* zone_; | 881 Zone* zone_; |
940 }; | 882 }; |
941 | 883 |
942 | 884 |
943 } } // namespace v8::internal | 885 } } // namespace v8::internal |
944 | 886 |
945 #endif // V8_FULL_CODEGEN_H_ | 887 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |