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

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

Issue 8506008: MIPS: Reduced the number of threads in cctest test-lockers. (Closed)
Patch Set: Rebased on 10046 Created 9 years, 1 month 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
« no previous file with comments | « no previous file | 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 2007-2011 the V8 project authors. All rights reserved. 1 // Copyright 2007-2011 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 threads[i]->Join(); 197 threads[i]->Join();
198 } 198 }
199 for (int i = 0; i < threads.length(); i++) { 199 for (int i = 0; i < threads.length(); i++) {
200 delete threads[i]; 200 delete threads[i];
201 } 201 }
202 } 202 }
203 203
204 204
205 // Run many threads all locking on the same isolate 205 // Run many threads all locking on the same isolate
206 TEST(IsolateLockingStress) { 206 TEST(IsolateLockingStress) {
207 #ifdef V8_TARGET_ARCH_MIPS
208 const int kNThreads = 50;
209 #else
207 const int kNThreads = 100; 210 const int kNThreads = 100;
211 #endif
208 i::List<JoinableThread*> threads(kNThreads); 212 i::List<JoinableThread*> threads(kNThreads);
209 v8::Isolate* isolate = v8::Isolate::New(); 213 v8::Isolate* isolate = v8::Isolate::New();
210 for (int i = 0; i < kNThreads; i++) { 214 for (int i = 0; i < kNThreads; i++) {
211 threads.Add(new IsolateLockingThreadWithLocalContext(isolate)); 215 threads.Add(new IsolateLockingThreadWithLocalContext(isolate));
212 } 216 }
213 StartJoinAndDeleteThreads(threads); 217 StartJoinAndDeleteThreads(threads);
214 isolate->Dispose(); 218 isolate->Dispose();
215 } 219 }
216 220
217 class IsolateNonlockingThread : public JoinableThread { 221 class IsolateNonlockingThread : public JoinableThread {
(...skipping 12 matching lines...) Expand all
230 CHECK_EQ(isolate, v8::internal::Isolate::Current()); 234 CHECK_EQ(isolate, v8::internal::Isolate::Current());
231 CalcFibAndCheck(); 235 CalcFibAndCheck();
232 } 236 }
233 isolate->Dispose(); 237 isolate->Dispose();
234 } 238 }
235 private: 239 private:
236 }; 240 };
237 241
238 // Run many threads each accessing its own isolate without locking 242 // Run many threads each accessing its own isolate without locking
239 TEST(MultithreadedParallelIsolates) { 243 TEST(MultithreadedParallelIsolates) {
240 #ifdef V8_TARGET_ARCH_ARM 244 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
241 const int kNThreads = 10; 245 const int kNThreads = 10;
242 #else 246 #else
243 const int kNThreads = 50; 247 const int kNThreads = 50;
244 #endif 248 #endif
245 i::List<JoinableThread*> threads(kNThreads); 249 i::List<JoinableThread*> threads(kNThreads);
246 for (int i = 0; i < kNThreads; i++) { 250 for (int i = 0; i < kNThreads; i++) {
247 threads.Add(new IsolateNonlockingThread()); 251 threads.Add(new IsolateNonlockingThread());
248 } 252 }
249 StartJoinAndDeleteThreads(threads); 253 StartJoinAndDeleteThreads(threads);
250 } 254 }
(...skipping 17 matching lines...) Expand all
268 v8::Locker another_lock(isolate_); 272 v8::Locker another_lock(isolate_);
269 CalcFibAndCheck(); 273 CalcFibAndCheck();
270 } 274 }
271 } 275 }
272 private: 276 private:
273 v8::Isolate* isolate_; 277 v8::Isolate* isolate_;
274 }; 278 };
275 279
276 // Run many threads with nested locks 280 // Run many threads with nested locks
277 TEST(IsolateNestedLocking) { 281 TEST(IsolateNestedLocking) {
282 #ifdef V8_TARGET_ARCH_MIPS
283 const int kNThreads = 50;
284 #else
278 const int kNThreads = 100; 285 const int kNThreads = 100;
286 #endif
279 v8::Isolate* isolate = v8::Isolate::New(); 287 v8::Isolate* isolate = v8::Isolate::New();
280 i::List<JoinableThread*> threads(kNThreads); 288 i::List<JoinableThread*> threads(kNThreads);
281 for (int i = 0; i < kNThreads; i++) { 289 for (int i = 0; i < kNThreads; i++) {
282 threads.Add(new IsolateNestedLockingThread(isolate)); 290 threads.Add(new IsolateNestedLockingThread(isolate));
283 } 291 }
284 StartJoinAndDeleteThreads(threads); 292 StartJoinAndDeleteThreads(threads);
285 } 293 }
286 294
287 295
288 class SeparateIsolatesLocksNonexclusiveThread : public JoinableThread { 296 class SeparateIsolatesLocksNonexclusiveThread : public JoinableThread {
(...skipping 15 matching lines...) Expand all
304 CalcFibAndCheck(); 312 CalcFibAndCheck();
305 threadB.Join(); 313 threadB.Join();
306 } 314 }
307 private: 315 private:
308 v8::Isolate* isolate1_; 316 v8::Isolate* isolate1_;
309 v8::Isolate* isolate2_; 317 v8::Isolate* isolate2_;
310 }; 318 };
311 319
312 // Run parallel threads that lock and access different isolates in parallel 320 // Run parallel threads that lock and access different isolates in parallel
313 TEST(SeparateIsolatesLocksNonexclusive) { 321 TEST(SeparateIsolatesLocksNonexclusive) {
314 #ifdef V8_TARGET_ARCH_ARM 322 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
315 const int kNThreads = 50; 323 const int kNThreads = 50;
316 #else 324 #else
317 const int kNThreads = 100; 325 const int kNThreads = 100;
318 #endif 326 #endif
319 v8::Isolate* isolate1 = v8::Isolate::New(); 327 v8::Isolate* isolate1 = v8::Isolate::New();
320 v8::Isolate* isolate2 = v8::Isolate::New(); 328 v8::Isolate* isolate2 = v8::Isolate::New();
321 i::List<JoinableThread*> threads(kNThreads); 329 i::List<JoinableThread*> threads(kNThreads);
322 for (int i = 0; i < kNThreads; i++) { 330 for (int i = 0; i < kNThreads; i++) {
323 threads.Add(new SeparateIsolatesLocksNonexclusiveThread(isolate1, 331 threads.Add(new SeparateIsolatesLocksNonexclusiveThread(isolate1,
324 isolate2)); 332 isolate2));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 CalcFibAndCheck(); 386 CalcFibAndCheck();
379 } 387 }
380 } 388 }
381 389
382 private: 390 private:
383 v8::Isolate* isolate_; 391 v8::Isolate* isolate_;
384 }; 392 };
385 393
386 // Use unlocker inside of a Locker, multiple threads. 394 // Use unlocker inside of a Locker, multiple threads.
387 TEST(LockerUnlocker) { 395 TEST(LockerUnlocker) {
388 #ifdef V8_TARGET_ARCH_ARM 396 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
389 const int kNThreads = 50; 397 const int kNThreads = 50;
390 #else 398 #else
391 const int kNThreads = 100; 399 const int kNThreads = 100;
392 #endif 400 #endif
393 i::List<JoinableThread*> threads(kNThreads); 401 i::List<JoinableThread*> threads(kNThreads);
394 v8::Isolate* isolate = v8::Isolate::New(); 402 v8::Isolate* isolate = v8::Isolate::New();
395 for (int i = 0; i < kNThreads; i++) { 403 for (int i = 0; i < kNThreads; i++) {
396 threads.Add(new LockerUnlockerThread(isolate)); 404 threads.Add(new LockerUnlockerThread(isolate));
397 } 405 }
398 StartJoinAndDeleteThreads(threads); 406 StartJoinAndDeleteThreads(threads);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 CalcFibAndCheck(); 439 CalcFibAndCheck();
432 } 440 }
433 } 441 }
434 442
435 private: 443 private:
436 v8::Isolate* isolate_; 444 v8::Isolate* isolate_;
437 }; 445 };
438 446
439 // Use Unlocker inside two Lockers. 447 // Use Unlocker inside two Lockers.
440 TEST(LockTwiceAndUnlock) { 448 TEST(LockTwiceAndUnlock) {
441 #ifdef V8_TARGET_ARCH_ARM 449 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
442 const int kNThreads = 50; 450 const int kNThreads = 50;
443 #else 451 #else
444 const int kNThreads = 100; 452 const int kNThreads = 100;
445 #endif 453 #endif
446 i::List<JoinableThread*> threads(kNThreads); 454 i::List<JoinableThread*> threads(kNThreads);
447 v8::Isolate* isolate = v8::Isolate::New(); 455 v8::Isolate* isolate = v8::Isolate::New();
448 for (int i = 0; i < kNThreads; i++) { 456 for (int i = 0; i < kNThreads; i++) {
449 threads.Add(new LockTwiceAndUnlockThread(isolate)); 457 threads.Add(new LockTwiceAndUnlockThread(isolate));
450 } 458 }
451 StartJoinAndDeleteThreads(threads); 459 StartJoinAndDeleteThreads(threads);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 560 }
553 } 561 }
554 562
555 private: 563 private:
556 v8::Isolate* isolate_; 564 v8::Isolate* isolate_;
557 v8::Persistent<v8::Context> context_; 565 v8::Persistent<v8::Context> context_;
558 }; 566 };
559 567
560 // Locker inside an Unlocker inside a Locker. 568 // Locker inside an Unlocker inside a Locker.
561 TEST(LockUnlockLockMultithreaded) { 569 TEST(LockUnlockLockMultithreaded) {
570 #ifdef V8_TARGET_ARCH_MIPS
571 const int kNThreads = 50;
572 #else
562 const int kNThreads = 100; 573 const int kNThreads = 100;
574 #endif
563 v8::Isolate* isolate = v8::Isolate::New(); 575 v8::Isolate* isolate = v8::Isolate::New();
564 Persistent<v8::Context> context; 576 Persistent<v8::Context> context;
565 { 577 {
566 v8::Locker locker_(isolate); 578 v8::Locker locker_(isolate);
567 v8::Isolate::Scope isolate_scope(isolate); 579 v8::Isolate::Scope isolate_scope(isolate);
568 v8::HandleScope handle_scope; 580 v8::HandleScope handle_scope;
569 context = v8::Context::New(); 581 context = v8::Context::New();
570 } 582 }
571 i::List<JoinableThread*> threads(kNThreads); 583 i::List<JoinableThread*> threads(kNThreads);
572 for (int i = 0; i < kNThreads; i++) { 584 for (int i = 0; i < kNThreads; i++) {
(...skipping 26 matching lines...) Expand all
599 } 611 }
600 } 612 }
601 } 613 }
602 614
603 private: 615 private:
604 v8::Persistent<v8::Context> context_; 616 v8::Persistent<v8::Context> context_;
605 }; 617 };
606 618
607 // Locker inside an Unlocker inside a Locker for default isolate. 619 // Locker inside an Unlocker inside a Locker for default isolate.
608 TEST(LockUnlockLockDefaultIsolateMultithreaded) { 620 TEST(LockUnlockLockDefaultIsolateMultithreaded) {
621 #ifdef V8_TARGET_ARCH_MIPS
622 const int kNThreads = 50;
623 #else
609 const int kNThreads = 100; 624 const int kNThreads = 100;
625 #endif
610 Persistent<v8::Context> context; 626 Persistent<v8::Context> context;
611 { 627 {
612 v8::Locker locker_; 628 v8::Locker locker_;
613 v8::HandleScope handle_scope; 629 v8::HandleScope handle_scope;
614 context = v8::Context::New(); 630 context = v8::Context::New();
615 } 631 }
616 i::List<JoinableThread*> threads(kNThreads); 632 i::List<JoinableThread*> threads(kNThreads);
617 for (int i = 0; i < kNThreads; i++) { 633 for (int i = 0; i < kNThreads; i++) {
618 threads.Add(new LockUnlockLockDefaultIsolateThread(context)); 634 threads.Add(new LockUnlockLockDefaultIsolateThread(context));
619 } 635 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 isolate->Dispose(); 683 isolate->Dispose();
668 } 684 }
669 private: 685 private:
670 int count_; 686 int count_;
671 const char** extension_names_; 687 const char** extension_names_;
672 }; 688 };
673 689
674 // Test installing extensions in separate isolates concurrently. 690 // Test installing extensions in separate isolates concurrently.
675 // http://code.google.com/p/v8/issues/detail?id=1821 691 // http://code.google.com/p/v8/issues/detail?id=1821
676 TEST(ExtensionsRegistration) { 692 TEST(ExtensionsRegistration) {
677 #ifdef V8_TARGET_ARCH_ARM 693 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
678 const int kNThreads = 10; 694 const int kNThreads = 10;
679 #else 695 #else
680 const int kNThreads = 40; 696 const int kNThreads = 40;
681 #endif 697 #endif
682 v8::RegisterExtension(new v8::Extension("test0", 698 v8::RegisterExtension(new v8::Extension("test0",
683 kSimpleExtensionSource)); 699 kSimpleExtensionSource));
684 v8::RegisterExtension(new v8::Extension("test1", 700 v8::RegisterExtension(new v8::Extension("test1",
685 kSimpleExtensionSource)); 701 kSimpleExtensionSource));
686 v8::RegisterExtension(new v8::Extension("test2", 702 v8::RegisterExtension(new v8::Extension("test2",
687 kSimpleExtensionSource)); 703 kSimpleExtensionSource));
688 v8::RegisterExtension(new v8::Extension("test3", 704 v8::RegisterExtension(new v8::Extension("test3",
689 kSimpleExtensionSource)); 705 kSimpleExtensionSource));
690 v8::RegisterExtension(new v8::Extension("test4", 706 v8::RegisterExtension(new v8::Extension("test4",
691 kSimpleExtensionSource)); 707 kSimpleExtensionSource));
692 v8::RegisterExtension(new v8::Extension("test5", 708 v8::RegisterExtension(new v8::Extension("test5",
693 kSimpleExtensionSource)); 709 kSimpleExtensionSource));
694 v8::RegisterExtension(new v8::Extension("test6", 710 v8::RegisterExtension(new v8::Extension("test6",
695 kSimpleExtensionSource)); 711 kSimpleExtensionSource));
696 v8::RegisterExtension(new v8::Extension("test7", 712 v8::RegisterExtension(new v8::Extension("test7",
697 kSimpleExtensionSource)); 713 kSimpleExtensionSource));
698 const char* extension_names[] = { "test0", "test1", 714 const char* extension_names[] = { "test0", "test1",
699 "test2", "test3", "test4", 715 "test2", "test3", "test4",
700 "test5", "test6", "test7" }; 716 "test5", "test6", "test7" };
701 i::List<JoinableThread*> threads(kNThreads); 717 i::List<JoinableThread*> threads(kNThreads);
702 for (int i = 0; i < kNThreads; i++) { 718 for (int i = 0; i < kNThreads; i++) {
703 threads.Add(new IsolateGenesisThread(8, extension_names)); 719 threads.Add(new IsolateGenesisThread(8, extension_names));
704 } 720 }
705 StartJoinAndDeleteThreads(threads); 721 StartJoinAndDeleteThreads(threads);
706 } 722 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698