| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/compiler.h" |
| 8 #include "src/debug/debug-evaluate.h" | 9 #include "src/debug/debug-evaluate.h" |
| 9 #include "src/debug/debug-frames.h" | 10 #include "src/debug/debug-frames.h" |
| 10 #include "src/debug/debug-scopes.h" | 11 #include "src/debug/debug-scopes.h" |
| 11 #include "src/debug/debug.h" | 12 #include "src/debug/debug.h" |
| 12 #include "src/debug/liveedit.h" | 13 #include "src/debug/liveedit.h" |
| 13 #include "src/frames-inl.h" | 14 #include "src/frames-inl.h" |
| 14 #include "src/globals.h" | 15 #include "src/globals.h" |
| 15 #include "src/interpreter/bytecodes.h" | 16 #include "src/interpreter/bytecodes.h" |
| 16 #include "src/interpreter/interpreter.h" | 17 #include "src/interpreter/interpreter.h" |
| 17 #include "src/isolate-inl.h" | 18 #include "src/isolate-inl.h" |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 (line == 0) ? 0 : Smi::cast(line_ends_array->get(line - 1))->value() + 1; | 1839 (line == 0) ? 0 : Smi::cast(line_ends_array->get(line - 1))->value() + 1; |
| 1839 const int end = Smi::cast(line_ends_array->get(line))->value(); | 1840 const int end = Smi::cast(line_ends_array->get(line))->value(); |
| 1840 | 1841 |
| 1841 Handle<String> source = | 1842 Handle<String> source = |
| 1842 handle(String::cast(script_handle->source()), isolate); | 1843 handle(String::cast(script_handle->source()), isolate); |
| 1843 Handle<String> str = isolate->factory()->NewSubString(source, start, end); | 1844 Handle<String> str = isolate->factory()->NewSubString(source, start, end); |
| 1844 | 1845 |
| 1845 return *str; | 1846 return *str; |
| 1846 } | 1847 } |
| 1847 | 1848 |
| 1848 // Set one shot breakpoints for the callback function that is passed to a | 1849 // On function call, depending on circumstances, prepare for stepping in, |
| 1849 // built-in function such as Array.forEach to enable stepping into the callback, | 1850 // or perform a side effect check. |
| 1850 // if we are indeed stepping and the callback is subject to debugging. | 1851 RUNTIME_FUNCTION(Runtime_DebugOnFunctionCall) { |
| 1851 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { | |
| 1852 HandleScope scope(isolate); | 1852 HandleScope scope(isolate); |
| 1853 DCHECK_EQ(1, args.length()); | 1853 DCHECK_EQ(1, args.length()); |
| 1854 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | 1854 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
| 1855 isolate->debug()->PrepareStepIn(fun); | 1855 if (isolate->debug()->last_step_action() >= StepIn) { |
| 1856 isolate->debug()->PrepareStepIn(fun); |
| 1857 } |
| 1858 if (isolate->needs_side_effect_check() && |
| 1859 !isolate->debug()->PerformSideEffectCheck(fun)) { |
| 1860 return isolate->heap()->exception(); |
| 1861 } |
| 1856 return isolate->heap()->undefined_value(); | 1862 return isolate->heap()->undefined_value(); |
| 1857 } | 1863 } |
| 1858 | 1864 |
| 1859 // Set one shot breakpoints for the suspended generator object. | 1865 // Set one shot breakpoints for the suspended generator object. |
| 1860 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInSuspendedGenerator) { | 1866 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInSuspendedGenerator) { |
| 1861 HandleScope scope(isolate); | 1867 HandleScope scope(isolate); |
| 1862 DCHECK_EQ(0, args.length()); | 1868 DCHECK_EQ(0, args.length()); |
| 1863 isolate->debug()->PrepareStepInSuspendedGenerator(); | 1869 isolate->debug()->PrepareStepInSuspendedGenerator(); |
| 1864 return isolate->heap()->undefined_value(); | 1870 return isolate->heap()->undefined_value(); |
| 1865 } | 1871 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 } | 1939 } |
| 1934 | 1940 |
| 1935 | 1941 |
| 1936 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1942 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 1937 UNIMPLEMENTED(); | 1943 UNIMPLEMENTED(); |
| 1938 return NULL; | 1944 return NULL; |
| 1939 } | 1945 } |
| 1940 | 1946 |
| 1941 } // namespace internal | 1947 } // namespace internal |
| 1942 } // namespace v8 | 1948 } // namespace v8 |
| OLD | NEW |