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

Side by Side Diff: src/runtime.cc

Issue 440773004: Trigger exception debug events on Promise reject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments Created 6 years, 4 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
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/es6/debug-promise-events.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5447 matching lines...) Expand 10 before | Expand all | Expand 10 after
5458 HandleScope scope(isolate); 5458 HandleScope scope(isolate);
5459 // When leaving the callback, step out has been activated, but not performed 5459 // When leaving the callback, step out has been activated, but not performed
5460 // if we do not leave the builtin. To be able to step into the callback 5460 // if we do not leave the builtin. To be able to step into the callback
5461 // again, we need to clear the step out at this point. 5461 // again, we need to clear the step out at this point.
5462 debug->ClearStepOut(); 5462 debug->ClearStepOut();
5463 debug->FloodWithOneShot(callback); 5463 debug->FloodWithOneShot(callback);
5464 return isolate->heap()->undefined_value(); 5464 return isolate->heap()->undefined_value();
5465 } 5465 }
5466 5466
5467 5467
5468 // The argument is a closure that is kept until the epilogue is called. 5468 RUNTIME_FUNCTION(Runtime_DebugPushPromise) {
5469 // On exception, the closure is called, which returns the promise if the
5470 // exception is considered uncaught, or undefined otherwise.
5471 RUNTIME_FUNCTION(Runtime_DebugPromiseHandlePrologue) {
5472 DCHECK(args.length() == 1); 5469 DCHECK(args.length() == 1);
5473 HandleScope scope(isolate); 5470 HandleScope scope(isolate);
5474 CONVERT_ARG_HANDLE_CHECKED(JSFunction, promise_getter, 0); 5471 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
5475 isolate->debug()->PromiseHandlePrologue(promise_getter); 5472 isolate->debug()->PushPromise(promise);
5476 return isolate->heap()->undefined_value(); 5473 return isolate->heap()->undefined_value();
5477 } 5474 }
5478 5475
5479 5476
5480 RUNTIME_FUNCTION(Runtime_DebugPromiseHandleEpilogue) { 5477 RUNTIME_FUNCTION(Runtime_DebugPopPromise) {
5481 DCHECK(args.length() == 0); 5478 DCHECK(args.length() == 0);
5482 SealHandleScope shs(isolate); 5479 SealHandleScope shs(isolate);
5483 isolate->debug()->PromiseHandleEpilogue(); 5480 isolate->debug()->PopPromise();
5484 return isolate->heap()->undefined_value(); 5481 return isolate->heap()->undefined_value();
5485 } 5482 }
5486 5483
5487 5484
5488 RUNTIME_FUNCTION(Runtime_DebugPromiseEvent) { 5485 RUNTIME_FUNCTION(Runtime_DebugPromiseEvent) {
5489 DCHECK(args.length() == 1); 5486 DCHECK(args.length() == 1);
5490 HandleScope scope(isolate); 5487 HandleScope scope(isolate);
5491 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0); 5488 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0);
5492 isolate->debug()->OnPromiseEvent(data); 5489 isolate->debug()->OnPromiseEvent(data);
5493 return isolate->heap()->undefined_value(); 5490 return isolate->heap()->undefined_value();
5494 } 5491 }
5495 5492
5496 5493
5494 RUNTIME_FUNCTION(Runtime_DebugPromiseRejectEvent) {
5495 DCHECK(args.length() == 2);
5496 HandleScope scope(isolate);
5497 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
5498 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
5499 isolate->debug()->OnPromiseReject(promise, value);
5500 return isolate->heap()->undefined_value();
5501 }
5502
5503
5497 RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) { 5504 RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) {
5498 DCHECK(args.length() == 1); 5505 DCHECK(args.length() == 1);
5499 HandleScope scope(isolate); 5506 HandleScope scope(isolate);
5500 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0); 5507 CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0);
5501 isolate->debug()->OnAsyncTaskEvent(data); 5508 isolate->debug()->OnAsyncTaskEvent(data);
5502 return isolate->heap()->undefined_value(); 5509 return isolate->heap()->undefined_value();
5503 } 5510 }
5504 5511
5505 5512
5506 RUNTIME_FUNCTION(Runtime_DeleteProperty) { 5513 RUNTIME_FUNCTION(Runtime_DeleteProperty) {
(...skipping 10073 matching lines...) Expand 10 before | Expand all | Expand 10 after
15580 } 15587 }
15581 return NULL; 15588 return NULL;
15582 } 15589 }
15583 15590
15584 15591
15585 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15592 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15586 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15593 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15587 } 15594 }
15588 15595
15589 } } // namespace v8::internal 15596 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/es6/debug-promise-events.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698