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 MaybeHandle<Object> maybe_result, maybe_exception; | |
adamk
2016/10/25 11:05:30
Looks like you don't use maybe_exception, so I'd j
gsathya
2016/10/25 11:12:30
Done.
| |
586 Handle<Object> argv[] = {deferred, status}; | |
587 maybe_result = | |
588 Execution::TryCall(isolate, isolate->promise_debug_get_info(), | |
589 isolate->factory()->undefined_value(), | |
590 arraysize(argv), argv, &maybe_exception); | |
591 Handle<Object> result; | |
592 if ((maybe_result).ToHandle(&result) && result->IsJSArray()) { | |
adamk
2016/10/25 11:05:30
No need for the parens around maybe_result.
Can w
gsathya
2016/10/25 11:12:31
Done.
| |
593 Handle<JSArray> array = Handle<JSArray>::cast(result); | |
594 ElementsAccessor* accessor = array->GetElementsAccessor(); | |
595 DCHECK(accessor->HasElement(array, 0)); | |
596 DCHECK(accessor->HasElement(array, 1)); | |
597 debug_id = accessor->Get(array, 0); | |
598 debug_name = accessor->Get(array, 1); | |
599 } | |
600 } | |
582 Handle<PromiseReactionJobInfo> info = | 601 Handle<PromiseReactionJobInfo> info = |
583 isolate->factory()->NewPromiseReactionJobInfo(value, tasks, deferred, | 602 isolate->factory()->NewPromiseReactionJobInfo(value, tasks, deferred, |
584 debug_id, debug_name, | 603 debug_id, debug_name, |
585 isolate->native_context()); | 604 isolate->native_context()); |
586 isolate->EnqueueMicrotask(info); | 605 isolate->EnqueueMicrotask(info); |
587 return isolate->heap()->undefined_value(); | 606 return isolate->heap()->undefined_value(); |
588 } | 607 } |
589 | 608 |
590 RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) { | 609 RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) { |
591 HandleScope scope(isolate); | 610 HandleScope scope(isolate); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
649 | 668 |
650 RUNTIME_FUNCTION(Runtime_Typeof) { | 669 RUNTIME_FUNCTION(Runtime_Typeof) { |
651 HandleScope scope(isolate); | 670 HandleScope scope(isolate); |
652 DCHECK_EQ(1, args.length()); | 671 DCHECK_EQ(1, args.length()); |
653 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 672 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
654 return *Object::TypeOf(isolate, object); | 673 return *Object::TypeOf(isolate, object); |
655 } | 674 } |
656 | 675 |
657 } // namespace internal | 676 } // namespace internal |
658 } // namespace v8 | 677 } // namespace v8 |
OLD | NEW |