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

Unified Diff: src/debug.cc

Issue 462413003: Move Promise tracking from debug to isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: move assertions 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 2ae8630885b804640cd77f5e4363b62cfd5db8a6..d974cd70026836bb2fc6d08aefd278638e878092 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -568,7 +568,6 @@ void Debug::ThreadInit() {
// TODO(isolates): frames_are_dropped_?
thread_local_.current_debug_scope_ = NULL;
thread_local_.restarter_frame_function_pointer_ = NULL;
- thread_local_.promise_on_stack_ = NULL;
}
@@ -855,9 +854,6 @@ void Debug::Unload() {
ClearAllBreakPoints();
ClearStepping();
- // Match unmatched PopPromise calls.
- while (thread_local_.promise_on_stack_) PopPromise();
-
// Return debugger is not loaded.
if (!is_loaded()) return;
@@ -1272,57 +1268,6 @@ bool Debug::IsBreakOnException(ExceptionBreakType type) {
}
-PromiseOnStack::PromiseOnStack(Isolate* isolate, PromiseOnStack* prev,
- Handle<JSObject> promise)
- : isolate_(isolate), prev_(prev) {
- handler_ = StackHandler::FromAddress(
- Isolate::handler(isolate->thread_local_top()));
- promise_ =
- Handle<JSObject>::cast(isolate->global_handles()->Create(*promise));
-}
-
-
-PromiseOnStack::~PromiseOnStack() {
- isolate_->global_handles()->Destroy(
- Handle<Object>::cast(promise_).location());
-}
-
-
-void Debug::PushPromise(Handle<JSObject> promise) {
- PromiseOnStack* prev = thread_local_.promise_on_stack_;
- thread_local_.promise_on_stack_ = new PromiseOnStack(isolate_, prev, promise);
-}
-
-
-void Debug::PopPromise() {
- if (thread_local_.promise_on_stack_ == NULL) return;
- PromiseOnStack* prev = thread_local_.promise_on_stack_->prev();
- delete thread_local_.promise_on_stack_;
- thread_local_.promise_on_stack_ = prev;
-}
-
-
-Handle<Object> Debug::GetPromiseOnStackOnThrow() {
- Handle<Object> undefined = isolate_->factory()->undefined_value();
- if (thread_local_.promise_on_stack_ == NULL) return undefined;
- StackHandler* promise_try = thread_local_.promise_on_stack_->handler();
- // Find the top-most try-catch handler.
- StackHandler* handler = StackHandler::FromAddress(
- Isolate::handler(isolate_->thread_local_top()));
- do {
- if (handler == promise_try) {
- // Mark the pushed try-catch handler to prevent a later duplicate event
- // triggered with the following reject.
- return thread_local_.promise_on_stack_->promise();
- }
- handler = handler->next();
- // Throwing inside a Promise can be intercepted by an inner try-catch, so
- // we stop at the first try-catch handler.
- } while (handler != NULL && !handler->is_catch());
- return undefined;
-}
-
-
bool Debug::PromiseHasRejectHandler(Handle<JSObject> promise) {
Handle<JSFunction> fun = Handle<JSFunction>::cast(
JSObject::GetDataProperty(isolate_->js_builtins_object(),
@@ -2567,7 +2512,7 @@ MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) {
void Debug::OnThrow(Handle<Object> exception, bool uncaught) {
if (in_debug_scope() || ignore_events()) return;
HandleScope scope(isolate_);
- OnException(exception, uncaught, GetPromiseOnStackOnThrow());
+ OnException(exception, uncaught, isolate_->GetPromiseOnStackOnThrow());
}
« no previous file with comments | « src/debug.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698