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

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

Issue 227423005: Add TraceBuffer log to all Functions (plus small tweaks to function-view) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/deopt_instructions.h" 5 #include "vm/deopt_instructions.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/locations.h" 10 #include "vm/locations.h"
11 #include "vm/parser.h" 11 #include "vm/parser.h"
12 #include "vm/stack_frame.h" 12 #include "vm/stack_frame.h"
13 #include "vm/trace_buffer.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 DEFINE_FLAG(bool, compress_deopt_info, true, 17 DEFINE_FLAG(bool, compress_deopt_info, true,
17 "Compress the size of the deoptimization info for optimized code."); 18 "Compress the size of the deoptimization info for optimized code.");
18 DECLARE_FLAG(bool, trace_deoptimization); 19 DECLARE_FLAG(bool, trace_deoptimization);
19 DECLARE_FLAG(bool, trace_deoptimization_verbose); 20 DECLARE_FLAG(bool, trace_deoptimization_verbose);
20 21
21 22
22 DeoptContext::DeoptContext(const StackFrame* frame, 23 DeoptContext::DeoptContext(const StackFrame* frame,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 FillDeferredSlots(this, &deferred_object_refs_); 333 FillDeferredSlots(this, &deferred_object_refs_);
333 334
334 // Compute total number of artificial arguments used during deoptimization. 335 // Compute total number of artificial arguments used during deoptimization.
335 intptr_t deopt_arg_count = 0; 336 intptr_t deopt_arg_count = 0;
336 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) { 337 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) {
337 deopt_arg_count += GetDeferredObject(i)->ArgumentCount(); 338 deopt_arg_count += GetDeferredObject(i)->ArgumentCount();
338 } 339 }
339 340
340 // Since this is the only step where GC can occur during deoptimization, 341 // Since this is the only step where GC can occur during deoptimization,
341 // use it to report the source line where deoptimization occured. 342 // use it to report the source line where deoptimization occured.
343 DartFrameIterator iterator;
344 StackFrame* top_frame = iterator.NextFrame();
345 ASSERT(top_frame != NULL);
346 const Code& code = Code::Handle(top_frame->LookupDartCode());
turnidge 2014/04/14 16:41:17 Instead of using a DartFrameIterator to get the co
Cutch 2014/04/15 20:47:58 Done.
347 const Function& top_function = Function::Handle(code.function());
348 top_function.log()->TraceF("Deoptimized (reason %" Pd " '%s')",
349 static_cast<intptr_t>(deopt_reason()),
350 DeoptReasonToText(deopt_reason()));
turnidge 2014/04/14 16:41:17 We should eventually include which code object was
Cutch 2014/04/15 20:47:58 Done.
351
342 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 352 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
343 DartFrameIterator iterator;
344 StackFrame* top_frame = iterator.NextFrame();
345 ASSERT(top_frame != NULL);
346 const Code& code = Code::Handle(top_frame->LookupDartCode());
347 const Function& top_function = Function::Handle(code.function());
348 const Script& script = Script::Handle(top_function.script()); 353 const Script& script = Script::Handle(top_function.script());
349 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); 354 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc());
350 intptr_t line, column; 355 intptr_t line, column;
351 script.GetTokenLocation(token_pos, &line, &column); 356 script.GetTokenLocation(token_pos, &line, &column);
352 String& line_string = String::Handle(script.GetLine(line)); 357 String& line_string = String::Handle(script.GetLine(line));
353 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); 358 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString());
354 OS::PrintErr(" Line %" Pd ": '%s'\n", line, line_string.ToCString()); 359 OS::PrintErr(" Line %" Pd ": '%s'\n", line, line_string.ToCString());
355 OS::PrintErr(" Deopt args: %" Pd "\n", deopt_arg_count); 360 OS::PrintErr(" Deopt args: %" Pd "\n", deopt_arg_count);
361 top_function.log()->TraceF("Deoptimized at line %" Pd ": '%s'",
362 line,
363 line_string.ToCString());
356 } 364 }
357 365
358 return deopt_arg_count; 366 return deopt_arg_count;
359 } 367 }
360 368
361 369
362 RawArray* DeoptContext::DestFrameAsArray() { 370 RawArray* DeoptContext::DestFrameAsArray() {
363 ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_); 371 ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_);
364 const Array& dest_array = 372 const Array& dest_array =
365 Array::Handle(Array::New(dest_frame_size_)); 373 Array::Handle(Array::New(dest_frame_size_));
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 Smi* offset, 1485 Smi* offset,
1478 DeoptInfo* info, 1486 DeoptInfo* info,
1479 Smi* reason) { 1487 Smi* reason) {
1480 intptr_t i = index * kEntrySize; 1488 intptr_t i = index * kEntrySize;
1481 *offset ^= table.At(i); 1489 *offset ^= table.At(i);
1482 *info ^= table.At(i + 1); 1490 *info ^= table.At(i + 1);
1483 *reason ^= table.At(i + 2); 1491 *reason ^= table.At(i + 2);
1484 } 1492 }
1485 1493
1486 } // namespace dart 1494 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698