Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: src/runtime/runtime.cc

Issue 600723005: Introduce PromiseRejectCallback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: not omit callback for Promise.reject() Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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() == 2);
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 isolate->debug()->OnPromiseReject(promise, value);
2666 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
2667 // Do not report if we actually have a handler.
2668 if (JSObject::GetDataProperty(promise, key)->IsUndefined()) {
2669 isolate->ReportPromiseReject(promise, value,
2670 v8::kPromiseRejectWithNoHandler);
2671 }
2666 return isolate->heap()->undefined_value(); 2672 return isolate->heap()->undefined_value();
2667 } 2673 }
2668 2674
2669 2675
2676 RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
2677 DCHECK(args.length() == 1);
2678 HandleScope scope(isolate);
2679 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
2680 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
2681 // At this point, no revocation has been issued before
2682 RUNTIME_ASSERT(JSObject::GetDataProperty(promise, key)->IsUndefined());
2683 isolate->ReportPromiseReject(promise, Handle<Object>(),
2684 v8::kPromiseHandlerAddedAfterReject);
2685 return isolate->heap()->undefined_value();
2686 }
2687
2688
2689 RUNTIME_FUNCTION(Runtime_PromiseHasHandlerSymbol) {
2690 DCHECK(args.length() == 0);
2691 return isolate->heap()->promise_has_handler_symbol();
2692 }
2693
2694
2670 RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) { 2695 RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) {
2671 DCHECK(args.length() == 1); 2696 DCHECK(args.length() == 1);
2672 HandleScope scope(isolate); 2697 HandleScope scope(isolate);
2673 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0); 2698 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0);
2674 isolate->debug()->OnAsyncTaskEvent(data); 2699 isolate->debug()->OnAsyncTaskEvent(data);
2675 return isolate->heap()->undefined_value(); 2700 return isolate->heap()->undefined_value();
2676 } 2701 }
2677 2702
2678 2703
2679 RUNTIME_FUNCTION(Runtime_DeleteProperty) { 2704 RUNTIME_FUNCTION(Runtime_DeleteProperty) {
(...skipping 6627 matching lines...) Expand 10 before | Expand all | Expand 10 after
9307 } 9332 }
9308 return NULL; 9333 return NULL;
9309 } 9334 }
9310 9335
9311 9336
9312 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 9337 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
9313 return &(kIntrinsicFunctions[static_cast<int>(id)]); 9338 return &(kIntrinsicFunctions[static_cast<int>(id)]);
9314 } 9339 }
9315 } 9340 }
9316 } // namespace v8::internal 9341 } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « src/runtime/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698