Actually fix the memory leak in debugger wrt promises.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 26 May 2014 11:40:34 +0000 (11:40 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 26 May 2014 11:40:34 +0000 (11:40 +0000)
In the fuzz test the debugger is not actually loaded...

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/304453003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21491 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/debug.cc

index b4421d6..80f993b 100644 (file)
@@ -807,15 +807,15 @@ bool Debug::Load() {
 void Debug::Unload() {
   ClearAllBreakPoints();
 
+  // Match unmatched PromiseHandlePrologue calls.
+  while (thread_local_.promise_on_stack_) PromiseHandleEpilogue();
+
   // Return debugger is not loaded.
   if (!IsLoaded()) return;
 
   // Clear the script cache.
   DestroyScriptCache();
 
-  // Match unmatched PromiseHandlePrologue calls.
-  while (thread_local_.promise_on_stack_) PromiseHandleEpilogue();
-
   // Clear debugger context global handle.
   GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location());
   debug_context_ = Handle<Context>();