| 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 ASSERT(caller_frame != NULL); | 1541 ASSERT(caller_frame != NULL); |
| 1542 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode()); | 1542 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode()); |
| 1543 ASSERT(optimized_code.is_optimized()); | 1543 ASSERT(optimized_code.is_optimized()); |
| 1544 | 1544 |
| 1545 intptr_t deopt_reason = kDeoptUnknown; | 1545 intptr_t deopt_reason = kDeoptUnknown; |
| 1546 const DeoptInfo& deopt_info = DeoptInfo::Handle( | 1546 const DeoptInfo& deopt_info = DeoptInfo::Handle( |
| 1547 optimized_code.GetDeoptInfoAtPc(caller_frame->pc(), &deopt_reason)); | 1547 optimized_code.GetDeoptInfoAtPc(caller_frame->pc(), &deopt_reason)); |
| 1548 ASSERT(!deopt_info.IsNull()); | 1548 ASSERT(!deopt_info.IsNull()); |
| 1549 | 1549 |
| 1550 CopyFrame(optimized_code, *caller_frame); | 1550 CopyFrame(optimized_code, *caller_frame); |
| 1551 if (FLAG_trace_deoptimization) { | 1551 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 1552 Function& function = Function::Handle(optimized_code.function()); | 1552 Function& function = Function::Handle(optimized_code.function()); |
| 1553 OS::PrintErr( | 1553 OS::PrintErr( |
| 1554 "Deoptimizing (reason %"Pd" '%s') at pc %#"Px" '%s' (count %d)\n", | 1554 "Deoptimizing (reason %"Pd" '%s') at pc %#"Px" '%s' (count %d)\n", |
| 1555 deopt_reason, | 1555 deopt_reason, |
| 1556 DeoptReasonToText(deopt_reason), | 1556 DeoptReasonToText(deopt_reason), |
| 1557 caller_frame->pc(), | 1557 caller_frame->pc(), |
| 1558 function.ToFullyQualifiedCString(), | 1558 function.ToFullyQualifiedCString(), |
| 1559 function.deoptimization_counter()); | 1559 function.deoptimization_counter()); |
| 1560 } | 1560 } |
| 1561 | 1561 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 deopt_arguments += isolate->GetDeferredObject(i)->ArgumentCount(); | 1707 deopt_arguments += isolate->GetDeferredObject(i)->ArgumentCount(); |
| 1708 } | 1708 } |
| 1709 Isolate::Current()->DeleteDeferredObjects(); | 1709 Isolate::Current()->DeleteDeferredObjects(); |
| 1710 | 1710 |
| 1711 // Return value tells deoptimization stub to remove the given number of bytes | 1711 // Return value tells deoptimization stub to remove the given number of bytes |
| 1712 // from the stack. | 1712 // from the stack. |
| 1713 arguments.SetReturn(Smi::Handle(Smi::New(deopt_arguments * kWordSize))); | 1713 arguments.SetReturn(Smi::Handle(Smi::New(deopt_arguments * kWordSize))); |
| 1714 | 1714 |
| 1715 // Since this is the only step where GC can occur during deoptimization, | 1715 // Since this is the only step where GC can occur during deoptimization, |
| 1716 // use it to report the source line where deoptimization occured. | 1716 // use it to report the source line where deoptimization occured. |
| 1717 if (FLAG_trace_deoptimization) { | 1717 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 1718 DartFrameIterator iterator; | 1718 DartFrameIterator iterator; |
| 1719 StackFrame* top_frame = iterator.NextFrame(); | 1719 StackFrame* top_frame = iterator.NextFrame(); |
| 1720 ASSERT(top_frame != NULL); | 1720 ASSERT(top_frame != NULL); |
| 1721 const Code& code = Code::Handle(top_frame->LookupDartCode()); | 1721 const Code& code = Code::Handle(top_frame->LookupDartCode()); |
| 1722 const Function& top_function = Function::Handle(code.function()); | 1722 const Function& top_function = Function::Handle(code.function()); |
| 1723 const Script& script = Script::Handle(top_function.script()); | 1723 const Script& script = Script::Handle(top_function.script()); |
| 1724 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); | 1724 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); |
| 1725 intptr_t line, column; | 1725 intptr_t line, column; |
| 1726 script.GetTokenLocation(token_pos, &line, &column); | 1726 script.GetTokenLocation(token_pos, &line, &column); |
| 1727 String& line_string = String::Handle(script.GetLine(line)); | 1727 String& line_string = String::Handle(script.GetLine(line)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 // Arg1: Value that is being stored. | 1768 // Arg1: Value that is being stored. |
| 1769 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1769 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1770 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1770 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
| 1771 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1771 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1772 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1772 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1773 | 1773 |
| 1774 field.UpdateCid(value.GetClassId()); | 1774 field.UpdateCid(value.GetClassId()); |
| 1775 } | 1775 } |
| 1776 | 1776 |
| 1777 } // namespace dart | 1777 } // namespace dart |
| OLD | NEW |