REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372
https://bugs.webkit.org/show_bug.cgi?id=175083

Reviewed by Oliver Hunt.
        
Source/JavaScriptCore:

This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty,
even if we are using the pop path.
        
Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty
important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile
the world just because we changed it.
        
Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it
easier to debug leaks.

* bytecode/AccessCase.cpp:
* bytecode/PolymorphicAccess.cpp:
* heap/HeapCell.cpp:
(JSC::HeapCell::isLive):
* heap/HeapCellInlines.h:
(JSC::HeapCell::isLive): Deleted.
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::tryAllocateWithoutCollecting):
(JSC::MarkedAllocator::endMarking):
* heap/MarkedBlockInlines.h:
(JSC::MarkedBlock::Handle::specializedSweep):
* jit/AssemblyHelpers.cpp:
* jit/Repatch.cpp:
* runtime/TestRunnerUtils.h:
* runtime/VM.cpp:
(JSC::waitForVMDestruction):
(JSC::VM::~VM):

Source/WTF:

Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is
guaranted to bias in favor of writers or not.

* WTF.xcodeproj/project.pbxproj:
* wtf/Condition.h:
(WTF::ConditionBase::construct):
(WTF::Condition::Condition):
* wtf/Lock.h:
(WTF::LockBase::construct):
(WTF::Lock::Lock):
* wtf/ReadWriteLock.cpp: Added.
(WTF::ReadWriteLockBase::construct):
(WTF::ReadWriteLockBase::readLock):
(WTF::ReadWriteLockBase::readUnlock):
(WTF::ReadWriteLockBase::writeLock):
(WTF::ReadWriteLockBase::writeUnlock):
* wtf/ReadWriteLock.h: Added.
(WTF::ReadWriteLockBase::ReadLock::tryLock):
(WTF::ReadWriteLockBase::ReadLock::lock):
(WTF::ReadWriteLockBase::ReadLock::unlock):
(WTF::ReadWriteLockBase::WriteLock::tryLock):
(WTF::ReadWriteLockBase::WriteLock::lock):
(WTF::ReadWriteLockBase::WriteLock::unlock):
(WTF::ReadWriteLockBase::read):
(WTF::ReadWriteLockBase::write):
(WTF::ReadWriteLock::ReadWriteLock):

Tools:

Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI
to wait for VM destructions to finish before running the next test. This makes it easier to 
understand leaks results from workers tests, and leads to fewer reported leaks.

* DumpRenderTree/mac/DumpRenderTree.mm:
(runTest):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@220322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/TestRunnerUtils.h b/Source/JavaScriptCore/runtime/TestRunnerUtils.h
index 321ae4e..b0046dde 100644
--- a/Source/JavaScriptCore/runtime/TestRunnerUtils.h
+++ b/Source/JavaScriptCore/runtime/TestRunnerUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -54,4 +54,6 @@
 
 JS_EXPORT_PRIVATE void finalizeStatsAtEndOfTesting();
 
+JS_EXPORT_PRIVATE void waitForVMDestruction();
+
 } // namespace JSC