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" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/conversions.h" | 12 #include "src/conversions.h" |
13 #include "src/debug/debug.h" | 13 #include "src/debug/debug.h" |
| 14 #include "src/elements.h" |
14 #include "src/frames-inl.h" | 15 #include "src/frames-inl.h" |
15 #include "src/isolate-inl.h" | 16 #include "src/isolate-inl.h" |
16 #include "src/messages.h" | 17 #include "src/messages.h" |
17 #include "src/parsing/parse-info.h" | 18 #include "src/parsing/parse-info.h" |
18 #include "src/parsing/parser.h" | 19 #include "src/parsing/parser.h" |
19 #include "src/wasm/wasm-module.h" | 20 #include "src/wasm/wasm-module.h" |
20 | 21 |
21 namespace v8 { | 22 namespace v8 { |
22 namespace internal { | 23 namespace internal { |
23 | 24 |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 if (args[0]->IsString()) | 567 if (args[0]->IsString()) |
567 std::fclose(f); | 568 std::fclose(f); |
568 else | 569 else |
569 std::fflush(f); | 570 std::fflush(f); |
570 return isolate->heap()->undefined_value(); | 571 return isolate->heap()->undefined_value(); |
571 } | 572 } |
572 } | 573 } |
573 | 574 |
574 RUNTIME_FUNCTION(Runtime_EnqueuePromiseReactionJob) { | 575 RUNTIME_FUNCTION(Runtime_EnqueuePromiseReactionJob) { |
575 HandleScope scope(isolate); | 576 HandleScope scope(isolate); |
576 DCHECK(args.length() == 5); | 577 DCHECK(args.length() == 4); |
577 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 578 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); |
578 CONVERT_ARG_HANDLE_CHECKED(Object, tasks, 1); | 579 CONVERT_ARG_HANDLE_CHECKED(Object, tasks, 1); |
579 CONVERT_ARG_HANDLE_CHECKED(Object, deferred, 2); | 580 CONVERT_ARG_HANDLE_CHECKED(Object, deferred, 2); |
580 CONVERT_ARG_HANDLE_CHECKED(Object, debug_id, 3); | 581 CONVERT_ARG_HANDLE_CHECKED(Object, status, 3); |
581 CONVERT_ARG_HANDLE_CHECKED(Object, debug_name, 4); | 582 Handle<Object> debug_id = isolate->factory()->undefined_value(); |
| 583 Handle<Object> debug_name = isolate->factory()->undefined_value(); |
| 584 if (isolate->debug()->is_active()) { |
| 585 Handle<Object> argv[] = {deferred, status}; |
| 586 MaybeHandle<Object> maybe_result = Execution::TryCall( |
| 587 isolate, isolate->promise_debug_get_info(), |
| 588 isolate->factory()->undefined_value(), arraysize(argv), argv); |
| 589 Handle<Object> result; |
| 590 if ((maybe_result).ToHandle(&result)) { |
| 591 CHECK(result->IsJSArray()); |
| 592 Handle<JSArray> array = Handle<JSArray>::cast(result); |
| 593 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 594 DCHECK(accessor->HasElement(array, 0)); |
| 595 DCHECK(accessor->HasElement(array, 1)); |
| 596 debug_id = accessor->Get(array, 0); |
| 597 debug_name = accessor->Get(array, 1); |
| 598 } |
| 599 } |
582 Handle<PromiseReactionJobInfo> info = | 600 Handle<PromiseReactionJobInfo> info = |
583 isolate->factory()->NewPromiseReactionJobInfo(value, tasks, deferred, | 601 isolate->factory()->NewPromiseReactionJobInfo(value, tasks, deferred, |
584 debug_id, debug_name, | 602 debug_id, debug_name, |
585 isolate->native_context()); | 603 isolate->native_context()); |
586 isolate->EnqueueMicrotask(info); | 604 isolate->EnqueueMicrotask(info); |
587 return isolate->heap()->undefined_value(); | 605 return isolate->heap()->undefined_value(); |
588 } | 606 } |
589 | 607 |
590 RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) { | 608 RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) { |
591 HandleScope scope(isolate); | 609 HandleScope scope(isolate); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 | 667 |
650 RUNTIME_FUNCTION(Runtime_Typeof) { | 668 RUNTIME_FUNCTION(Runtime_Typeof) { |
651 HandleScope scope(isolate); | 669 HandleScope scope(isolate); |
652 DCHECK_EQ(1, args.length()); | 670 DCHECK_EQ(1, args.length()); |
653 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 671 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
654 return *Object::TypeOf(isolate, object); | 672 return *Object::TypeOf(isolate, object); |
655 } | 673 } |
656 | 674 |
657 } // namespace internal | 675 } // namespace internal |
658 } // namespace v8 | 676 } // namespace v8 |
OLD | NEW |