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/debug/debug-evaluate.h" | 8 #include "src/debug/debug-evaluate.h" |
9 #include "src/debug/debug-frames.h" | 9 #include "src/debug/debug-frames.h" |
10 #include "src/debug/debug-scopes.h" | 10 #include "src/debug/debug-scopes.h" |
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 } | 1882 } |
1883 | 1883 |
1884 | 1884 |
1885 RUNTIME_FUNCTION(Runtime_DebugPopPromise) { | 1885 RUNTIME_FUNCTION(Runtime_DebugPopPromise) { |
1886 DCHECK_EQ(0, args.length()); | 1886 DCHECK_EQ(0, args.length()); |
1887 SealHandleScope shs(isolate); | 1887 SealHandleScope shs(isolate); |
1888 isolate->PopPromise(); | 1888 isolate->PopPromise(); |
1889 return isolate->heap()->undefined_value(); | 1889 return isolate->heap()->undefined_value(); |
1890 } | 1890 } |
1891 | 1891 |
1892 RUNTIME_FUNCTION(Runtime_DebugNextMicrotaskId) { | 1892 RUNTIME_FUNCTION(Runtime_DebugNextAsyncTaskId) { |
1893 HandleScope scope(isolate); | 1893 HandleScope scope(isolate); |
1894 DCHECK_EQ(0, args.length()); | 1894 DCHECK_EQ(1, args.length()); |
1895 return Smi::FromInt(isolate->GetNextDebugMicrotaskId()); | 1895 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
| 1896 return Smi::FromInt(isolate->debug()->NextAsyncTaskId(promise)); |
1896 } | 1897 } |
1897 | 1898 |
1898 RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) { | 1899 RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionPromiseCreated) { |
1899 DCHECK_EQ(3, args.length()); | 1900 DCHECK_EQ(1, args.length()); |
1900 HandleScope scope(isolate); | 1901 HandleScope scope(isolate); |
1901 CONVERT_SMI_ARG_CHECKED(type, 0); | 1902 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
1902 CONVERT_SMI_ARG_CHECKED(id, 1); | 1903 isolate->PushPromise(promise); |
1903 CONVERT_SMI_ARG_CHECKED(name, 2); | 1904 int id = isolate->debug()->NextAsyncTaskId(promise); |
1904 isolate->debug()->OnAsyncTaskEvent(static_cast<PromiseDebugActionType>(type), | 1905 Handle<Symbol> async_stack_id_symbol = |
1905 id, | 1906 isolate->factory()->promise_async_stack_id_symbol(); |
1906 static_cast<PromiseDebugActionName>(name)); | 1907 JSObject::SetProperty(promise, async_stack_id_symbol, |
| 1908 handle(Smi::FromInt(id), isolate), STRICT) |
| 1909 .Assert(); |
| 1910 isolate->debug()->OnAsyncTaskEvent(debug::kDebugEnqueueRecurring, id, |
| 1911 kDebugAsyncFunction); |
1907 return isolate->heap()->undefined_value(); | 1912 return isolate->heap()->undefined_value(); |
1908 } | 1913 } |
1909 | 1914 |
| 1915 RUNTIME_FUNCTION(Runtime_DebugAsyncEventEnqueueRecurring) { |
| 1916 HandleScope scope(isolate); |
| 1917 DCHECK_EQ(2, args.length()); |
| 1918 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
| 1919 CONVERT_SMI_ARG_CHECKED(status, 1); |
| 1920 if (isolate->debug()->is_active()) { |
| 1921 isolate->debug()->OnAsyncTaskEvent( |
| 1922 debug::kDebugEnqueueRecurring, |
| 1923 isolate->debug()->NextAsyncTaskId(promise), |
| 1924 status == v8::Promise::kFulfilled ? kDebugPromiseResolve |
| 1925 : kDebugPromiseReject); |
| 1926 } |
| 1927 return isolate->heap()->undefined_value(); |
| 1928 } |
1910 | 1929 |
1911 RUNTIME_FUNCTION(Runtime_DebugIsActive) { | 1930 RUNTIME_FUNCTION(Runtime_DebugIsActive) { |
1912 SealHandleScope shs(isolate); | 1931 SealHandleScope shs(isolate); |
1913 return Smi::FromInt(isolate->debug()->is_active()); | 1932 return Smi::FromInt(isolate->debug()->is_active()); |
1914 } | 1933 } |
1915 | 1934 |
1916 | 1935 |
1917 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1936 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1918 UNIMPLEMENTED(); | 1937 UNIMPLEMENTED(); |
1919 return NULL; | 1938 return NULL; |
1920 } | 1939 } |
1921 | 1940 |
1922 } // namespace internal | 1941 } // namespace internal |
1923 } // namespace v8 | 1942 } // namespace v8 |
OLD | NEW |