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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 | 35 |
36 TEST(Preemption) { | 36 TEST(Preemption) { |
37 v8::Isolate* isolate = CcTest::isolate(); | 37 v8::Isolate* isolate = CcTest::isolate(); |
38 v8::Locker locker(isolate); | 38 v8::Locker locker(isolate); |
39 v8::V8::Initialize(); | 39 v8::V8::Initialize(); |
40 v8::HandleScope scope(isolate); | 40 v8::HandleScope scope(isolate); |
41 v8::Handle<v8::Context> context = v8::Context::New(isolate); | 41 v8::Handle<v8::Context> context = v8::Context::New(isolate); |
42 v8::Context::Scope context_scope(context); | 42 v8::Context::Scope context_scope(context); |
43 | 43 |
44 v8::Locker::StartPreemption(100); | 44 v8::Locker::StartPreemption(isolate, 100); |
45 | 45 |
46 v8::Handle<v8::Script> script = v8::Script::Compile( | 46 v8::Handle<v8::Script> script = v8::Script::Compile( |
47 v8::String::New("var count = 0; var obj = new Object(); count++;\n")); | 47 v8::String::New("var count = 0; var obj = new Object(); count++;\n")); |
48 | 48 |
49 script->Run(); | 49 script->Run(); |
50 | 50 |
51 v8::Locker::StopPreemption(); | 51 v8::Locker::StopPreemption(isolate); |
52 v8::internal::OS::Sleep(500); // Make sure the timer fires. | 52 v8::internal::OS::Sleep(500); // Make sure the timer fires. |
53 | 53 |
54 script->Run(); | 54 script->Run(); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 enum Turn { | 58 enum Turn { |
59 FILL_CACHE, | 59 FILL_CACHE, |
60 CLEAN_CACHE, | 60 CLEAN_CACHE, |
61 SECOND_TIME_FILL_CACHE, | 61 SECOND_TIME_FILL_CACHE, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 Join(); | 206 Join(); |
207 } | 207 } |
208 }; | 208 }; |
209 | 209 |
210 | 210 |
211 TEST(ThreadJoinSelf) { | 211 TEST(ThreadJoinSelf) { |
212 ThreadC thread; | 212 ThreadC thread; |
213 thread.Start(); | 213 thread.Start(); |
214 thread.Join(); | 214 thread.Join(); |
215 } | 215 } |
OLD | NEW |