OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/disassembler.h" | 5 #include "vm/disassembler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/deopt_instructions.h" | 8 #include "vm/deopt_instructions.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 void Disassembler::DisassembleCode(const Function& function, bool optimized) { | 188 void Disassembler::DisassembleCode(const Function& function, bool optimized) { |
189 const char* function_fullname = function.ToFullyQualifiedCString(); | 189 const char* function_fullname = function.ToFullyQualifiedCString(); |
190 THR_Print("Code for %sfunction '%s' {\n", | 190 THR_Print("Code for %sfunction '%s' {\n", |
191 optimized ? "optimized " : "", | 191 optimized ? "optimized " : "", |
192 function_fullname); | 192 function_fullname); |
193 const Code& code = Code::Handle(function.CurrentCode()); | 193 const Code& code = Code::Handle(function.CurrentCode()); |
194 code.Disassemble(); | 194 code.Disassemble(); |
195 THR_Print("}\n"); | 195 THR_Print("}\n"); |
196 | 196 |
| 197 #if defined(TARGET_ARCH_IA32) |
197 THR_Print("Pointer offsets for function: {\n"); | 198 THR_Print("Pointer offsets for function: {\n"); |
198 // Pointer offsets are stored in descending order. | 199 // Pointer offsets are stored in descending order. |
199 Object& obj = Object::Handle(); | 200 Object& obj = Object::Handle(); |
200 for (intptr_t i = code.pointer_offsets_length() - 1; i >= 0; i--) { | 201 for (intptr_t i = code.pointer_offsets_length() - 1; i >= 0; i--) { |
201 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); | 202 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); |
202 obj = *reinterpret_cast<RawObject**>(addr); | 203 obj = *reinterpret_cast<RawObject**>(addr); |
203 THR_Print(" %d : %#" Px " '%s'\n", | 204 THR_Print(" %d : %#" Px " '%s'\n", |
204 code.GetPointerOffsetAt(i), addr, obj.ToCString()); | 205 code.GetPointerOffsetAt(i), addr, obj.ToCString()); |
205 } | 206 } |
206 THR_Print("}\n"); | 207 THR_Print("}\n"); |
207 | 208 |
| 209 ASSERT(ObjectPool::Handle(code.GetObjectPool()).Length() == 0); |
| 210 #else |
| 211 ASSERT(code.pointer_offsets_length() == 0); |
| 212 |
| 213 const ObjectPool& object_pool = ObjectPool::Handle(code.GetObjectPool()); |
| 214 object_pool.DebugPrint(); |
| 215 #endif |
| 216 |
208 THR_Print("PC Descriptors for function '%s' {\n", function_fullname); | 217 THR_Print("PC Descriptors for function '%s' {\n", function_fullname); |
209 PcDescriptors::PrintHeaderString(); | 218 PcDescriptors::PrintHeaderString(); |
210 const PcDescriptors& descriptors = | 219 const PcDescriptors& descriptors = |
211 PcDescriptors::Handle(code.pc_descriptors()); | 220 PcDescriptors::Handle(code.pc_descriptors()); |
212 THR_Print("%s}\n", descriptors.ToCString()); | 221 THR_Print("%s}\n", descriptors.ToCString()); |
213 | 222 |
214 uword start = Instructions::Handle(code.instructions()).EntryPoint(); | 223 uword start = Instructions::Handle(code.instructions()).EntryPoint(); |
215 const Array& deopt_table = Array::Handle(code.deopt_info_array()); | 224 const Array& deopt_table = Array::Handle(code.deopt_info_array()); |
216 intptr_t deopt_table_length = DeoptTable::GetLength(deopt_table); | 225 intptr_t deopt_table_length = DeoptTable::GetLength(deopt_table); |
217 if (deopt_table_length > 0) { | 226 if (deopt_table_length > 0) { |
218 THR_Print("DeoptInfo: {\n"); | 227 THR_Print("DeoptInfo: {\n"); |
219 Smi& offset = Smi::Handle(); | 228 Smi& offset = Smi::Handle(); |
220 TypedData& info = TypedData::Handle(); | 229 TypedData& info = TypedData::Handle(); |
221 Smi& reason_and_flags = Smi::Handle(); | 230 Smi& reason_and_flags = Smi::Handle(); |
222 for (intptr_t i = 0; i < deopt_table_length; ++i) { | 231 for (intptr_t i = 0; i < deopt_table_length; ++i) { |
223 DeoptTable::GetEntry(deopt_table, i, &offset, &info, &reason_and_flags); | 232 DeoptTable::GetEntry(deopt_table, i, &offset, &info, &reason_and_flags); |
224 const intptr_t reason = | 233 const intptr_t reason = |
225 DeoptTable::ReasonField::decode(reason_and_flags.Value()); | 234 DeoptTable::ReasonField::decode(reason_and_flags.Value()); |
226 ASSERT((0 <= reason) && (reason < ICData::kDeoptNumReasons)); | 235 ASSERT((0 <= reason) && (reason < ICData::kDeoptNumReasons)); |
227 THR_Print("%4" Pd ": 0x%" Px " %s (%s)\n", | 236 THR_Print("%4" Pd ": 0x%" Px " %s (%s)\n", |
228 i, | 237 i, |
229 start + offset.Value(), | 238 start + offset.Value(), |
230 DeoptInfo::ToCString(deopt_table, info), | 239 DeoptInfo::ToCString(deopt_table, info), |
231 DeoptReasonToCString( | 240 DeoptReasonToCString( |
232 static_cast<ICData::DeoptReasonId>(reason))); | 241 static_cast<ICData::DeoptReasonId>(reason))); |
233 } | 242 } |
234 THR_Print("}\n"); | 243 THR_Print("}\n"); |
235 } | 244 } |
236 | 245 |
237 const ObjectPool& object_pool = ObjectPool::Handle(code.GetObjectPool()); | |
238 object_pool.DebugPrint(); | |
239 | |
240 THR_Print("Stackmaps for function '%s' {\n", function_fullname); | 246 THR_Print("Stackmaps for function '%s' {\n", function_fullname); |
241 if (code.stackmaps() != Array::null()) { | 247 if (code.stackmaps() != Array::null()) { |
242 const Array& stackmap_table = Array::Handle(code.stackmaps()); | 248 const Array& stackmap_table = Array::Handle(code.stackmaps()); |
243 Stackmap& map = Stackmap::Handle(); | 249 Stackmap& map = Stackmap::Handle(); |
244 for (intptr_t i = 0; i < stackmap_table.Length(); ++i) { | 250 for (intptr_t i = 0; i < stackmap_table.Length(); ++i) { |
245 map ^= stackmap_table.At(i); | 251 map ^= stackmap_table.At(i); |
246 THR_Print("%s\n", map.ToCString()); | 252 THR_Print("%s\n", map.ToCString()); |
247 } | 253 } |
248 } | 254 } |
249 THR_Print("}\n"); | 255 THR_Print("}\n"); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 THR_Print("}\n"); | 327 THR_Print("}\n"); |
322 } | 328 } |
323 if (optimized && FLAG_trace_inlining_intervals) { | 329 if (optimized && FLAG_trace_inlining_intervals) { |
324 code.DumpInlinedIntervals(); | 330 code.DumpInlinedIntervals(); |
325 } | 331 } |
326 } | 332 } |
327 | 333 |
328 #endif // !PRODUCT | 334 #endif // !PRODUCT |
329 | 335 |
330 } // namespace dart | 336 } // namespace dart |
OLD | NEW |