Title: [155239] trunk/Source/_javascript_Core
Revision
155239
Author
[email protected]
Date
2013-09-06 22:25:55 -0700 (Fri, 06 Sep 2013)

Log Message

jsc shell should destroy VM as a workaround for LLVM's exit-time destructors
https://bugs.webkit.org/show_bug.cgi?id=120921

Reviewed by Oliver Hunt.
        
LLVM's exit-time destructors will fire when we exit. If there is an on-going
FTL compile at exit, which will happen if the VM that triggered the compile
isn't shut down, then we will crash.
        
We should get rid of LLVM's exit-time destructors. But before we do that, we
should just do a clean VM shutdown to suppress spurious crashes. This will
help in expanding LLVM coverage for now.

* jsc.cpp:
(jscmain):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (155238 => 155239)


--- trunk/Source/_javascript_Core/ChangeLog	2013-09-07 05:24:33 UTC (rev 155238)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-09-07 05:25:55 UTC (rev 155239)
@@ -1,5 +1,23 @@
 2013-09-06  Filip Pizlo  <[email protected]>
 
+        jsc shell should destroy VM as a workaround for LLVM's exit-time destructors
+        https://bugs.webkit.org/show_bug.cgi?id=120921
+
+        Reviewed by Oliver Hunt.
+        
+        LLVM's exit-time destructors will fire when we exit. If there is an on-going
+        FTL compile at exit, which will happen if the VM that triggered the compile
+        isn't shut down, then we will crash.
+        
+        We should get rid of LLVM's exit-time destructors. But before we do that, we
+        should just do a clean VM shutdown to suppress spurious crashes. This will
+        help in expanding LLVM coverage for now.
+
+        * jsc.cpp:
+        (jscmain):
+
+2013-09-06  Filip Pizlo  <[email protected]>
+
         FTL ArithMod Int32Use doesn't check for negative zero correctly
         https://bugs.webkit.org/show_bug.cgi?id=120905
 

Modified: trunk/Source/_javascript_Core/jsc.cpp (155238 => 155239)


--- trunk/Source/_javascript_Core/jsc.cpp	2013-09-07 05:24:33 UTC (rev 155238)
+++ trunk/Source/_javascript_Core/jsc.cpp	2013-09-07 05:25:55 UTC (rev 155239)
@@ -849,28 +849,33 @@
     // Note that the options parsing can affect VM creation, and thus
     // comes first.
     CommandLine options(argc, argv);
-    VM* vm = VM::create(LargeHeap).leakRef();
-    APIEntryShim shim(vm);
+    RefPtr<VM> vm = VM::create(LargeHeap);
     int result;
+    {
+        APIEntryShim shim(vm.get());
 
-    if (options.m_profile && !vm->m_perBytecodeProfiler)
-        vm->m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*vm));
+        if (options.m_profile && !vm->m_perBytecodeProfiler)
+            vm->m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*vm));
     
-    GlobalObject* globalObject = GlobalObject::create(*vm, GlobalObject::createStructure(*vm, jsNull()), options.m_arguments);
-    bool success = runWithScripts(globalObject, options.m_scripts, options.m_dump);
-    if (options.m_interactive && success)
-        runInteractive(globalObject);
+        GlobalObject* globalObject = GlobalObject::create(*vm, GlobalObject::createStructure(*vm, jsNull()), options.m_arguments);
+        bool success = runWithScripts(globalObject, options.m_scripts, options.m_dump);
+        if (options.m_interactive && success)
+            runInteractive(globalObject);
 
-    result = success ? 0 : 3;
+        result = success ? 0 : 3;
 
-    if (options.m_exitCode)
-        printf("jsc exiting %d\n", result);
+        if (options.m_exitCode)
+            printf("jsc exiting %d\n", result);
     
-    if (options.m_profile) {
-        if (!vm->m_perBytecodeProfiler->save(options.m_profilerOutput.utf8().data()))
-            fprintf(stderr, "could not save profiler output.\n");
+        if (options.m_profile) {
+            if (!vm->m_perBytecodeProfiler->save(options.m_profilerOutput.utf8().data()))
+                fprintf(stderr, "could not save profiler output.\n");
+        }
     }
-
+    
+    JSLockHolder lock(*vm);
+    vm.clear();
+    
     return result;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to