| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2974 if (debug()->is_active()) { | 2974 if (debug()->is_active()) { |
| 2975 Handle<Object> before_debug_event(container->before_debug_event(), this); | 2975 Handle<Object> before_debug_event(container->before_debug_event(), this); |
| 2976 if (before_debug_event->IsJSObject()) { | 2976 if (before_debug_event->IsJSObject()) { |
| 2977 debug()->OnAsyncTaskEvent(Handle<JSObject>::cast(before_debug_event)); | 2977 debug()->OnAsyncTaskEvent(Handle<JSObject>::cast(before_debug_event)); |
| 2978 } | 2978 } |
| 2979 } | 2979 } |
| 2980 | 2980 |
| 2981 Handle<JSReceiver> thenable(container->thenable(), this); | 2981 Handle<JSReceiver> thenable(container->thenable(), this); |
| 2982 Handle<JSFunction> resolve(container->resolve(), this); | 2982 Handle<JSFunction> resolve(container->resolve(), this); |
| 2983 Handle<JSFunction> reject(container->reject(), this); | 2983 Handle<JSFunction> reject(container->reject(), this); |
| 2984 Handle<JSFunction> then(container->then(), this); | 2984 Handle<JSReceiver> then(container->then(), this); |
| 2985 Handle<Object> argv[] = {resolve, reject}; | 2985 Handle<Object> argv[] = {resolve, reject}; |
| 2986 *result = Execution::TryCall(this, then, thenable, arraysize(argv), argv, | 2986 *result = Execution::TryCall(this, then, thenable, arraysize(argv), argv, |
| 2987 maybe_exception); | 2987 maybe_exception); |
| 2988 | 2988 |
| 2989 Handle<Object> reason; | 2989 Handle<Object> reason; |
| 2990 if (maybe_exception->ToHandle(&reason)) { | 2990 if (maybe_exception->ToHandle(&reason)) { |
| 2991 DCHECK(result->is_null()); | 2991 DCHECK(result->is_null()); |
| 2992 Handle<Object> reason_arg[] = {reason}; | 2992 Handle<Object> reason_arg[] = {reason}; |
| 2993 *result = | 2993 *result = |
| 2994 Execution::TryCall(this, reject, factory()->undefined_value(), | 2994 Execution::TryCall(this, reject, factory()->undefined_value(), |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3050 | 3050 |
| 3051 if (microtask->IsCallHandlerInfo()) { | 3051 if (microtask->IsCallHandlerInfo()) { |
| 3052 Handle<CallHandlerInfo> callback_info = | 3052 Handle<CallHandlerInfo> callback_info = |
| 3053 Handle<CallHandlerInfo>::cast(microtask); | 3053 Handle<CallHandlerInfo>::cast(microtask); |
| 3054 v8::MicrotaskCallback callback = | 3054 v8::MicrotaskCallback callback = |
| 3055 v8::ToCData<v8::MicrotaskCallback>(callback_info->callback()); | 3055 v8::ToCData<v8::MicrotaskCallback>(callback_info->callback()); |
| 3056 void* data = v8::ToCData<void*>(callback_info->data()); | 3056 void* data = v8::ToCData<void*>(callback_info->data()); |
| 3057 callback(data); | 3057 callback(data); |
| 3058 } else { | 3058 } else { |
| 3059 SaveContext save(this); | 3059 SaveContext save(this); |
| 3060 Context* context = | 3060 Context* context = microtask->IsJSFunction() |
| 3061 microtask->IsJSFunction() | 3061 ? Handle<JSFunction>::cast(microtask)->context() |
| 3062 ? Handle<JSFunction>::cast(microtask)->context() | 3062 : Handle<PromiseContainer>::cast(microtask) |
| 3063 : Handle<PromiseContainer>::cast(microtask)->then()->context(); | 3063 ->resolve() |
| 3064 ->context(); |
| 3064 set_context(context->native_context()); | 3065 set_context(context->native_context()); |
| 3065 handle_scope_implementer_->EnterMicrotaskContext( | 3066 handle_scope_implementer_->EnterMicrotaskContext( |
| 3066 Handle<Context>(context, this)); | 3067 Handle<Context>(context, this)); |
| 3067 | 3068 |
| 3068 MaybeHandle<Object> result; | 3069 MaybeHandle<Object> result; |
| 3069 MaybeHandle<Object> maybe_exception; | 3070 MaybeHandle<Object> maybe_exception; |
| 3070 | 3071 |
| 3071 if (microtask->IsJSFunction()) { | 3072 if (microtask->IsJSFunction()) { |
| 3072 Handle<JSFunction> microtask_function = | 3073 Handle<JSFunction> microtask_function = |
| 3073 Handle<JSFunction>::cast(microtask); | 3074 Handle<JSFunction>::cast(microtask); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 // Then check whether this scope intercepts. | 3268 // Then check whether this scope intercepts. |
| 3268 if ((flag & intercept_mask_)) { | 3269 if ((flag & intercept_mask_)) { |
| 3269 intercepted_flags_ |= flag; | 3270 intercepted_flags_ |= flag; |
| 3270 return true; | 3271 return true; |
| 3271 } | 3272 } |
| 3272 return false; | 3273 return false; |
| 3273 } | 3274 } |
| 3274 | 3275 |
| 3275 } // namespace internal | 3276 } // namespace internal |
| 3276 } // namespace v8 | 3277 } // namespace v8 |
| OLD | NEW |