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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 Handle<PromiseReactionJobInfo> info = | 582 Handle<PromiseReactionJobInfo> info = |
583 isolate->factory()->NewPromiseReactionJobInfo(value, tasks, deferred, | 583 isolate->factory()->NewPromiseReactionJobInfo(value, tasks, deferred, |
584 debug_id, debug_name, | 584 debug_id, debug_name, |
585 isolate->native_context()); | 585 isolate->native_context()); |
586 isolate->EnqueueMicrotask(info); | 586 isolate->EnqueueMicrotask(info); |
587 return isolate->heap()->undefined_value(); | 587 return isolate->heap()->undefined_value(); |
588 } | 588 } |
589 | 589 |
590 RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) { | 590 RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) { |
591 HandleScope scope(isolate); | 591 HandleScope scope(isolate); |
592 DCHECK(args.length() == 6); | 592 DCHECK(args.length() == 4); |
593 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, resolution, 0); | 593 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, resolution, 0); |
594 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, then, 1); | 594 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, then, 1); |
595 CONVERT_ARG_HANDLE_CHECKED(JSFunction, resolve, 2); | 595 CONVERT_ARG_HANDLE_CHECKED(JSFunction, resolve, 2); |
596 CONVERT_ARG_HANDLE_CHECKED(JSFunction, reject, 3); | 596 CONVERT_ARG_HANDLE_CHECKED(JSFunction, reject, 3); |
597 CONVERT_ARG_HANDLE_CHECKED(Object, debug_id, 4); | 597 Handle<Object> debug_id; |
598 CONVERT_ARG_HANDLE_CHECKED(Object, debug_name, 5); | 598 Handle<Object> debug_name; |
| 599 if (isolate->debug()->is_active()) { |
| 600 debug_id = |
| 601 handle(Smi::FromInt(isolate->GetNextDebugMicrotaskId()), isolate); |
| 602 debug_name = isolate->factory()->PromiseResolveThenableJob_string(); |
| 603 isolate->debug()->OnAsyncTaskEvent(isolate->factory()->enqueue_string(), |
| 604 debug_id, |
| 605 Handle<String>::cast(debug_name)); |
| 606 } else { |
| 607 debug_id = isolate->factory()->undefined_value(); |
| 608 debug_name = isolate->factory()->undefined_value(); |
| 609 } |
599 Handle<PromiseResolveThenableJobInfo> info = | 610 Handle<PromiseResolveThenableJobInfo> info = |
600 isolate->factory()->NewPromiseResolveThenableJobInfo( | 611 isolate->factory()->NewPromiseResolveThenableJobInfo( |
601 resolution, then, resolve, reject, debug_id, debug_name); | 612 resolution, then, resolve, reject, debug_id, debug_name); |
602 isolate->EnqueueMicrotask(info); | 613 isolate->EnqueueMicrotask(info); |
603 return isolate->heap()->undefined_value(); | 614 return isolate->heap()->undefined_value(); |
604 } | 615 } |
605 | 616 |
606 RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) { | 617 RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) { |
607 HandleScope scope(isolate); | 618 HandleScope scope(isolate); |
608 DCHECK(args.length() == 1); | 619 DCHECK(args.length() == 1); |
(...skipping 29 matching lines...) Expand all Loading... |
638 | 649 |
639 RUNTIME_FUNCTION(Runtime_Typeof) { | 650 RUNTIME_FUNCTION(Runtime_Typeof) { |
640 HandleScope scope(isolate); | 651 HandleScope scope(isolate); |
641 DCHECK_EQ(1, args.length()); | 652 DCHECK_EQ(1, args.length()); |
642 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 653 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
643 return *Object::TypeOf(isolate, object); | 654 return *Object::TypeOf(isolate, object); |
644 } | 655 } |
645 | 656 |
646 } // namespace internal | 657 } // namespace internal |
647 } // namespace v8 | 658 } // namespace v8 |
OLD | NEW |