| 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 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 // time. | 1614 // time. |
| 1615 if (IsCalleeFrameOf(thread->saved_stack_limit(), stack_pos)) { | 1615 if (IsCalleeFrameOf(thread->saved_stack_limit(), stack_pos)) { |
| 1616 // Use the preallocated stack overflow exception to avoid calling | 1616 // Use the preallocated stack overflow exception to avoid calling |
| 1617 // into dart code. | 1617 // into dart code. |
| 1618 const Instance& exception = | 1618 const Instance& exception = |
| 1619 Instance::Handle(isolate->object_store()->stack_overflow()); | 1619 Instance::Handle(isolate->object_store()->stack_overflow()); |
| 1620 Exceptions::Throw(thread, exception); | 1620 Exceptions::Throw(thread, exception); |
| 1621 UNREACHABLE(); | 1621 UNREACHABLE(); |
| 1622 } | 1622 } |
| 1623 | 1623 |
| 1624 #if !defined(PRODUCT) |
| 1624 // The following code is used to stress test deoptimization and | 1625 // The following code is used to stress test deoptimization and |
| 1625 // debugger stack tracing. | 1626 // debugger stack tracing. |
| 1626 bool do_deopt = false; | 1627 bool do_deopt = false; |
| 1627 bool do_stacktrace = false; | 1628 bool do_stacktrace = false; |
| 1628 bool do_reload = false; | 1629 bool do_reload = false; |
| 1629 const intptr_t isolate_reload_every = | 1630 const intptr_t isolate_reload_every = |
| 1630 isolate->reload_every_n_stack_overflow_checks(); | 1631 isolate->reload_every_n_stack_overflow_checks(); |
| 1631 if ((FLAG_deoptimize_every > 0) || (FLAG_stacktrace_every > 0) || | 1632 if ((FLAG_deoptimize_every > 0) || (FLAG_stacktrace_every > 0) || |
| 1632 (isolate_reload_every > 0)) { | 1633 (isolate_reload_every > 0)) { |
| 1633 // TODO(turnidge): To make --deoptimize_every and | 1634 // TODO(turnidge): To make --deoptimize_every and |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 OS::PrintErr("*** Computing stacktrace (%s)\n", | 1672 OS::PrintErr("*** Computing stacktrace (%s)\n", |
| 1672 function.ToFullyQualifiedCString()); | 1673 function.ToFullyQualifiedCString()); |
| 1673 do_stacktrace = true; | 1674 do_stacktrace = true; |
| 1674 } | 1675 } |
| 1675 } | 1676 } |
| 1676 if (do_deopt) { | 1677 if (do_deopt) { |
| 1677 // TODO(turnidge): Consider using DeoptimizeAt instead. | 1678 // TODO(turnidge): Consider using DeoptimizeAt instead. |
| 1678 DeoptimizeFunctionsOnStack(); | 1679 DeoptimizeFunctionsOnStack(); |
| 1679 } | 1680 } |
| 1680 if (do_reload) { | 1681 if (do_reload) { |
| 1681 #ifndef PRODUCT | |
| 1682 JSONStream js; | 1682 JSONStream js; |
| 1683 // Maybe adjust the rate of future reloads. | 1683 // Maybe adjust the rate of future reloads. |
| 1684 isolate->MaybeIncreaseReloadEveryNStackOverflowChecks(); | 1684 isolate->MaybeIncreaseReloadEveryNStackOverflowChecks(); |
| 1685 // Issue a reload. | 1685 // Issue a reload. |
| 1686 bool success = isolate->ReloadSources(&js, true /* force_reload */); | 1686 bool success = isolate->ReloadSources(&js, true /* force_reload */); |
| 1687 if (!success) { | 1687 if (!success) { |
| 1688 FATAL1("*** Isolate reload failed:\n%s\n", js.ToCString()); | 1688 FATAL1("*** Isolate reload failed:\n%s\n", js.ToCString()); |
| 1689 } | 1689 } |
| 1690 #endif | |
| 1691 } | 1690 } |
| 1692 #if !defined(PRODUCT) | |
| 1693 if (do_stacktrace) { | 1691 if (do_stacktrace) { |
| 1694 String& var_name = String::Handle(); | 1692 String& var_name = String::Handle(); |
| 1695 Instance& var_value = Instance::Handle(); | 1693 Instance& var_value = Instance::Handle(); |
| 1696 // Collecting the stack trace and accessing local variables | 1694 // Collecting the stack trace and accessing local variables |
| 1697 // of frames may trigger parsing of functions to compute | 1695 // of frames may trigger parsing of functions to compute |
| 1698 // variable descriptors of functions. Parsing may trigger | 1696 // variable descriptors of functions. Parsing may trigger |
| 1699 // code execution, e.g. to compute compile-time constants. Thus, | 1697 // code execution, e.g. to compute compile-time constants. Thus, |
| 1700 // disable FLAG_stacktrace_every during trace collection to prevent | 1698 // disable FLAG_stacktrace_every during trace collection to prevent |
| 1701 // recursive stack trace collection. | 1699 // recursive stack trace collection. |
| 1702 intptr_t saved_stacktrace_every = FLAG_stacktrace_every; | 1700 intptr_t saved_stacktrace_every = FLAG_stacktrace_every; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 true /* is_float */, | 2363 true /* is_float */, |
| 2366 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&tan))); | 2364 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&tan))); |
| 2367 | 2365 |
| 2368 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | 2366 DEFINE_RAW_LEAF_RUNTIME_ENTRY( |
| 2369 LibcAtan, | 2367 LibcAtan, |
| 2370 1, | 2368 1, |
| 2371 true /* is_float */, | 2369 true /* is_float */, |
| 2372 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&atan))); | 2370 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&atan))); |
| 2373 | 2371 |
| 2374 } // namespace dart | 2372 } // namespace dart |
| OLD | NEW |