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