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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 | 2650 |
2651 RUNTIME_FUNCTION(Runtime_DebugPromiseEvent) { | 2651 RUNTIME_FUNCTION(Runtime_DebugPromiseEvent) { |
2652 DCHECK(args.length() == 1); | 2652 DCHECK(args.length() == 1); |
2653 HandleScope scope(isolate); | 2653 HandleScope scope(isolate); |
2654 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0); | 2654 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0); |
2655 isolate->debug()->OnPromiseEvent(data); | 2655 isolate->debug()->OnPromiseEvent(data); |
2656 return isolate->heap()->undefined_value(); | 2656 return isolate->heap()->undefined_value(); |
2657 } | 2657 } |
2658 | 2658 |
2659 | 2659 |
2660 RUNTIME_FUNCTION(Runtime_DebugPromiseRejectEvent) { | 2660 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { |
2661 DCHECK(args.length() == 2); | 2661 DCHECK(args.length() == 3); |
2662 HandleScope scope(isolate); | 2662 HandleScope scope(isolate); |
2663 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 2663 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
2664 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 2664 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
2665 isolate->debug()->OnPromiseReject(promise, value); | 2665 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); |
| 2666 if (debug_event) isolate->debug()->OnPromiseReject(promise, value); |
| 2667 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
| 2668 // Do not report if we actually have a handler. |
| 2669 if (JSObject::GetDataProperty(promise, key)->IsUndefined()) { |
| 2670 isolate->ReportPromiseReject(promise, value, |
| 2671 v8::kPromiseRejectWithNoHandler); |
| 2672 } |
2666 return isolate->heap()->undefined_value(); | 2673 return isolate->heap()->undefined_value(); |
2667 } | 2674 } |
2668 | 2675 |
2669 | 2676 |
| 2677 RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { |
| 2678 DCHECK(args.length() == 1); |
| 2679 HandleScope scope(isolate); |
| 2680 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
| 2681 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
| 2682 // At this point, no revocation has been issued before |
| 2683 RUNTIME_ASSERT(JSObject::GetDataProperty(promise, key)->IsUndefined()); |
| 2684 isolate->ReportPromiseReject(promise, Handle<Object>(), |
| 2685 v8::kPromiseHandlerAddedAfterReject); |
| 2686 return isolate->heap()->undefined_value(); |
| 2687 } |
| 2688 |
| 2689 |
| 2690 RUNTIME_FUNCTION(Runtime_PromiseHasHandlerSymbol) { |
| 2691 DCHECK(args.length() == 0); |
| 2692 return isolate->heap()->promise_has_handler_symbol(); |
| 2693 } |
| 2694 |
| 2695 |
2670 RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) { | 2696 RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) { |
2671 DCHECK(args.length() == 1); | 2697 DCHECK(args.length() == 1); |
2672 HandleScope scope(isolate); | 2698 HandleScope scope(isolate); |
2673 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0); | 2699 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0); |
2674 isolate->debug()->OnAsyncTaskEvent(data); | 2700 isolate->debug()->OnAsyncTaskEvent(data); |
2675 return isolate->heap()->undefined_value(); | 2701 return isolate->heap()->undefined_value(); |
2676 } | 2702 } |
2677 | 2703 |
2678 | 2704 |
2679 RUNTIME_FUNCTION(Runtime_DeleteProperty) { | 2705 RUNTIME_FUNCTION(Runtime_DeleteProperty) { |
(...skipping 6627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9307 } | 9333 } |
9308 return NULL; | 9334 return NULL; |
9309 } | 9335 } |
9310 | 9336 |
9311 | 9337 |
9312 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 9338 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
9313 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 9339 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
9314 } | 9340 } |
9315 } | 9341 } |
9316 } // namespace v8::internal | 9342 } // namespace v8::internal |
OLD | NEW |