| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 v8::HandleScope scope; | 185 v8::HandleScope scope; |
| 186 v8::Persistent<v8::Context> context = v8::Context::New(); | 186 v8::Persistent<v8::Context> context = v8::Context::New(); |
| 187 CHECK(!context.IsEmpty()); | 187 CHECK(!context.IsEmpty()); |
| 188 { | 188 { |
| 189 v8::Context::Scope context_scope(context); | 189 v8::Context::Scope context_scope(context); |
| 190 SignalRunning(); | 190 SignalRunning(); |
| 191 CompileRun( | 191 CompileRun( |
| 192 "var j; for (var i=0; i<10000; ++i) { j = Math.sin(i); }"); | 192 "var j; for (var i=0; i<10000; ++i) { j = Math.sin(i); }"); |
| 193 } | 193 } |
| 194 context.Dispose(); | 194 context.Dispose(); |
| 195 i::OS::Sleep(1); | 195 i::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(1)); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 | 200 |
| 201 class LoopingNonJsThread : public LoopingThread { | 201 class LoopingNonJsThread : public LoopingThread { |
| 202 public: | 202 public: |
| 203 explicit LoopingNonJsThread(v8::internal::Isolate* isolate) | 203 explicit LoopingNonJsThread(v8::internal::Isolate* isolate) |
| 204 : LoopingThread(isolate) { } | 204 : LoopingThread(isolate) { } |
| 205 void RunLoop() { | 205 void RunLoop() { |
| 206 v8::Locker locker; | 206 v8::Locker locker; |
| 207 v8::Unlocker unlocker; | 207 v8::Unlocker unlocker; |
| 208 // Now thread has V8's id, but will not run VM code. | 208 // Now thread has V8's id, but will not run VM code. |
| 209 CHECK(CcTest::i_isolate() != NULL); | 209 CHECK(CcTest::i_isolate() != NULL); |
| 210 CHECK_GT(CcTest::i_isolate()->thread_manager()->CurrentId(), 0); | 210 CHECK_GT(CcTest::i_isolate()->thread_manager()->CurrentId(), 0); |
| 211 double i = 10; | 211 double i = 10; |
| 212 SignalRunning(); | 212 SignalRunning(); |
| 213 while (IsRunning()) { | 213 while (IsRunning()) { |
| 214 i = std::sin(i); | 214 i = std::sin(i); |
| 215 i::OS::Sleep(1); | 215 i::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(1)); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 | 220 |
| 221 class TestSampler : public v8::internal::Sampler { | 221 class TestSampler : public v8::internal::Sampler { |
| 222 public: | 222 public: |
| 223 explicit TestSampler(v8::internal::Isolate* isolate) | 223 explicit TestSampler(v8::internal::Isolate* isolate) |
| 224 : Sampler(isolate, 0, true, true), | 224 : Sampler(isolate, 0, true, true), |
| 225 semaphore_(new v8::internal::Semaphore(0)), | 225 semaphore_(new v8::internal::Semaphore(0)), |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 CHECK(exists); | 518 CHECK(exists); |
| 519 i::EmbeddedVector<char, 100> ref_data; | 519 i::EmbeddedVector<char, 100> ref_data; |
| 520 i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(), | 520 i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(), |
| 521 i::Version::GetMinor(), i::Version::GetBuild(), | 521 i::Version::GetMinor(), i::Version::GetBuild(), |
| 522 i::Version::GetPatch(), i::Version::IsCandidate()); | 522 i::Version::GetPatch(), i::Version::IsCandidate()); |
| 523 CHECK(StrNStr(log.start(), ref_data.start(), log.length())); | 523 CHECK(StrNStr(log.start(), ref_data.start(), log.length())); |
| 524 log.Dispose(); | 524 log.Dispose(); |
| 525 } | 525 } |
| 526 isolate->Dispose(); | 526 isolate->Dispose(); |
| 527 } | 527 } |
| OLD | NEW |