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" |
34 #include "ast.h" | 35 #include "ast.h" |
35 #include "code-stubs.h" | 36 #include "code-stubs.h" |
36 #include "codegen.h" | 37 #include "codegen.h" |
37 #include "compiler.h" | 38 #include "compiler.h" |
38 #include "data-flow.h" | 39 #include "data-flow.h" |
| 40 #include "globals.h" |
| 41 #include "objects.h" |
39 | 42 |
40 namespace v8 { | 43 namespace v8 { |
41 namespace internal { | 44 namespace internal { |
42 | 45 |
43 // Forward declarations. | 46 // Forward declarations. |
44 class JumpPatchSite; | 47 class JumpPatchSite; |
45 | 48 |
46 // AST node visitor which can tell whether a given statement will be breakable | 49 // AST node visitor which can tell whether a given statement will be breakable |
47 // when the code is compiled by the full compiler in the debugger. This means | 50 // when the code is compiled by the full compiler in the debugger. This means |
48 // that there will be an IC (load/store/call) in the code generated for the | 51 // 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... |
129 #elif V8_TARGET_ARCH_X64 | 132 #elif V8_TARGET_ARCH_X64 |
130 static const int kCodeSizeMultiplier = 162; | 133 static const int kCodeSizeMultiplier = 162; |
131 #elif V8_TARGET_ARCH_ARM | 134 #elif V8_TARGET_ARCH_ARM |
132 static const int kCodeSizeMultiplier = 142; | 135 static const int kCodeSizeMultiplier = 142; |
133 #elif V8_TARGET_ARCH_MIPS | 136 #elif V8_TARGET_ARCH_MIPS |
134 static const int kCodeSizeMultiplier = 142; | 137 static const int kCodeSizeMultiplier = 142; |
135 #else | 138 #else |
136 #error Unsupported target architecture. | 139 #error Unsupported target architecture. |
137 #endif | 140 #endif |
138 | 141 |
139 static const int kBackEdgeEntrySize = 3 * kIntSize; | 142 class BackEdgeTableIterator { |
| 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 |
140 | 200 |
141 private: | 201 private: |
142 class Breakable; | 202 class Breakable; |
143 class Iteration; | 203 class Iteration; |
144 | 204 |
145 class TestContext; | 205 class TestContext; |
146 | 206 |
147 class NestedStatement BASE_EMBEDDED { | 207 class NestedStatement BASE_EMBEDDED { |
148 public: | 208 public: |
149 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) { | 209 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) { |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 } | 936 } |
877 | 937 |
878 private: | 938 private: |
879 Zone* zone_; | 939 Zone* zone_; |
880 }; | 940 }; |
881 | 941 |
882 | 942 |
883 } } // namespace v8::internal | 943 } } // namespace v8::internal |
884 | 944 |
885 #endif // V8_FULL_CODEGEN_H_ | 945 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |