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

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

Issue 243583008: Undo r35207 (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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
14 13
15 namespace dart { 14 namespace dart {
16 15
17 DEFINE_FLAG(bool, compress_deopt_info, true, 16 DEFINE_FLAG(bool, compress_deopt_info, true,
18 "Compress the size of the deoptimization info for optimized code."); 17 "Compress the size of the deoptimization info for optimized code.");
19 DECLARE_FLAG(bool, trace_deoptimization); 18 DECLARE_FLAG(bool, trace_deoptimization);
20 DECLARE_FLAG(bool, trace_deoptimization_verbose); 19 DECLARE_FLAG(bool, trace_deoptimization_verbose);
21 20
22 21
23 DeoptContext::DeoptContext(const StackFrame* frame, 22 DeoptContext::DeoptContext(const StackFrame* frame,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 FillDeferredSlots(this, &deferred_object_refs_); 332 FillDeferredSlots(this, &deferred_object_refs_);
334 333
335 // Compute total number of artificial arguments used during deoptimization. 334 // Compute total number of artificial arguments used during deoptimization.
336 intptr_t deopt_arg_count = 0; 335 intptr_t deopt_arg_count = 0;
337 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) { 336 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) {
338 deopt_arg_count += GetDeferredObject(i)->ArgumentCount(); 337 deopt_arg_count += GetDeferredObject(i)->ArgumentCount();
339 } 338 }
340 339
341 // Since this is the only step where GC can occur during deoptimization, 340 // Since this is the only step where GC can occur during deoptimization,
342 // use it to report the source line where deoptimization occured. 341 // use it to report the source line where deoptimization occured.
343 const Code& code = Code::Handle(code_);
344 ASSERT(!code.IsNull());
345 const Function& top_function = Function::Handle(code.function());
346 // TODO(johnmccutchan): Enable appending service objects to a trace message.
347 // Once that is possible, add the Code object which was deoptimized.
348 top_function.log()->TraceF("Deoptimized (reason %" Pd " '%s')",
349 static_cast<intptr_t>(deopt_reason()),
350 DeoptReasonToText(deopt_reason()));
351
352 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 342 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
353 DartFrameIterator iterator; 343 DartFrameIterator iterator;
354 StackFrame* top_frame = iterator.NextFrame(); 344 StackFrame* top_frame = iterator.NextFrame();
355 ASSERT(top_frame != NULL); 345 ASSERT(top_frame != NULL);
346 const Code& code = Code::Handle(top_frame->LookupDartCode());
347 const Function& top_function = Function::Handle(code.function());
356 const Script& script = Script::Handle(top_function.script()); 348 const Script& script = Script::Handle(top_function.script());
357 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); 349 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc());
358 intptr_t line, column; 350 intptr_t line, column;
359 script.GetTokenLocation(token_pos, &line, &column); 351 script.GetTokenLocation(token_pos, &line, &column);
360 String& line_string = String::Handle(script.GetLine(line)); 352 String& line_string = String::Handle(script.GetLine(line));
361 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); 353 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString());
362 OS::PrintErr(" Line %" Pd ": '%s'\n", line, line_string.ToCString()); 354 OS::PrintErr(" Line %" Pd ": '%s'\n", line, line_string.ToCString());
363 OS::PrintErr(" Deopt args: %" Pd "\n", deopt_arg_count); 355 OS::PrintErr(" Deopt args: %" Pd "\n", deopt_arg_count);
364 top_function.log()->TraceF("Deoptimized at line %" Pd ": '%s'",
365 line,
366 line_string.ToCString());
367 } 356 }
368 357
369 return deopt_arg_count; 358 return deopt_arg_count;
370 } 359 }
371 360
372 361
373 RawArray* DeoptContext::DestFrameAsArray() { 362 RawArray* DeoptContext::DestFrameAsArray() {
374 ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_); 363 ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_);
375 const Array& dest_array = 364 const Array& dest_array =
376 Array::Handle(Array::New(dest_frame_size_)); 365 Array::Handle(Array::New(dest_frame_size_));
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 Smi* offset, 1477 Smi* offset,
1489 DeoptInfo* info, 1478 DeoptInfo* info,
1490 Smi* reason) { 1479 Smi* reason) {
1491 intptr_t i = index * kEntrySize; 1480 intptr_t i = index * kEntrySize;
1492 *offset ^= table.At(i); 1481 *offset ^= table.At(i);
1493 *info ^= table.At(i + 1); 1482 *info ^= table.At(i + 1);
1494 *reason ^= table.At(i + 2); 1483 *reason ^= table.At(i + 2);
1495 } 1484 }
1496 1485
1497 } // namespace dart 1486 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698