Просмотр исходного кода

[1.9>master] [1.8>1.9] [MERGE #4681 @leirocks] more xdata fix for debugger attaching/detaching

Merge pull request #4681 from leirocks:xdatadebugger

codegen can happen before OnDebuggerAttach/Detach returns, we need to
clear the function table before the code gen happens.
Lei Shi 8 лет назад
Родитель
Сommit
41595fbc97
1 измененных файлов с 14 добавлено и 0 удалено
  1. 14 0
      lib/Runtime/Base/ScriptContext.cpp

+ 14 - 0
lib/Runtime/Base/ScriptContext.cpp

@@ -3192,6 +3192,13 @@ namespace Js
         // Disable QC while functions are re-parsed as this can be time consuming
         AutoDisableInterrupt autoDisableInterrupt(this->threadContext, false /* explicitCompletion */);
 
+#if ENABLE_NATIVE_CODEGEN
+#if PDATA_ENABLED && defined(_WIN32)
+        // RundownSourcesAndReparse can cause code generation immediately, clear the leftovers if background thread didn't finish the work
+        DelayDeletingFunctionTable::Clear();
+#endif
+#endif
+
         hr = this->GetDebugContext()->RundownSourcesAndReparse(shouldPerformSourceRundown, /*shouldReparseFunctions*/ true);
 
         if (this->IsClosed())
@@ -3318,6 +3325,13 @@ namespace Js
         // Disable QC while functions are re-parsed as this can be time consuming
         AutoDisableInterrupt autoDisableInterrupt(this->threadContext, false /* explicitCompletion */);
 
+#if ENABLE_NATIVE_CODEGEN
+#if PDATA_ENABLED && defined(_WIN32)
+        // RundownSourcesAndReparse can cause code generation immediately, clear the leftovers if background thread didn't finish the work
+        DelayDeletingFunctionTable::Clear();
+#endif
+#endif
+
         // Force a reparse so that indirect function caches are updated.
         hr = this->GetDebugContext()->RundownSourcesAndReparse(/*shouldPerformSourceRundown*/ false, /*shouldReparseFunctions*/ true);