OLD | NEW |
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 291 } |
292 private: | 292 private: |
293 v8::Isolate* isolate1_; | 293 v8::Isolate* isolate1_; |
294 v8::Isolate* isolate2_; | 294 v8::Isolate* isolate2_; |
295 }; | 295 }; |
296 | 296 |
297 | 297 |
298 // Run parallel threads that lock and access different isolates in parallel | 298 // Run parallel threads that lock and access different isolates in parallel |
299 TEST(SeparateIsolatesLocksNonexclusive) { | 299 TEST(SeparateIsolatesLocksNonexclusive) { |
300 i::FLAG_always_opt = false; | 300 i::FLAG_always_opt = false; |
301 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS | 301 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_S390 |
302 const int kNThreads = 50; | 302 const int kNThreads = 50; |
303 #else | 303 #else |
304 const int kNThreads = 100; | 304 const int kNThreads = 100; |
305 #endif | 305 #endif |
306 v8::Isolate::CreateParams create_params; | 306 v8::Isolate::CreateParams create_params; |
307 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 307 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
308 v8::Isolate* isolate1 = v8::Isolate::New(create_params); | 308 v8::Isolate* isolate1 = v8::Isolate::New(create_params); |
309 v8::Isolate* isolate2 = v8::Isolate::New(create_params); | 309 v8::Isolate* isolate2 = v8::Isolate::New(create_params); |
310 i::List<JoinableThread*> threads(kNThreads); | 310 i::List<JoinableThread*> threads(kNThreads); |
311 for (int i = 0; i < kNThreads; i++) { | 311 for (int i = 0; i < kNThreads; i++) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } | 375 } |
376 | 376 |
377 private: | 377 private: |
378 v8::Isolate* isolate_; | 378 v8::Isolate* isolate_; |
379 }; | 379 }; |
380 | 380 |
381 | 381 |
382 // Use unlocker inside of a Locker, multiple threads. | 382 // Use unlocker inside of a Locker, multiple threads. |
383 TEST(LockerUnlocker) { | 383 TEST(LockerUnlocker) { |
384 i::FLAG_always_opt = false; | 384 i::FLAG_always_opt = false; |
385 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS | 385 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_S390 |
386 const int kNThreads = 50; | 386 const int kNThreads = 50; |
387 #else | 387 #else |
388 const int kNThreads = 100; | 388 const int kNThreads = 100; |
389 #endif | 389 #endif |
390 i::List<JoinableThread*> threads(kNThreads); | 390 i::List<JoinableThread*> threads(kNThreads); |
391 v8::Isolate::CreateParams create_params; | 391 v8::Isolate::CreateParams create_params; |
392 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 392 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
393 v8::Isolate* isolate = v8::Isolate::New(create_params); | 393 v8::Isolate* isolate = v8::Isolate::New(create_params); |
394 for (int i = 0; i < kNThreads; i++) { | 394 for (int i = 0; i < kNThreads; i++) { |
395 threads.Add(new LockerUnlockerThread(isolate)); | 395 threads.Add(new LockerUnlockerThread(isolate)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 432 } |
433 | 433 |
434 private: | 434 private: |
435 v8::Isolate* isolate_; | 435 v8::Isolate* isolate_; |
436 }; | 436 }; |
437 | 437 |
438 | 438 |
439 // Use Unlocker inside two Lockers. | 439 // Use Unlocker inside two Lockers. |
440 TEST(LockTwiceAndUnlock) { | 440 TEST(LockTwiceAndUnlock) { |
441 i::FLAG_always_opt = false; | 441 i::FLAG_always_opt = false; |
442 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS | 442 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_S390 |
443 const int kNThreads = 50; | 443 const int kNThreads = 50; |
444 #else | 444 #else |
445 const int kNThreads = 100; | 445 const int kNThreads = 100; |
446 #endif | 446 #endif |
447 i::List<JoinableThread*> threads(kNThreads); | 447 i::List<JoinableThread*> threads(kNThreads); |
448 v8::Isolate::CreateParams create_params; | 448 v8::Isolate::CreateParams create_params; |
449 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 449 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
450 v8::Isolate* isolate = v8::Isolate::New(create_params); | 450 v8::Isolate* isolate = v8::Isolate::New(create_params); |
451 for (int i = 0; i < kNThreads; i++) { | 451 for (int i = 0; i < kNThreads; i++) { |
452 threads.Add(new LockTwiceAndUnlockThread(isolate)); | 452 threads.Add(new LockTwiceAndUnlockThread(isolate)); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 }; | 703 }; |
704 | 704 |
705 | 705 |
706 // Test installing extensions in separate isolates concurrently. | 706 // Test installing extensions in separate isolates concurrently. |
707 // http://code.google.com/p/v8/issues/detail?id=1821 | 707 // http://code.google.com/p/v8/issues/detail?id=1821 |
708 TEST(ExtensionsRegistration) { | 708 TEST(ExtensionsRegistration) { |
709 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS | 709 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS |
710 const int kNThreads = 10; | 710 const int kNThreads = 10; |
711 #elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT | 711 #elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT |
712 const int kNThreads = 4; | 712 const int kNThreads = 4; |
| 713 #elif V8_TARGET_ARCH_S390 && V8_TARGET_ARCH_32_BIT |
| 714 const int kNThreads = 10; |
713 #else | 715 #else |
714 const int kNThreads = 40; | 716 const int kNThreads = 40; |
715 #endif | 717 #endif |
716 v8::RegisterExtension(new v8::Extension("test0", | 718 v8::RegisterExtension(new v8::Extension("test0", |
717 kSimpleExtensionSource)); | 719 kSimpleExtensionSource)); |
718 v8::RegisterExtension(new v8::Extension("test1", | 720 v8::RegisterExtension(new v8::Extension("test1", |
719 kSimpleExtensionSource)); | 721 kSimpleExtensionSource)); |
720 v8::RegisterExtension(new v8::Extension("test2", | 722 v8::RegisterExtension(new v8::Extension("test2", |
721 kSimpleExtensionSource)); | 723 kSimpleExtensionSource)); |
722 v8::RegisterExtension(new v8::Extension("test3", | 724 v8::RegisterExtension(new v8::Extension("test3", |
723 kSimpleExtensionSource)); | 725 kSimpleExtensionSource)); |
724 v8::RegisterExtension(new v8::Extension("test4", | 726 v8::RegisterExtension(new v8::Extension("test4", |
725 kSimpleExtensionSource)); | 727 kSimpleExtensionSource)); |
726 v8::RegisterExtension(new v8::Extension("test5", | 728 v8::RegisterExtension(new v8::Extension("test5", |
727 kSimpleExtensionSource)); | 729 kSimpleExtensionSource)); |
728 v8::RegisterExtension(new v8::Extension("test6", | 730 v8::RegisterExtension(new v8::Extension("test6", |
729 kSimpleExtensionSource)); | 731 kSimpleExtensionSource)); |
730 v8::RegisterExtension(new v8::Extension("test7", | 732 v8::RegisterExtension(new v8::Extension("test7", |
731 kSimpleExtensionSource)); | 733 kSimpleExtensionSource)); |
732 const char* extension_names[] = { "test0", "test1", | 734 const char* extension_names[] = { "test0", "test1", |
733 "test2", "test3", "test4", | 735 "test2", "test3", "test4", |
734 "test5", "test6", "test7" }; | 736 "test5", "test6", "test7" }; |
735 i::List<JoinableThread*> threads(kNThreads); | 737 i::List<JoinableThread*> threads(kNThreads); |
736 for (int i = 0; i < kNThreads; i++) { | 738 for (int i = 0; i < kNThreads; i++) { |
737 threads.Add(new IsolateGenesisThread(8, extension_names)); | 739 threads.Add(new IsolateGenesisThread(8, extension_names)); |
738 } | 740 } |
739 StartJoinAndDeleteThreads(threads); | 741 StartJoinAndDeleteThreads(threads); |
740 } | 742 } |
OLD | NEW |