OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 " var result = \"a\".search(\"a\");" | 63 " var result = \"a\".search(\"a\");" |
64 " if (result != 0) throw \"result: \" + result + \" @\" + i;" | 64 " if (result != 0) throw \"result: \" + result + \" @\" + i;" |
65 "};" | 65 "};" |
66 "true")); | 66 "true")); |
67 CHECK(script->Run()->IsTrue()); | 67 CHECK(script->Run()->IsTrue()); |
68 | 68 |
69 turn = CLEAN_CACHE; | 69 turn = CLEAN_CACHE; |
70 do { | 70 do { |
71 { | 71 { |
72 v8::Unlocker unlocker(CcTest::isolate()); | 72 v8::Unlocker unlocker(CcTest::isolate()); |
73 Thread::YieldCPU(); | |
74 } | 73 } |
75 } while (turn != SECOND_TIME_FILL_CACHE); | 74 } while (turn != SECOND_TIME_FILL_CACHE); |
76 | 75 |
77 // Rerun the script. | 76 // Rerun the script. |
78 CHECK(script->Run()->IsTrue()); | 77 CHECK(script->Run()->IsTrue()); |
79 | 78 |
80 turn = DONE; | 79 turn = DONE; |
81 } | 80 } |
82 }; | 81 }; |
83 | 82 |
(...skipping 11 matching lines...) Expand all Loading... |
95 v8::HandleScope scope(isolate); | 94 v8::HandleScope scope(isolate); |
96 v8::Handle<v8::Context> context = v8::Context::New(isolate); | 95 v8::Handle<v8::Context> context = v8::Context::New(isolate); |
97 v8::Context::Scope context_scope(context); | 96 v8::Context::Scope context_scope(context); |
98 | 97 |
99 // Clear the caches by forcing major GC. | 98 // Clear the caches by forcing major GC. |
100 CcTest::heap()->CollectAllGarbage(); | 99 CcTest::heap()->CollectAllGarbage(); |
101 turn = SECOND_TIME_FILL_CACHE; | 100 turn = SECOND_TIME_FILL_CACHE; |
102 break; | 101 break; |
103 } | 102 } |
104 } | 103 } |
105 | |
106 Thread::YieldCPU(); | |
107 } while (true); | 104 } while (true); |
108 } | 105 } |
109 }; | 106 }; |
110 | 107 |
111 | 108 |
112 TEST(JSFunctionResultCachesInTwoThreads) { | 109 TEST(JSFunctionResultCachesInTwoThreads) { |
113 ThreadA threadA; | 110 ThreadA threadA; |
114 ThreadB threadB; | 111 ThreadB threadB; |
115 | 112 |
116 threadA.Start(); | 113 threadA.Start(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 refs.Add(i::ThreadId::Invalid()); | 165 refs.Add(i::ThreadId::Invalid()); |
169 } | 166 } |
170 prev->Start(); | 167 prev->Start(); |
171 for (int i = 0; i < kNThreads; i++) { | 168 for (int i = 0; i < kNThreads; i++) { |
172 semaphore.Wait(); | 169 semaphore.Wait(); |
173 } | 170 } |
174 for (int i = 0; i < kNThreads; i++) { | 171 for (int i = 0; i < kNThreads; i++) { |
175 delete threads[i]; | 172 delete threads[i]; |
176 } | 173 } |
177 } | 174 } |
OLD | NEW |