Index: test/cctest/test-threads.cc |
diff --git a/test/cctest/test-threads.cc b/test/cctest/test-threads.cc |
index 5f2cdae2a2488a2931c50eee50c54933e8f47042..a9058a523a4b0338f4e5f0df57127721644007e5 100644 |
--- a/test/cctest/test-threads.cc |
+++ b/test/cctest/test-threads.cc |
@@ -32,88 +32,6 @@ |
#include "src/isolate.h" |
-enum Turn { FILL_CACHE, CLEAN_CACHE, SECOND_TIME_FILL_CACHE, CACHE_DONE }; |
- |
-static Turn turn = FILL_CACHE; |
- |
- |
-class ThreadA : public v8::base::Thread { |
- public: |
- ThreadA() : Thread(Options("ThreadA")) {} |
- void Run() { |
- v8::Isolate* isolate = CcTest::isolate(); |
- v8::Locker locker(isolate); |
- v8::Isolate::Scope isolate_scope(isolate); |
- v8::HandleScope scope(isolate); |
- v8::Handle<v8::Context> context = v8::Context::New(isolate); |
- v8::Context::Scope context_scope(context); |
- |
- CHECK_EQ(FILL_CACHE, turn); |
- |
- // Fill String.search cache. |
- v8::Handle<v8::Script> script = v8::Script::Compile( |
- v8::String::NewFromUtf8( |
- isolate, |
- "for (var i = 0; i < 3; i++) {" |
- " var result = \"a\".search(\"a\");" |
- " if (result != 0) throw \"result: \" + result + \" @\" + i;" |
- "};" |
- "true")); |
- CHECK(script->Run()->IsTrue()); |
- |
- turn = CLEAN_CACHE; |
- do { |
- { |
- v8::Unlocker unlocker(CcTest::isolate()); |
- } |
- } while (turn != SECOND_TIME_FILL_CACHE); |
- |
- // Rerun the script. |
- CHECK(script->Run()->IsTrue()); |
- |
- turn = CACHE_DONE; |
- } |
-}; |
- |
- |
-class ThreadB : public v8::base::Thread { |
- public: |
- ThreadB() : Thread(Options("ThreadB")) {} |
- void Run() { |
- do { |
- { |
- v8::Isolate* isolate = CcTest::isolate(); |
- v8::Locker locker(isolate); |
- v8::Isolate::Scope isolate_scope(isolate); |
- if (turn == CLEAN_CACHE) { |
- v8::HandleScope scope(isolate); |
- v8::Handle<v8::Context> context = v8::Context::New(isolate); |
- v8::Context::Scope context_scope(context); |
- |
- // Clear the caches by forcing major GC. |
- CcTest::heap()->CollectAllGarbage(); |
- turn = SECOND_TIME_FILL_CACHE; |
- break; |
- } |
- } |
- } while (true); |
- } |
-}; |
- |
- |
-TEST(JSFunctionResultCachesInTwoThreads) { |
- ThreadA threadA; |
- ThreadB threadB; |
- |
- threadA.Start(); |
- threadB.Start(); |
- |
- threadA.Join(); |
- threadB.Join(); |
- |
- CHECK_EQ(CACHE_DONE, turn); |
-} |
- |
class ThreadIdValidationThread : public v8::base::Thread { |
public: |
ThreadIdValidationThread(v8::base::Thread* thread_to_start, |