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

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

Issue 23929006: remove remaining uses of default isolate in tests (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix serializer tests Created 7 years, 3 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 | « test/cctest/test-debug.cc ('k') | test/cctest/test-log.cc » ('j') | 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 class LockUnlockLockDefaultIsolateThread : public JoinableThread { 604 class LockUnlockLockDefaultIsolateThread : public JoinableThread {
605 public: 605 public:
606 explicit LockUnlockLockDefaultIsolateThread(v8::Handle<v8::Context> context) 606 explicit LockUnlockLockDefaultIsolateThread(v8::Handle<v8::Context> context)
607 : JoinableThread("LockUnlockLockDefaultIsolateThread"), 607 : JoinableThread("LockUnlockLockDefaultIsolateThread"),
608 context_(CcTest::isolate(), context) {} 608 context_(CcTest::isolate(), context) {}
609 609
610 virtual void Run() { 610 virtual void Run() {
611 v8::Locker lock1(CcTest::isolate()); 611 v8::Locker lock1(CcTest::isolate());
612 { 612 {
613 v8::Isolate::Scope isolate_scope(CcTest::isolate());
613 v8::HandleScope handle_scope(CcTest::isolate()); 614 v8::HandleScope handle_scope(CcTest::isolate());
614 v8::Local<v8::Context> context = 615 v8::Local<v8::Context> context =
615 v8::Local<v8::Context>::New(CcTest::isolate(), context_); 616 v8::Local<v8::Context>::New(CcTest::isolate(), context_);
616 v8::Context::Scope context_scope(context); 617 v8::Context::Scope context_scope(context);
617 CalcFibAndCheck(); 618 CalcFibAndCheck();
618 } 619 }
619 { 620 {
620 v8::Unlocker unlock1(CcTest::isolate()); 621 v8::Unlocker unlock1(CcTest::isolate());
621 { 622 {
622 v8::Locker lock2(CcTest::isolate()); 623 v8::Locker lock2(CcTest::isolate());
624 v8::Isolate::Scope isolate_scope(CcTest::isolate());
623 v8::HandleScope handle_scope(CcTest::isolate()); 625 v8::HandleScope handle_scope(CcTest::isolate());
624 v8::Local<v8::Context> context = 626 v8::Local<v8::Context> context =
625 v8::Local<v8::Context>::New(CcTest::isolate(), context_); 627 v8::Local<v8::Context>::New(CcTest::isolate(), context_);
626 v8::Context::Scope context_scope(context); 628 v8::Context::Scope context_scope(context);
627 CalcFibAndCheck(); 629 CalcFibAndCheck();
628 } 630 }
629 } 631 }
630 } 632 }
631 633
632 private: 634 private:
633 v8::Persistent<v8::Context> context_; 635 v8::Persistent<v8::Context> context_;
634 }; 636 };
635 637
636 638
637 // Locker inside an Unlocker inside a Locker for default isolate. 639 // Locker inside an Unlocker inside a Locker for default isolate.
638 UNINITIALIZED_TEST(LockUnlockLockDefaultIsolateMultithreaded) { 640 TEST(LockUnlockLockDefaultIsolateMultithreaded) {
639 #if V8_TARGET_ARCH_MIPS 641 #if V8_TARGET_ARCH_MIPS
640 const int kNThreads = 50; 642 const int kNThreads = 50;
641 #else 643 #else
642 const int kNThreads = 100; 644 const int kNThreads = 100;
643 #endif 645 #endif
644 Local<v8::Context> context; 646 Local<v8::Context> context;
645 i::List<JoinableThread*> threads(kNThreads); 647 i::List<JoinableThread*> threads(kNThreads);
646 { 648 {
647 v8::Locker locker_(CcTest::isolate()); 649 v8::Locker locker_(CcTest::isolate());
650 v8::Isolate::Scope isolate_scope(CcTest::isolate());
648 v8::HandleScope handle_scope(CcTest::isolate()); 651 v8::HandleScope handle_scope(CcTest::isolate());
649 context = v8::Context::New(CcTest::isolate()); 652 context = v8::Context::New(CcTest::isolate());
650 for (int i = 0; i < kNThreads; i++) { 653 for (int i = 0; i < kNThreads; i++) {
651 threads.Add(new LockUnlockLockDefaultIsolateThread(context)); 654 threads.Add(new LockUnlockLockDefaultIsolateThread(context));
652 } 655 }
653 } 656 }
654 StartJoinAndDeleteThreads(threads); 657 StartJoinAndDeleteThreads(threads);
655 } 658 }
656 659
657 660
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 kSimpleExtensionSource)); 734 kSimpleExtensionSource));
732 const char* extension_names[] = { "test0", "test1", 735 const char* extension_names[] = { "test0", "test1",
733 "test2", "test3", "test4", 736 "test2", "test3", "test4",
734 "test5", "test6", "test7" }; 737 "test5", "test6", "test7" };
735 i::List<JoinableThread*> threads(kNThreads); 738 i::List<JoinableThread*> threads(kNThreads);
736 for (int i = 0; i < kNThreads; i++) { 739 for (int i = 0; i < kNThreads; i++) {
737 threads.Add(new IsolateGenesisThread(8, extension_names)); 740 threads.Add(new IsolateGenesisThread(8, extension_names));
738 } 741 }
739 StartJoinAndDeleteThreads(threads); 742 StartJoinAndDeleteThreads(threads);
740 } 743 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698