| 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 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/debug/debug.h" | 7 #include "src/debug/debug.h" |
| 8 #include "src/elements.h" | 8 #include "src/elements.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); | 21 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
| 22 // Do not report if we actually have a handler. | 22 // Do not report if we actually have a handler. |
| 23 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate)) { | 23 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate)) { |
| 24 isolate->ReportPromiseReject(Handle<JSObject>::cast(promise), value, | 24 isolate->ReportPromiseReject(Handle<JSObject>::cast(promise), value, |
| 25 v8::kPromiseRejectWithNoHandler); | 25 v8::kPromiseRejectWithNoHandler); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { | |
| 32 DCHECK(args.length() == 3); | |
| 33 HandleScope scope(isolate); | |
| 34 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | |
| 35 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | |
| 36 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); | |
| 37 | |
| 38 PromiseRejectEvent(isolate, promise, promise, value, debug_event); | |
| 39 return isolate->heap()->undefined_value(); | |
| 40 } | |
| 41 | |
| 42 RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) { | 31 RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) { |
| 43 DCHECK(args.length() == 2); | 32 DCHECK(args.length() == 2); |
| 44 HandleScope scope(isolate); | 33 HandleScope scope(isolate); |
| 45 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 34 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
| 46 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 35 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 47 | 36 |
| 48 Handle<Object> rejected_promise = promise; | 37 Handle<Object> rejected_promise = promise; |
| 49 if (isolate->debug()->is_active()) { | 38 if (isolate->debug()->is_active()) { |
| 50 // If the Promise.reject call is caught, then this will return | 39 // If the Promise.reject call is caught, then this will return |
| 51 // undefined, which will be interpreted by PromiseRejectEvent | 40 // undefined, which will be interpreted by PromiseRejectEvent |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 174 |
| 186 RUNTIME_FUNCTION(Runtime_RunMicrotasks) { | 175 RUNTIME_FUNCTION(Runtime_RunMicrotasks) { |
| 187 HandleScope scope(isolate); | 176 HandleScope scope(isolate); |
| 188 DCHECK(args.length() == 0); | 177 DCHECK(args.length() == 0); |
| 189 isolate->RunMicrotasks(); | 178 isolate->RunMicrotasks(); |
| 190 return isolate->heap()->undefined_value(); | 179 return isolate->heap()->undefined_value(); |
| 191 } | 180 } |
| 192 | 181 |
| 193 } // namespace internal | 182 } // namespace internal |
| 194 } // namespace v8 | 183 } // namespace v8 |
| OLD | NEW |