OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/runtime/runtime-utils.h" | 4 #include "src/runtime/runtime-utils.h" |
5 | 5 |
6 #include "src/debug/debug.h" | 6 #include "src/debug/debug.h" |
7 #include "src/elements.h" | 7 #include "src/elements.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 26 matching lines...) Expand all Loading... |
37 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 37 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
38 | 38 |
39 Handle<Object> rejected_promise = promise; | 39 Handle<Object> rejected_promise = promise; |
40 if (isolate->debug()->is_active()) { | 40 if (isolate->debug()->is_active()) { |
41 // If the Promise.reject call is caught, then this will return | 41 // If the Promise.reject call is caught, then this will return |
42 // undefined, which will be interpreted by PromiseRejectEvent | 42 // undefined, which will be interpreted by PromiseRejectEvent |
43 // as being a caught exception event. | 43 // as being a caught exception event. |
44 rejected_promise = isolate->GetPromiseOnStackOnThrow(); | 44 rejected_promise = isolate->GetPromiseOnStackOnThrow(); |
45 isolate->debug()->OnAsyncTaskEvent( | 45 isolate->debug()->OnAsyncTaskEvent( |
46 debug::kDebugEnqueuePromiseReject, | 46 debug::kDebugEnqueuePromiseReject, |
47 isolate->debug()->NextAsyncTaskId(promise)); | 47 isolate->debug()->NextAsyncTaskId(promise), 0); |
48 } | 48 } |
49 PromiseRejectEvent(isolate, promise, rejected_promise, value, true); | 49 PromiseRejectEvent(isolate, promise, rejected_promise, value, true); |
50 return isolate->heap()->undefined_value(); | 50 return isolate->heap()->undefined_value(); |
51 } | 51 } |
52 | 52 |
53 RUNTIME_FUNCTION(Runtime_ReportPromiseReject) { | 53 RUNTIME_FUNCTION(Runtime_ReportPromiseReject) { |
54 DCHECK_EQ(2, args.length()); | 54 DCHECK_EQ(2, args.length()); |
55 HandleScope scope(isolate); | 55 HandleScope scope(isolate); |
56 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); | 56 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
57 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 57 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (promise->IsJSPromise()) { | 163 if (promise->IsJSPromise()) { |
164 isolate->RunPromiseHook(PromiseHookType::kAfter, | 164 isolate->RunPromiseHook(PromiseHookType::kAfter, |
165 Handle<JSPromise>::cast(promise), | 165 Handle<JSPromise>::cast(promise), |
166 isolate->factory()->undefined_value()); | 166 isolate->factory()->undefined_value()); |
167 } | 167 } |
168 return isolate->heap()->undefined_value(); | 168 return isolate->heap()->undefined_value(); |
169 } | 169 } |
170 | 170 |
171 } // namespace internal | 171 } // namespace internal |
172 } // namespace v8 | 172 } // namespace v8 |
OLD | NEW |