| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 isolate->Dispose(); | 240 isolate->Dispose(); |
| 241 } | 241 } |
| 242 private: | 242 private: |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 | 245 |
| 246 // Run many threads each accessing its own isolate without locking | 246 // Run many threads each accessing its own isolate without locking |
| 247 TEST(MultithreadedParallelIsolates) { | 247 TEST(MultithreadedParallelIsolates) { |
| 248 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS | 248 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS |
| 249 const int kNThreads = 10; | 249 const int kNThreads = 10; |
| 250 #elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT |
| 251 const int kNThreads = 4; |
| 250 #else | 252 #else |
| 251 const int kNThreads = 50; | 253 const int kNThreads = 50; |
| 252 #endif | 254 #endif |
| 253 i::List<JoinableThread*> threads(kNThreads); | 255 i::List<JoinableThread*> threads(kNThreads); |
| 254 for (int i = 0; i < kNThreads; i++) { | 256 for (int i = 0; i < kNThreads; i++) { |
| 255 threads.Add(new IsolateNonlockingThread()); | 257 threads.Add(new IsolateNonlockingThread()); |
| 256 } | 258 } |
| 257 StartJoinAndDeleteThreads(threads); | 259 StartJoinAndDeleteThreads(threads); |
| 258 } | 260 } |
| 259 | 261 |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 int count_; | 708 int count_; |
| 707 const char** extension_names_; | 709 const char** extension_names_; |
| 708 }; | 710 }; |
| 709 | 711 |
| 710 | 712 |
| 711 // Test installing extensions in separate isolates concurrently. | 713 // Test installing extensions in separate isolates concurrently. |
| 712 // http://code.google.com/p/v8/issues/detail?id=1821 | 714 // http://code.google.com/p/v8/issues/detail?id=1821 |
| 713 TEST(ExtensionsRegistration) { | 715 TEST(ExtensionsRegistration) { |
| 714 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS | 716 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS |
| 715 const int kNThreads = 10; | 717 const int kNThreads = 10; |
| 718 #elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT |
| 719 const int kNThreads = 4; |
| 716 #else | 720 #else |
| 717 const int kNThreads = 40; | 721 const int kNThreads = 40; |
| 718 #endif | 722 #endif |
| 719 v8::RegisterExtension(new v8::Extension("test0", | 723 v8::RegisterExtension(new v8::Extension("test0", |
| 720 kSimpleExtensionSource)); | 724 kSimpleExtensionSource)); |
| 721 v8::RegisterExtension(new v8::Extension("test1", | 725 v8::RegisterExtension(new v8::Extension("test1", |
| 722 kSimpleExtensionSource)); | 726 kSimpleExtensionSource)); |
| 723 v8::RegisterExtension(new v8::Extension("test2", | 727 v8::RegisterExtension(new v8::Extension("test2", |
| 724 kSimpleExtensionSource)); | 728 kSimpleExtensionSource)); |
| 725 v8::RegisterExtension(new v8::Extension("test3", | 729 v8::RegisterExtension(new v8::Extension("test3", |
| 726 kSimpleExtensionSource)); | 730 kSimpleExtensionSource)); |
| 727 v8::RegisterExtension(new v8::Extension("test4", | 731 v8::RegisterExtension(new v8::Extension("test4", |
| 728 kSimpleExtensionSource)); | 732 kSimpleExtensionSource)); |
| 729 v8::RegisterExtension(new v8::Extension("test5", | 733 v8::RegisterExtension(new v8::Extension("test5", |
| 730 kSimpleExtensionSource)); | 734 kSimpleExtensionSource)); |
| 731 v8::RegisterExtension(new v8::Extension("test6", | 735 v8::RegisterExtension(new v8::Extension("test6", |
| 732 kSimpleExtensionSource)); | 736 kSimpleExtensionSource)); |
| 733 v8::RegisterExtension(new v8::Extension("test7", | 737 v8::RegisterExtension(new v8::Extension("test7", |
| 734 kSimpleExtensionSource)); | 738 kSimpleExtensionSource)); |
| 735 const char* extension_names[] = { "test0", "test1", | 739 const char* extension_names[] = { "test0", "test1", |
| 736 "test2", "test3", "test4", | 740 "test2", "test3", "test4", |
| 737 "test5", "test6", "test7" }; | 741 "test5", "test6", "test7" }; |
| 738 i::List<JoinableThread*> threads(kNThreads); | 742 i::List<JoinableThread*> threads(kNThreads); |
| 739 for (int i = 0; i < kNThreads; i++) { | 743 for (int i = 0; i < kNThreads; i++) { |
| 740 threads.Add(new IsolateGenesisThread(8, extension_names)); | 744 threads.Add(new IsolateGenesisThread(8, extension_names)); |
| 741 } | 745 } |
| 742 StartJoinAndDeleteThreads(threads); | 746 StartJoinAndDeleteThreads(threads); |
| 743 } | 747 } |
| OLD | NEW |