| Index: src/optimizing-compiler-thread.h
|
| diff --git a/test/mjsunit/count-based-osr.js b/src/optimizing-compiler-thread.h
|
| similarity index 61%
|
| copy from test/mjsunit/count-based-osr.js
|
| copy to src/optimizing-compiler-thread.h
|
| index 125c4e26d5c641b947def268f236876eb9f3e6c1..3a1eee785877a34f09bff7fd04475cbaacb9a314 100644
|
| --- a/test/mjsunit/count-based-osr.js
|
| +++ b/src/optimizing-compiler-thread.h
|
| @@ -25,14 +25,45 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --count-based-interrupts --interrupt-budget=10 --weighted-back-edges --allow-natives-syntax
|
| +#ifndef V8_OPTIMIZING_COMPILER_THREAD_H_
|
| +#define V8_OPTIMIZING_COMPILER_THREAD_H_
|
|
|
| -// Test that OSR works properly when using count-based interrupting/profiling.
|
| +#include "v8.h"
|
|
|
| -function osr_this() {
|
| - var a = 1;
|
| - // Trigger OSR.
|
| - while (%GetOptimizationStatus(osr_this) == 2) {}
|
| - return a;
|
| -}
|
| -assertEquals(1, osr_this());
|
| +#include "atomicops.h"
|
| +#include "objects.h"
|
| +#include "platform.h"
|
| +#include "unbound-queue.h"
|
| +
|
| +namespace v8 {
|
| +namespace internal {
|
| +
|
| +class OptimizingCompilerThread : public Thread {
|
| + public:
|
| + explicit OptimizingCompilerThread(Isolate *i) :
|
| + Thread("OptimizingCompilerThread"), isolate_(i) {
|
| + queue_semaphore_ = OS::CreateSemaphore(0);
|
| + queue_mutex_ = OS::CreateMutex();
|
| + NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false));
|
| + }
|
| +
|
| + void Run();
|
| + void StopThread();
|
| + void QueueForOptimization(Handle<JSFunction> function);
|
| +
|
| + ~OptimizingCompilerThread() {
|
| + delete queue_semaphore_;
|
| + delete queue_mutex_;
|
| + }
|
| +
|
| + private:
|
| + Isolate* isolate_;
|
| + Mutex* queue_mutex_;
|
| + UnboundQueue<Handle<JSFunction> > queue_;
|
| + Semaphore* queue_semaphore_;
|
| + volatile AtomicWord stop_thread_;
|
| +};
|
| +
|
| +} } // namespace v8::internal
|
| +
|
| +#endif // V8_OPTIMIZING_COMPILER_THREAD_H_
|
|
|