OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/runtime_entry.h" | 5 #include "vm/runtime_entry.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/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } | 763 } |
764 | 764 |
765 // Result of an invoke may be an unhandled exception, in which case we | 765 // Result of an invoke may be an unhandled exception, in which case we |
766 // rethrow it. | 766 // rethrow it. |
767 static void CheckResultError(const Object& result) { | 767 static void CheckResultError(const Object& result) { |
768 if (result.IsError()) { | 768 if (result.IsError()) { |
769 Exceptions::PropagateError(Error::Cast(result)); | 769 Exceptions::PropagateError(Error::Cast(result)); |
770 } | 770 } |
771 } | 771 } |
772 | 772 |
773 #if !defined(TARGET_ARCH_DBC) | 773 #if defined(PRODUCT) |
| 774 DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) { |
| 775 UNREACHABLE(); |
| 776 return; |
| 777 } |
| 778 #elif !defined(TARGET_ARCH_DBC) |
774 // Gets called from debug stub when code reaches a breakpoint | 779 // Gets called from debug stub when code reaches a breakpoint |
775 // set on a runtime stub call. | 780 // set on a runtime stub call. |
776 DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) { | 781 DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) { |
777 if (!FLAG_support_debugger) { | |
778 UNREACHABLE(); | |
779 return; | |
780 } | |
781 DartFrameIterator iterator(thread, | 782 DartFrameIterator iterator(thread, |
782 StackFrameIterator::kNoCrossThreadIteration); | 783 StackFrameIterator::kNoCrossThreadIteration); |
783 StackFrame* caller_frame = iterator.NextFrame(); | 784 StackFrame* caller_frame = iterator.NextFrame(); |
784 ASSERT(caller_frame != NULL); | 785 ASSERT(caller_frame != NULL); |
785 const Code& orig_stub = Code::Handle( | 786 const Code& orig_stub = Code::Handle( |
786 zone, isolate->debugger()->GetPatchedStubAddress(caller_frame->pc())); | 787 zone, isolate->debugger()->GetPatchedStubAddress(caller_frame->pc())); |
787 const Error& error = | 788 const Error& error = |
788 Error::Handle(zone, isolate->debugger()->PauseBreakpoint()); | 789 Error::Handle(zone, isolate->debugger()->PauseBreakpoint()); |
789 if (!error.IsNull()) { | 790 if (!error.IsNull()) { |
790 Exceptions::PropagateError(error); | 791 Exceptions::PropagateError(error); |
791 UNREACHABLE(); | 792 UNREACHABLE(); |
792 } | 793 } |
793 arguments.SetReturn(orig_stub); | 794 arguments.SetReturn(orig_stub); |
794 } | 795 } |
795 #else | 796 #else |
796 // Gets called from the simulator when the breakpoint is reached. | 797 // Gets called from the simulator when the breakpoint is reached. |
797 DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) { | 798 DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) { |
798 if (!FLAG_support_debugger) { | |
799 UNREACHABLE(); | |
800 return; | |
801 } | |
802 const Error& error = Error::Handle(isolate->debugger()->PauseBreakpoint()); | 799 const Error& error = Error::Handle(isolate->debugger()->PauseBreakpoint()); |
803 if (!error.IsNull()) { | 800 if (!error.IsNull()) { |
804 Exceptions::PropagateError(error); | 801 Exceptions::PropagateError(error); |
805 UNREACHABLE(); | 802 UNREACHABLE(); |
806 } | 803 } |
807 } | 804 } |
808 #endif // !defined(TARGET_ARCH_DBC) | 805 #endif // !defined(TARGET_ARCH_DBC) |
809 | 806 |
810 DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) { | 807 DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) { |
811 if (!FLAG_support_debugger) { | 808 #if defined(PRODUCT) |
812 UNREACHABLE(); | 809 UNREACHABLE(); |
813 return; | 810 return; |
814 } | 811 #else |
815 const Error& error = | 812 const Error& error = |
816 Error::Handle(zone, isolate->debugger()->PauseStepping()); | 813 Error::Handle(zone, isolate->debugger()->PauseStepping()); |
817 if (!error.IsNull()) { | 814 if (!error.IsNull()) { |
818 Exceptions::PropagateError(error); | 815 Exceptions::PropagateError(error); |
819 UNREACHABLE(); | 816 UNREACHABLE(); |
820 } | 817 } |
| 818 #endif |
821 } | 819 } |
822 | 820 |
823 // An instance call of the form o.f(...) could not be resolved. Check if | 821 // An instance call of the form o.f(...) could not be resolved. Check if |
824 // there is a getter with the same name. If so, invoke it. If the value is | 822 // there is a getter with the same name. If so, invoke it. If the value is |
825 // a closure, invoke it with the given arguments. If the value is a | 823 // a closure, invoke it with the given arguments. If the value is a |
826 // non-closure, attempt to invoke "call" on it. | 824 // non-closure, attempt to invoke "call" on it. |
827 static bool ResolveCallThroughGetter(const Instance& receiver, | 825 static bool ResolveCallThroughGetter(const Instance& receiver, |
828 const Class& receiver_class, | 826 const Class& receiver_class, |
829 const String& target_name, | 827 const String& target_name, |
830 const Array& arguments_descriptor, | 828 const Array& arguments_descriptor, |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 JSONStream js; | 1682 JSONStream js; |
1685 // Maybe adjust the rate of future reloads. | 1683 // Maybe adjust the rate of future reloads. |
1686 isolate->MaybeIncreaseReloadEveryNStackOverflowChecks(); | 1684 isolate->MaybeIncreaseReloadEveryNStackOverflowChecks(); |
1687 // Issue a reload. | 1685 // Issue a reload. |
1688 bool success = isolate->ReloadSources(&js, true /* force_reload */); | 1686 bool success = isolate->ReloadSources(&js, true /* force_reload */); |
1689 if (!success) { | 1687 if (!success) { |
1690 FATAL1("*** Isolate reload failed:\n%s\n", js.ToCString()); | 1688 FATAL1("*** Isolate reload failed:\n%s\n", js.ToCString()); |
1691 } | 1689 } |
1692 #endif | 1690 #endif |
1693 } | 1691 } |
1694 if (FLAG_support_debugger && do_stacktrace) { | 1692 #if !defined(PRODUCT) |
| 1693 if (do_stacktrace) { |
1695 String& var_name = String::Handle(); | 1694 String& var_name = String::Handle(); |
1696 Instance& var_value = Instance::Handle(); | 1695 Instance& var_value = Instance::Handle(); |
1697 // Collecting the stack trace and accessing local variables | 1696 // Collecting the stack trace and accessing local variables |
1698 // of frames may trigger parsing of functions to compute | 1697 // of frames may trigger parsing of functions to compute |
1699 // variable descriptors of functions. Parsing may trigger | 1698 // variable descriptors of functions. Parsing may trigger |
1700 // code execution, e.g. to compute compile-time constants. Thus, | 1699 // code execution, e.g. to compute compile-time constants. Thus, |
1701 // disable FLAG_stacktrace_every during trace collection to prevent | 1700 // disable FLAG_stacktrace_every during trace collection to prevent |
1702 // recursive stack trace collection. | 1701 // recursive stack trace collection. |
1703 intptr_t saved_stacktrace_every = FLAG_stacktrace_every; | 1702 intptr_t saved_stacktrace_every = FLAG_stacktrace_every; |
1704 FLAG_stacktrace_every = 0; | 1703 FLAG_stacktrace_every = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
1716 TokenPosition unused = TokenPosition::kNoSource; | 1715 TokenPosition unused = TokenPosition::kNoSource; |
1717 for (intptr_t v = 0; v < num_vars; v++) { | 1716 for (intptr_t v = 0; v < num_vars; v++) { |
1718 frame->VariableAt(v, &var_name, &unused, &unused, &unused, &var_value); | 1717 frame->VariableAt(v, &var_name, &unused, &unused, &unused, &var_value); |
1719 } | 1718 } |
1720 } | 1719 } |
1721 if (FLAG_stress_async_stacks) { | 1720 if (FLAG_stress_async_stacks) { |
1722 Debugger::CollectAwaiterReturnStackTrace(); | 1721 Debugger::CollectAwaiterReturnStackTrace(); |
1723 } | 1722 } |
1724 FLAG_stacktrace_every = saved_stacktrace_every; | 1723 FLAG_stacktrace_every = saved_stacktrace_every; |
1725 } | 1724 } |
| 1725 #endif // !defined(PRODUCT) |
1726 | 1726 |
1727 const Error& error = Error::Handle(thread->HandleInterrupts()); | 1727 const Error& error = Error::Handle(thread->HandleInterrupts()); |
1728 if (!error.IsNull()) { | 1728 if (!error.IsNull()) { |
1729 Exceptions::PropagateError(error); | 1729 Exceptions::PropagateError(error); |
1730 UNREACHABLE(); | 1730 UNREACHABLE(); |
1731 } | 1731 } |
1732 | 1732 |
1733 if ((stack_overflow_flags & Thread::kOsrRequest) != 0) { | 1733 if ((stack_overflow_flags & Thread::kOsrRequest) != 0) { |
1734 ASSERT(isolate->use_osr()); | 1734 ASSERT(isolate->use_osr()); |
1735 DartFrameIterator iterator(thread, | 1735 DartFrameIterator iterator(thread, |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2365 true /* is_float */, | 2365 true /* is_float */, |
2366 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&tan))); | 2366 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&tan))); |
2367 | 2367 |
2368 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | 2368 DEFINE_RAW_LEAF_RUNTIME_ENTRY( |
2369 LibcAtan, | 2369 LibcAtan, |
2370 1, | 2370 1, |
2371 true /* is_float */, | 2371 true /* is_float */, |
2372 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&atan))); | 2372 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&atan))); |
2373 | 2373 |
2374 } // namespace dart | 2374 } // namespace dart |
OLD | NEW |