Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: test/cctest/test-log.cc

Issue 669058: Try to fix issue 632 by being more careful in the locking/unlocking... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of logging functions from log.h 3 // Tests of logging functions from log.h
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #ifdef __linux__ 7 #ifdef __linux__
8 #include <math.h> 8 #include <math.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 v8::internal::Semaphore* semaphore_; 383 v8::internal::Semaphore* semaphore_;
384 bool run_; 384 bool run_;
385 pthread_t self_; 385 pthread_t self_;
386 int v8_thread_id_; 386 int v8_thread_id_;
387 }; 387 };
388 388
389 389
390 class LoopingJsThread : public LoopingThread { 390 class LoopingJsThread : public LoopingThread {
391 public: 391 public:
392 void RunLoop() { 392 void RunLoop() {
393 { 393 v8::Locker locker;
394 v8::Locker locker; 394 CHECK(v8::internal::ThreadManager::HasId());
395 CHECK(v8::internal::ThreadManager::HasId()); 395 SetV8ThreadId();
396 SetV8ThreadId();
397 }
398 while (IsRunning()) { 396 while (IsRunning()) {
399 v8::Locker locker;
400 v8::HandleScope scope; 397 v8::HandleScope scope;
401 v8::Persistent<v8::Context> context = v8::Context::New(); 398 v8::Persistent<v8::Context> context = v8::Context::New();
402 v8::Context::Scope context_scope(context); 399 CHECK(!context.IsEmpty());
403 SignalRunning(); 400 {
404 CompileAndRunScript( 401 v8::Context::Scope context_scope(context);
405 "var j; for (var i=0; i<10000; ++i) { j = Math.sin(i); }"); 402 SignalRunning();
403 CompileAndRunScript(
404 "var j; for (var i=0; i<10000; ++i) { j = Math.sin(i); }");
405 }
406 context.Dispose(); 406 context.Dispose();
407 i::OS::Sleep(1); 407 {
408 v8::Unlocker unlocker;
409 i::OS::Sleep(1);
410 }
408 } 411 }
409 } 412 }
410 }; 413 };
411 414
412 415
413 class LoopingNonJsThread : public LoopingThread { 416 class LoopingNonJsThread : public LoopingThread {
414 public: 417 public:
415 void RunLoop() { 418 void RunLoop() {
416 v8::Locker locker; 419 v8::Locker locker;
417 v8::Unlocker unlocker; 420 v8::Unlocker unlocker;
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 // Make sure that all log data is written prior crash due to CHECK failure. 1197 // Make sure that all log data is written prior crash due to CHECK failure.
1195 fflush(stdout); 1198 fflush(stdout);
1196 CHECK(results_equal); 1199 CHECK(results_equal);
1197 1200
1198 env->Exit(); 1201 env->Exit();
1199 Logger::TearDown(); 1202 Logger::TearDown();
1200 i::FLAG_always_compact = saved_always_compact; 1203 i::FLAG_always_compact = saved_always_compact;
1201 } 1204 }
1202 1205
1203 #endif // ENABLE_LOGGING_AND_PROFILING 1206 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698