OLD | NEW |
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/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/disassembler.h" | 10 #include "vm/disassembler.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 if (dest_options != kDestIsAllocated) { | 118 if (dest_options != kDestIsAllocated) { |
119 // kDestIsAllocated is used by the debugger to generate a stack trace | 119 // kDestIsAllocated is used by the debugger to generate a stack trace |
120 // and does not signal a real deopt. | 120 // and does not signal a real deopt. |
121 deopt_start_micros_ = OS::GetCurrentMonotonicMicros(); | 121 deopt_start_micros_ = OS::GetCurrentMonotonicMicros(); |
122 } | 122 } |
123 | 123 |
124 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 124 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
125 THR_Print( | 125 THR_Print( |
126 "Deoptimizing (reason %d '%s') at pc %#" Px " '%s' (count %d)\n", | 126 "Deoptimizing (reason %d '%s') at " |
| 127 "pc=%" Pp " fp=%" Pp " '%s' (count %d)\n", |
127 deopt_reason(), | 128 deopt_reason(), |
128 DeoptReasonToCString(deopt_reason()), | 129 DeoptReasonToCString(deopt_reason()), |
129 frame->pc(), | 130 frame->pc(), |
| 131 frame->fp(), |
130 function.ToFullyQualifiedCString(), | 132 function.ToFullyQualifiedCString(), |
131 function.deoptimization_counter()); | 133 function.deoptimization_counter()); |
132 } | 134 } |
133 } | 135 } |
134 | 136 |
135 | 137 |
136 DeoptContext::~DeoptContext() { | 138 DeoptContext::~DeoptContext() { |
137 // Delete memory for source frame and registers. | 139 // Delete memory for source frame and registers. |
138 if (source_frame_is_allocated_) { | 140 if (source_frame_is_allocated_) { |
139 delete[] source_frame_; | 141 delete[] source_frame_; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 if (!objects_only || IsObjectInstruction(instr->kind())) { | 338 if (!objects_only || IsObjectInstruction(instr->kind())) { |
337 instr->Execute(this, to_addr); | 339 instr->Execute(this, to_addr); |
338 } else { | 340 } else { |
339 *reinterpret_cast<RawObject**>(to_addr) = Object::null(); | 341 *reinterpret_cast<RawObject**>(to_addr) = Object::null(); |
340 } | 342 } |
341 } | 343 } |
342 | 344 |
343 if (FLAG_trace_deoptimization_verbose) { | 345 if (FLAG_trace_deoptimization_verbose) { |
344 for (intptr_t i = 0; i < frame_size; i++) { | 346 for (intptr_t i = 0; i < frame_size; i++) { |
345 intptr_t* to_addr = GetDestFrameAddressAt(i); | 347 intptr_t* to_addr = GetDestFrameAddressAt(i); |
346 OS::PrintErr("*%" Pd ". [%p] 0x%" Px " [%s]\n", | 348 THR_Print("*%" Pd ". [%p] 0x%" Px " [%s]\n", |
347 i, | 349 i, |
348 to_addr, | 350 to_addr, |
349 *to_addr, | 351 *to_addr, |
350 deopt_instructions[i + (len - frame_size)]->ToCString()); | 352 deopt_instructions[i + (len - frame_size)]->ToCString()); |
351 } | 353 } |
352 } | 354 } |
353 } | 355 } |
354 | 356 |
355 | 357 |
356 static void FillDeferredSlots(DeoptContext* deopt_context, | 358 static void FillDeferredSlots(DeoptContext* deopt_context, |
357 DeferredSlot** slot_list) { | 359 DeferredSlot** slot_list) { |
358 DeferredSlot* slot = *slot_list; | 360 DeferredSlot* slot = *slot_list; |
359 *slot_list = NULL; | 361 *slot_list = NULL; |
360 | 362 |
(...skipping 30 matching lines...) Expand all Loading... |
391 DartFrameIterator iterator; | 393 DartFrameIterator iterator; |
392 StackFrame* top_frame = iterator.NextFrame(); | 394 StackFrame* top_frame = iterator.NextFrame(); |
393 ASSERT(top_frame != NULL); | 395 ASSERT(top_frame != NULL); |
394 const Code& code = Code::Handle(top_frame->LookupDartCode()); | 396 const Code& code = Code::Handle(top_frame->LookupDartCode()); |
395 const Function& top_function = Function::Handle(code.function()); | 397 const Function& top_function = Function::Handle(code.function()); |
396 const Script& script = Script::Handle(top_function.script()); | 398 const Script& script = Script::Handle(top_function.script()); |
397 const TokenPosition token_pos = code.GetTokenIndexOfPC(top_frame->pc()); | 399 const TokenPosition token_pos = code.GetTokenIndexOfPC(top_frame->pc()); |
398 intptr_t line, column; | 400 intptr_t line, column; |
399 script.GetTokenLocation(token_pos, &line, &column); | 401 script.GetTokenLocation(token_pos, &line, &column); |
400 String& line_string = String::Handle(script.GetLine(line)); | 402 String& line_string = String::Handle(script.GetLine(line)); |
401 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); | 403 THR_Print(" Function: %s\n", top_function.ToFullyQualifiedCString()); |
402 char line_buffer[80]; | 404 char line_buffer[80]; |
403 OS::SNPrint(line_buffer, sizeof(line_buffer), " Line %" Pd ": '%s'", | 405 OS::SNPrint(line_buffer, sizeof(line_buffer), " Line %" Pd ": '%s'", |
404 line, line_string.ToCString()); | 406 line, line_string.ToCString()); |
405 OS::PrintErr("%s\n", line_buffer); | 407 THR_Print("%s\n", line_buffer); |
406 OS::PrintErr(" Deopt args: %" Pd "\n", deopt_arg_count); | 408 THR_Print(" Deopt args: %" Pd "\n", deopt_arg_count); |
407 } | 409 } |
408 | 410 |
409 return deopt_arg_count; | 411 return deopt_arg_count; |
410 } | 412 } |
411 | 413 |
412 | 414 |
413 RawArray* DeoptContext::DestFrameAsArray() { | 415 RawArray* DeoptContext::DestFrameAsArray() { |
414 ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_); | 416 ASSERT(dest_frame_ != NULL && dest_frame_is_allocated_); |
415 const Array& dest_array = | 417 const Array& dest_array = |
416 Array::Handle(zone(), Array::New(dest_frame_size_)); | 418 Array::Handle(zone(), Array::New(dest_frame_size_)); |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 Smi* offset, | 1356 Smi* offset, |
1355 TypedData* info, | 1357 TypedData* info, |
1356 Smi* reason) { | 1358 Smi* reason) { |
1357 intptr_t i = index * kEntrySize; | 1359 intptr_t i = index * kEntrySize; |
1358 *offset ^= table.At(i); | 1360 *offset ^= table.At(i); |
1359 *info ^= table.At(i + 1); | 1361 *info ^= table.At(i + 1); |
1360 *reason ^= table.At(i + 2); | 1362 *reason ^= table.At(i + 2); |
1361 } | 1363 } |
1362 | 1364 |
1363 } // namespace dart | 1365 } // namespace dart |
OLD | NEW |