Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: runtime/vm/compiler.cc

Issue 10823131: Add deopt info to code object and print it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/deopt_instructions.h » ('j') | runtime/vm/flow_graph_compiler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 graph_compiler.CompileGraph(); 210 graph_compiler.CompileGraph();
211 } 211 }
212 { 212 {
213 TimerScope timer(FLAG_compiler_stats, 213 TimerScope timer(FLAG_compiler_stats,
214 &CompilerStats::codefinalizer_timer, 214 &CompilerStats::codefinalizer_timer,
215 isolate); 215 isolate);
216 const Function& function = parsed_function.function(); 216 const Function& function = parsed_function.function();
217 const Code& code = Code::Handle(Code::FinalizeCode(function, &assembler)); 217 const Code& code = Code::Handle(Code::FinalizeCode(function, &assembler));
218 code.set_is_optimized(optimized); 218 code.set_is_optimized(optimized);
219 graph_compiler.FinalizePcDescriptors(code); 219 graph_compiler.FinalizePcDescriptors(code);
220 graph_compiler.FinalizeDeoptInfo(code);
220 graph_compiler.FinalizeStackmaps(code); 221 graph_compiler.FinalizeStackmaps(code);
221 graph_compiler.FinalizeVarDescriptors(code); 222 graph_compiler.FinalizeVarDescriptors(code);
222 graph_compiler.FinalizeExceptionHandlers(code); 223 graph_compiler.FinalizeExceptionHandlers(code);
223 graph_compiler.FinalizeComments(code); 224 graph_compiler.FinalizeComments(code);
224 if (optimized) { 225 if (optimized) {
225 function.SetCode(code); 226 function.SetCode(code);
226 CodePatcher::PatchEntry(Code::Handle(function.unoptimized_code())); 227 CodePatcher::PatchEntry(Code::Handle(function.unoptimized_code()));
227 if (FLAG_trace_compiler) { 228 if (FLAG_trace_compiler) {
228 OS::Print("--> patching entry 0x%x\n", 229 OS::Print("--> patching entry 0x%x\n",
229 Code::Handle(function.unoptimized_code()).EntryPoint()); 230 Code::Handle(function.unoptimized_code()).EntryPoint());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // Pointer offsets are stored in descending order. 316 // Pointer offsets are stored in descending order.
316 for (intptr_t i = code.pointer_offsets_length() - 1; i >= 0; i--) { 317 for (intptr_t i = code.pointer_offsets_length() - 1; i >= 0; i--) {
317 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); 318 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint();
318 Object& obj = Object::Handle(); 319 Object& obj = Object::Handle();
319 obj = *reinterpret_cast<RawObject**>(addr); 320 obj = *reinterpret_cast<RawObject**>(addr);
320 OS::Print(" %" PRIdPTR " : 0x%" PRIxPTR " '%s'\n", 321 OS::Print(" %" PRIdPTR " : 0x%" PRIxPTR " '%s'\n",
321 code.GetPointerOffsetAt(i), addr, obj.ToCString()); 322 code.GetPointerOffsetAt(i), addr, obj.ToCString());
322 } 323 }
323 OS::Print("}\n"); 324 OS::Print("}\n");
324 OS::Print("PC Descriptors for function '%s' {\n", function_fullname); 325 OS::Print("PC Descriptors for function '%s' {\n", function_fullname);
325 OS::Print("pc\t\tkind\tid\ttry-ix\ttoken-index\n"); 326 OS::Print("(pc\t\tkind\t\tid\ttok-ix\ttry/deopt-ix)\n");
326 const PcDescriptors& descriptors = 327 const PcDescriptors& descriptors =
327 PcDescriptors::Handle(code.pc_descriptors()); 328 PcDescriptors::Handle(code.pc_descriptors());
328 OS::Print("%s}\n", descriptors.ToCString()); 329 OS::Print("%s\n", descriptors.ToCString());
330 OS::Print("}\n");
331 const Array& deopt_info_array = Array::Handle(code.deopt_info_array());
332 if (deopt_info_array.Length() > 0) {
333 OS::Print("DeoptInfo: {\n");
334 for (intptr_t i = 0; i < deopt_info_array.Length(); i++) {
335 OS::Print(" %d: %s\n",
336 i, Object::Handle(deopt_info_array.At(i)).ToCString());
337 }
338 OS::Print("}\n");
339 }
340 const Array& object_table = Array::Handle(code.object_table());
341 if (object_table.Length() > 0) {
342 OS::Print("Object Table: {\n");
343 for (intptr_t i = 0; i < object_table.Length(); i++) {
344 OS::Print(" %d: %s\n", i,
345 Object::Handle(object_table.At(i)).ToCString());
346 }
347 OS::Print("}\n");
348 }
329 OS::Print("Variable Descriptors for function '%s' {\n", 349 OS::Print("Variable Descriptors for function '%s' {\n",
330 function_fullname); 350 function_fullname);
331 const LocalVarDescriptors& var_descriptors = 351 const LocalVarDescriptors& var_descriptors =
332 LocalVarDescriptors::Handle(code.var_descriptors()); 352 LocalVarDescriptors::Handle(code.var_descriptors());
333 intptr_t var_desc_length = 353 intptr_t var_desc_length =
334 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); 354 var_descriptors.IsNull() ? 0 : var_descriptors.Length();
335 String& var_name = String::Handle(); 355 String& var_name = String::Handle();
336 for (intptr_t i = 0; i < var_desc_length; i++) { 356 for (intptr_t i = 0; i < var_desc_length; i++) {
337 var_name = var_descriptors.GetName(i); 357 var_name = var_descriptors.GetName(i);
338 RawLocalVarDescriptors::VarInfo var_info; 358 RawLocalVarDescriptors::VarInfo var_info;
(...skipping 13 matching lines...) Expand all
352 var_name.ToCString(), var_info.scope_id, var_info.index); 372 var_name.ToCString(), var_info.scope_id, var_info.index);
353 } 373 }
354 OS::Print(" (valid %" PRIdPTR "-%" PRIdPTR ")\n", 374 OS::Print(" (valid %" PRIdPTR "-%" PRIdPTR ")\n",
355 var_info.begin_pos, var_info.end_pos); 375 var_info.begin_pos, var_info.end_pos);
356 } 376 }
357 } 377 }
358 OS::Print("}\n"); 378 OS::Print("}\n");
359 OS::Print("Exception Handlers for function '%s' {\n", function_fullname); 379 OS::Print("Exception Handlers for function '%s' {\n", function_fullname);
360 const ExceptionHandlers& handlers = 380 const ExceptionHandlers& handlers =
361 ExceptionHandlers::Handle(code.exception_handlers()); 381 ExceptionHandlers::Handle(code.exception_handlers());
362 OS::Print("%s}\n", handlers.ToCString()); 382 OS::Print("%s\n", handlers.ToCString());
383 OS::Print("}\n");
363 } 384 }
364 isolate->set_long_jump_base(base); 385 isolate->set_long_jump_base(base);
365 return Error::null(); 386 return Error::null();
366 } else { 387 } else {
367 Error& error = Error::Handle(); 388 Error& error = Error::Handle();
368 // We got an error during compilation. 389 // We got an error during compilation.
369 error = isolate->object_store()->sticky_error(); 390 error = isolate->object_store()->sticky_error();
370 isolate->object_store()->clear_sticky_error(); 391 isolate->object_store()->clear_sticky_error();
371 isolate->set_long_jump_base(base); 392 isolate->set_long_jump_base(base);
372 return error.raw(); 393 return error.raw();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 Object& result = Object::Handle(); 504 Object& result = Object::Handle();
484 result = isolate->object_store()->sticky_error(); 505 result = isolate->object_store()->sticky_error();
485 isolate->object_store()->clear_sticky_error(); 506 isolate->object_store()->clear_sticky_error();
486 isolate->set_long_jump_base(base); 507 isolate->set_long_jump_base(base);
487 return result.raw(); 508 return result.raw();
488 } 509 }
489 UNREACHABLE(); 510 UNREACHABLE();
490 return Object::null(); 511 return Object::null();
491 } 512 }
492 513
493
494 } // namespace dart 514 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/deopt_instructions.h » ('j') | runtime/vm/flow_graph_compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698