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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 #elif V8_TARGET_ARCH_ARM | 134 #elif V8_TARGET_ARCH_ARM |
135 static const int kCodeSizeMultiplier = 142; | 135 static const int kCodeSizeMultiplier = 142; |
136 #elif V8_TARGET_ARCH_MIPS | 136 #elif V8_TARGET_ARCH_MIPS |
137 static const int kCodeSizeMultiplier = 142; | 137 static const int kCodeSizeMultiplier = 142; |
138 #else | 138 #else |
139 #error Unsupported target architecture. | 139 #error Unsupported target architecture. |
140 #endif | 140 #endif |
141 | 141 |
142 class BackEdgeTableIterator { | 142 class BackEdgeTableIterator { |
143 public: | 143 public: |
144 explicit BackEdgeTableIterator(Code* unoptimized) { | 144 explicit BackEdgeTableIterator(Code* unoptimized, |
| 145 DisallowHeapAllocation* required) { |
145 ASSERT(unoptimized->kind() == Code::FUNCTION); | 146 ASSERT(unoptimized->kind() == Code::FUNCTION); |
146 instruction_start_ = unoptimized->instruction_start(); | 147 instruction_start_ = unoptimized->instruction_start(); |
147 cursor_ = instruction_start_ + unoptimized->back_edge_table_offset(); | 148 cursor_ = instruction_start_ + unoptimized->back_edge_table_offset(); |
148 ASSERT(cursor_ < instruction_start_ + unoptimized->instruction_size()); | 149 ASSERT(cursor_ < instruction_start_ + unoptimized->instruction_size()); |
149 table_length_ = Memory::uint32_at(cursor_); | 150 table_length_ = Memory::uint32_at(cursor_); |
150 cursor_ += kTableLengthSize; | 151 cursor_ += kTableLengthSize; |
151 end_ = cursor_ + table_length_ * kEntrySize; | 152 end_ = cursor_ + table_length_ * kEntrySize; |
152 } | 153 } |
153 | 154 |
154 bool Done() { return cursor_ >= end_; } | 155 bool Done() { return cursor_ >= end_; } |
(...skipping 19 matching lines...) Expand all Loading... |
174 return Memory::uint32_at(cursor_ + kPcOffsetOffset); | 175 return Memory::uint32_at(cursor_ + kPcOffsetOffset); |
175 } | 176 } |
176 | 177 |
177 Address pc() { | 178 Address pc() { |
178 ASSERT(!Done()); | 179 ASSERT(!Done()); |
179 return instruction_start_ + pc_offset(); | 180 return instruction_start_ + pc_offset(); |
180 } | 181 } |
181 | 182 |
182 uint32_t table_length() { return table_length_; } | 183 uint32_t table_length() { return table_length_; } |
183 | 184 |
| 185 bool FindPcOffset(uint32_t target_pc_offset) { |
| 186 while (!Done()) { |
| 187 if (pc_offset() == target_pc_offset) return true; |
| 188 Next(); |
| 189 } |
| 190 return false; |
| 191 } |
| 192 |
184 private: | 193 private: |
185 static const int kTableLengthSize = kIntSize; | 194 static const int kTableLengthSize = kIntSize; |
186 static const int kAstIdOffset = 0 * kIntSize; | 195 static const int kAstIdOffset = 0 * kIntSize; |
187 static const int kPcOffsetOffset = 1 * kIntSize; | 196 static const int kPcOffsetOffset = 1 * kIntSize; |
188 static const int kLoopDepthOffset = 2 * kIntSize; | 197 static const int kLoopDepthOffset = 2 * kIntSize; |
189 static const int kEntrySize = 3 * kIntSize; | 198 static const int kEntrySize = 3 * kIntSize; |
190 | 199 |
191 Address cursor_; | 200 Address cursor_; |
192 Address end_; | 201 Address end_; |
193 Address instruction_start_; | 202 Address instruction_start_; |
194 uint32_t table_length_; | 203 uint32_t table_length_; |
195 DisallowHeapAllocation no_gc_while_iterating_over_raw_addresses_; | |
196 | 204 |
197 DISALLOW_COPY_AND_ASSIGN(BackEdgeTableIterator); | 205 DISALLOW_COPY_AND_ASSIGN(BackEdgeTableIterator); |
198 }; | 206 }; |
199 | 207 |
200 | 208 |
201 private: | 209 private: |
202 class Breakable; | 210 class Breakable; |
203 class Iteration; | 211 class Iteration; |
204 | 212 |
205 class TestContext; | 213 class TestContext; |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 } | 944 } |
937 | 945 |
938 private: | 946 private: |
939 Zone* zone_; | 947 Zone* zone_; |
940 }; | 948 }; |
941 | 949 |
942 | 950 |
943 } } // namespace v8::internal | 951 } } // namespace v8::internal |
944 | 952 |
945 #endif // V8_FULL_CODEGEN_H_ | 953 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |