Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <limits.h> | 28 #include <limits.h> |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #include "api.h" | 32 #include "api.h" |
| 33 #include "isolate.h" | 33 #include "isolate.h" |
| 34 #include "compilation-cache.h" | 34 #include "compilation-cache.h" |
| 35 #include "execution.h" | 35 #include "execution.h" |
| 36 #include "smart-pointers.h" | |
| 36 #include "snapshot.h" | 37 #include "snapshot.h" |
| 37 #include "platform.h" | 38 #include "platform.h" |
| 38 #include "utils.h" | 39 #include "utils.h" |
| 39 #include "cctest.h" | 40 #include "cctest.h" |
| 40 #include "parser.h" | 41 #include "parser.h" |
| 41 #include "unicode-inl.h" | 42 #include "unicode-inl.h" |
| 42 | 43 |
| 43 using ::v8::AccessorInfo; | 44 using ::v8::AccessorInfo; |
| 44 using ::v8::Context; | 45 using ::v8::Context; |
| 45 using ::v8::Extension; | 46 using ::v8::Extension; |
| 46 using ::v8::Function; | 47 using ::v8::Function; |
| 47 using ::v8::HandleScope; | 48 using ::v8::HandleScope; |
| 48 using ::v8::Local; | 49 using ::v8::Local; |
| 49 using ::v8::Object; | 50 using ::v8::Object; |
| 50 using ::v8::ObjectTemplate; | 51 using ::v8::ObjectTemplate; |
| 51 using ::v8::Persistent; | 52 using ::v8::Persistent; |
| 52 using ::v8::Script; | 53 using ::v8::Script; |
| 53 using ::v8::String; | 54 using ::v8::String; |
| 54 using ::v8::Value; | 55 using ::v8::Value; |
| 55 using ::v8::V8; | 56 using ::v8::V8; |
| 56 | 57 |
| 57 | 58 |
| 58 // Migrating an isolate | 59 // Migrating an isolate |
| 59 class KangarooThread : public v8::internal::Thread { | 60 class KangarooThread : public v8::internal::Thread { |
| 60 public: | 61 public: |
| 61 KangarooThread(v8::Isolate* isolate, | 62 KangarooThread(v8::Isolate* isolate, v8::Handle<v8::Context> context) |
| 62 v8::Handle<v8::Context> context) | |
| 63 : Thread("KangarooThread"), | 63 : Thread("KangarooThread"), |
| 64 isolate_(isolate), context_(context) { | 64 isolate_(isolate), |
| 65 } | 65 context_(isolate, context) {} |
| 66 | 66 |
| 67 void Run() { | 67 void Run() { |
| 68 { | 68 { |
| 69 v8::Locker locker(isolate_); | 69 v8::Locker locker(isolate_); |
| 70 v8::Isolate::Scope isolate_scope(isolate_); | 70 v8::Isolate::Scope isolate_scope(isolate_); |
| 71 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); | 71 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); |
| 72 v8::HandleScope scope(isolate_); | 72 v8::HandleScope scope(isolate_); |
| 73 v8::Context::Scope context_scope(context_); | 73 v8::Context::Scope context_scope(context_); |
| 74 Local<Value> v = CompileRun("getValue()"); | 74 Local<Value> v = CompileRun("getValue()"); |
| 75 CHECK(v->IsNumber()); | 75 CHECK(v->IsNumber()); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 88 } | 88 } |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 v8::Isolate* isolate_; | 91 v8::Isolate* isolate_; |
| 92 Persistent<v8::Context> context_; | 92 Persistent<v8::Context> context_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 // Migrates an isolate from one thread to another | 95 // Migrates an isolate from one thread to another |
| 96 TEST(KangarooIsolates) { | 96 TEST(KangarooIsolates) { |
| 97 v8::Isolate* isolate = v8::Isolate::New(); | 97 v8::Isolate* isolate = v8::Isolate::New(); |
| 98 Persistent<v8::Context> context; | 98 v8::internal::SmartPointer<KangarooThread> thread1; |
| 99 { | 99 { |
| 100 v8::Locker locker(isolate); | 100 v8::Locker locker(isolate); |
| 101 v8::Isolate::Scope isolate_scope(isolate); | 101 v8::Isolate::Scope isolate_scope(isolate); |
| 102 v8::HandleScope handle_scope(isolate); | 102 v8::HandleScope handle_scope(isolate); |
| 103 context = v8::Context::New(); | 103 v8::Local<v8::Context> context = v8::Context::New(isolate); |
| 104 v8::Context::Scope context_scope(context); | 104 v8::Context::Scope context_scope(context); |
| 105 CHECK_EQ(isolate, v8::internal::Isolate::Current()); | 105 CHECK_EQ(isolate, v8::internal::Isolate::Current()); |
| 106 CompileRun("function getValue() { return 30; }"); | 106 CompileRun("function getValue() { return 30; }"); |
| 107 thread1.Reset(new KangarooThread(isolate, context)); | |
| 107 } | 108 } |
| 108 KangarooThread thread1(isolate, context); | 109 thread1->Start(); |
| 109 thread1.Start(); | 110 thread1->Join(); |
| 110 thread1.Join(); | |
| 111 } | 111 } |
| 112 | 112 |
| 113 static void CalcFibAndCheck() { | 113 static void CalcFibAndCheck() { |
| 114 Local<Value> v = CompileRun("function fib(n) {" | 114 Local<Value> v = CompileRun("function fib(n) {" |
| 115 " if (n <= 2) return 1;" | 115 " if (n <= 2) return 1;" |
| 116 " return fib(n-1) + fib(n-2);" | 116 " return fib(n-1) + fib(n-2);" |
| 117 "}" | 117 "}" |
| 118 "fib(10)"); | 118 "fib(10)"); |
| 119 CHECK(v->IsNumber()); | 119 CHECK(v->IsNumber()); |
| 120 CHECK_EQ(55, static_cast<int>(v->NumberValue())); | 120 CHECK_EQ(55, static_cast<int>(v->NumberValue())); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 isolate2->Dispose(); | 335 isolate2->Dispose(); |
| 336 isolate1->Dispose(); | 336 isolate1->Dispose(); |
| 337 } | 337 } |
| 338 | 338 |
| 339 class LockIsolateAndCalculateFibSharedContextThread : public JoinableThread { | 339 class LockIsolateAndCalculateFibSharedContextThread : public JoinableThread { |
| 340 public: | 340 public: |
| 341 explicit LockIsolateAndCalculateFibSharedContextThread( | 341 explicit LockIsolateAndCalculateFibSharedContextThread( |
| 342 v8::Isolate* isolate, v8::Handle<v8::Context> context) | 342 v8::Isolate* isolate, v8::Handle<v8::Context> context) |
| 343 : JoinableThread("LockIsolateAndCalculateFibThread"), | 343 : JoinableThread("LockIsolateAndCalculateFibThread"), |
| 344 isolate_(isolate), | 344 isolate_(isolate), |
| 345 context_(context) { | 345 context_(isolate, context) { |
| 346 } | 346 } |
| 347 | 347 |
| 348 virtual void Run() { | 348 virtual void Run() { |
| 349 v8::Locker lock(isolate_); | 349 v8::Locker lock(isolate_); |
| 350 v8::Isolate::Scope isolate_scope(isolate_); | 350 v8::Isolate::Scope isolate_scope(isolate_); |
| 351 HandleScope handle_scope(isolate_); | 351 HandleScope handle_scope(isolate_); |
| 352 v8::Context::Scope context_scope(context_); | 352 v8::Context::Scope context_scope(context_); |
| 353 CalcFibAndCheck(); | 353 CalcFibAndCheck(); |
| 354 } | 354 } |
| 355 private: | 355 private: |
| 356 v8::Isolate* isolate_; | 356 v8::Isolate* isolate_; |
| 357 Persistent<v8::Context> context_; | 357 Persistent<v8::Context> context_; |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 class LockerUnlockerThread : public JoinableThread { | 360 class LockerUnlockerThread : public JoinableThread { |
| 361 public: | 361 public: |
| 362 explicit LockerUnlockerThread(v8::Isolate* isolate) | 362 explicit LockerUnlockerThread(v8::Isolate* isolate) |
| 363 : JoinableThread("LockerUnlockerThread"), | 363 : JoinableThread("LockerUnlockerThread"), |
| 364 isolate_(isolate) { | 364 isolate_(isolate) { |
| 365 } | 365 } |
| 366 | 366 |
| 367 virtual void Run() { | 367 virtual void Run() { |
| 368 v8::Locker lock(isolate_); | 368 v8::Locker lock(isolate_); |
| 369 v8::Isolate::Scope isolate_scope(isolate_); | 369 v8::Isolate::Scope isolate_scope(isolate_); |
| 370 v8::HandleScope handle_scope(isolate_); | 370 v8::HandleScope handle_scope(isolate_); |
| 371 v8::Handle<v8::Context> context = v8::Context::New(); | 371 v8::Local<v8::Context> context = v8::Context::New(isolate_); |
| 372 { | 372 { |
| 373 v8::Context::Scope context_scope(context); | 373 v8::Context::Scope context_scope(context); |
| 374 CalcFibAndCheck(); | 374 CalcFibAndCheck(); |
| 375 } | 375 } |
| 376 { | 376 { |
| 377 LockIsolateAndCalculateFibSharedContextThread thread(isolate_, context); | |
| 377 isolate_->Exit(); | 378 isolate_->Exit(); |
| 378 v8::Unlocker unlocker(isolate_); | 379 v8::Unlocker unlocker(isolate_); |
| 379 LockIsolateAndCalculateFibSharedContextThread thread(isolate_, context); | |
| 380 thread.Start(); | 380 thread.Start(); |
| 381 thread.Join(); | 381 thread.Join(); |
| 382 } | 382 } |
| 383 isolate_->Enter(); | 383 isolate_->Enter(); |
| 384 { | 384 { |
| 385 v8::Context::Scope context_scope(context); | 385 v8::Context::Scope context_scope(context); |
| 386 CalcFibAndCheck(); | 386 CalcFibAndCheck(); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 411 public: | 411 public: |
| 412 explicit LockTwiceAndUnlockThread(v8::Isolate* isolate) | 412 explicit LockTwiceAndUnlockThread(v8::Isolate* isolate) |
| 413 : JoinableThread("LockTwiceAndUnlockThread"), | 413 : JoinableThread("LockTwiceAndUnlockThread"), |
| 414 isolate_(isolate) { | 414 isolate_(isolate) { |
| 415 } | 415 } |
| 416 | 416 |
| 417 virtual void Run() { | 417 virtual void Run() { |
| 418 v8::Locker lock(isolate_); | 418 v8::Locker lock(isolate_); |
| 419 v8::Isolate::Scope isolate_scope(isolate_); | 419 v8::Isolate::Scope isolate_scope(isolate_); |
| 420 v8::HandleScope handle_scope(isolate_); | 420 v8::HandleScope handle_scope(isolate_); |
| 421 v8::Handle<v8::Context> context = v8::Context::New(); | 421 v8::Local<v8::Context> context = v8::Context::New(isolate_); |
| 422 { | 422 { |
| 423 v8::Context::Scope context_scope(context); | 423 v8::Context::Scope context_scope(context); |
| 424 CalcFibAndCheck(); | 424 CalcFibAndCheck(); |
| 425 } | 425 } |
| 426 { | 426 { |
| 427 v8::Locker second_lock(isolate_); | 427 v8::Locker second_lock(isolate_); |
| 428 { | 428 { |
| 429 LockIsolateAndCalculateFibSharedContextThread thread(isolate_, context); | |
| 429 isolate_->Exit(); | 430 isolate_->Exit(); |
| 430 v8::Unlocker unlocker(isolate_); | 431 v8::Unlocker unlocker(isolate_); |
| 431 LockIsolateAndCalculateFibSharedContextThread thread(isolate_, context); | |
| 432 thread.Start(); | 432 thread.Start(); |
| 433 thread.Join(); | 433 thread.Join(); |
| 434 } | 434 } |
| 435 } | 435 } |
| 436 isolate_->Enter(); | 436 isolate_->Enter(); |
| 437 { | 437 { |
| 438 v8::Context::Scope context_scope(context); | 438 v8::Context::Scope context_scope(context); |
| 439 CalcFibAndCheck(); | 439 CalcFibAndCheck(); |
| 440 } | 440 } |
| 441 } | 441 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 490 { | 490 { |
| 491 v8::Isolate::Scope isolate_scope(isolate2_); | 491 v8::Isolate::Scope isolate_scope(isolate2_); |
| 492 v8::HandleScope handle_scope(isolate2_); | 492 v8::HandleScope handle_scope(isolate2_); |
| 493 context2 = v8::Context::New(); | 493 context2 = v8::Context::New(); |
| 494 { | 494 { |
| 495 v8::Context::Scope context_scope(context2); | 495 v8::Context::Scope context_scope(context2); |
| 496 CalcFibAndCheck(); | 496 CalcFibAndCheck(); |
| 497 } | 497 } |
| 498 } | 498 } |
| 499 { | 499 { |
| 500 v8::internal::SmartPointer<LockIsolateAndCalculateFibSharedContextThread> | |
| 501 thread; | |
|
dcarney
2013/04/24 13:13:38
spacing
jochen (gone - plz use gerrit)
2013/04/24 13:15:16
that's the way the google c++ style wants it (sinc
Sven Panne
2013/04/24 13:40:39
Perhaps we can resolve this dispute by using i::Sm
| |
| 502 { | |
| 503 CHECK(v8::Locker::IsLocked(isolate1_)); | |
| 504 v8::Isolate::Scope isolate_scope(isolate1_); | |
| 505 v8::HandleScope handle_scope(isolate1_); | |
| 506 thread.Reset(new LockIsolateAndCalculateFibSharedContextThread( | |
| 507 isolate1_, v8::Local<v8::Context>::New(isolate1_, context1))); | |
| 508 } | |
| 500 v8::Unlocker unlock1(isolate1_); | 509 v8::Unlocker unlock1(isolate1_); |
| 501 CHECK(!v8::Locker::IsLocked(isolate1_)); | 510 CHECK(!v8::Locker::IsLocked(isolate1_)); |
| 502 CHECK(v8::Locker::IsLocked(isolate2_)); | 511 CHECK(v8::Locker::IsLocked(isolate2_)); |
| 503 v8::Isolate::Scope isolate_scope(isolate2_); | 512 v8::Isolate::Scope isolate_scope(isolate2_); |
| 504 v8::HandleScope handle_scope(isolate2_); | 513 v8::HandleScope handle_scope(isolate2_); |
| 505 v8::Context::Scope context_scope(context2); | 514 v8::Context::Scope context_scope(context2); |
| 506 LockIsolateAndCalculateFibSharedContextThread thread(isolate1_, context1); | 515 thread->Start(); |
| 507 thread.Start(); | |
| 508 CalcFibAndCheck(); | 516 CalcFibAndCheck(); |
| 509 thread.Join(); | 517 thread->Join(); |
| 510 } | 518 } |
| 511 } | 519 } |
| 512 | 520 |
| 513 private: | 521 private: |
| 514 v8::Isolate* isolate1_; | 522 v8::Isolate* isolate1_; |
| 515 v8::Isolate* isolate2_; | 523 v8::Isolate* isolate2_; |
| 516 }; | 524 }; |
| 517 | 525 |
| 518 // Lock two isolates and unlock one of them. | 526 // Lock two isolates and unlock one of them. |
| 519 TEST(LockAndUnlockDifferentIsolates) { | 527 TEST(LockAndUnlockDifferentIsolates) { |
| 520 v8::Isolate* isolate1 = v8::Isolate::New(); | 528 v8::Isolate* isolate1 = v8::Isolate::New(); |
| 521 v8::Isolate* isolate2 = v8::Isolate::New(); | 529 v8::Isolate* isolate2 = v8::Isolate::New(); |
| 522 LockAndUnlockDifferentIsolatesThread thread(isolate1, isolate2); | 530 LockAndUnlockDifferentIsolatesThread thread(isolate1, isolate2); |
| 523 thread.Start(); | 531 thread.Start(); |
| 524 thread.Join(); | 532 thread.Join(); |
| 525 isolate2->Dispose(); | 533 isolate2->Dispose(); |
| 526 isolate1->Dispose(); | 534 isolate1->Dispose(); |
| 527 } | 535 } |
| 528 | 536 |
| 529 class LockUnlockLockThread : public JoinableThread { | 537 class LockUnlockLockThread : public JoinableThread { |
| 530 public: | 538 public: |
| 531 LockUnlockLockThread(v8::Isolate* isolate, v8::Handle<v8::Context> context) | 539 LockUnlockLockThread(v8::Isolate* isolate, v8::Local<v8::Context> context) |
| 532 : JoinableThread("LockUnlockLockThread"), | 540 : JoinableThread("LockUnlockLockThread"), |
| 533 isolate_(isolate), | 541 isolate_(isolate), |
| 534 context_(context) { | 542 context_(isolate, context) { |
| 535 } | 543 } |
| 536 | 544 |
| 537 virtual void Run() { | 545 virtual void Run() { |
| 538 v8::Locker lock1(isolate_); | 546 v8::Locker lock1(isolate_); |
| 539 CHECK(v8::Locker::IsLocked(isolate_)); | 547 CHECK(v8::Locker::IsLocked(isolate_)); |
| 540 CHECK(!v8::Locker::IsLocked(CcTest::default_isolate())); | 548 CHECK(!v8::Locker::IsLocked(CcTest::default_isolate())); |
| 541 { | 549 { |
| 542 v8::Isolate::Scope isolate_scope(isolate_); | 550 v8::Isolate::Scope isolate_scope(isolate_); |
| 543 v8::HandleScope handle_scope(isolate_); | 551 v8::HandleScope handle_scope(isolate_); |
| 544 v8::Context::Scope context_scope(context_); | 552 v8::Context::Scope context_scope(context_); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 567 | 575 |
| 568 // Locker inside an Unlocker inside a Locker. | 576 // Locker inside an Unlocker inside a Locker. |
| 569 TEST(LockUnlockLockMultithreaded) { | 577 TEST(LockUnlockLockMultithreaded) { |
| 570 #ifdef V8_TARGET_ARCH_MIPS | 578 #ifdef V8_TARGET_ARCH_MIPS |
| 571 const int kNThreads = 50; | 579 const int kNThreads = 50; |
| 572 #else | 580 #else |
| 573 const int kNThreads = 100; | 581 const int kNThreads = 100; |
| 574 #endif | 582 #endif |
| 575 v8::Isolate* isolate = v8::Isolate::New(); | 583 v8::Isolate* isolate = v8::Isolate::New(); |
| 576 Persistent<v8::Context> context; | 584 Persistent<v8::Context> context; |
| 585 i::List<JoinableThread*> threads(kNThreads); | |
| 577 { | 586 { |
| 578 v8::Locker locker_(isolate); | 587 v8::Locker locker_(isolate); |
| 579 v8::Isolate::Scope isolate_scope(isolate); | 588 v8::Isolate::Scope isolate_scope(isolate); |
| 580 v8::HandleScope handle_scope(isolate); | 589 v8::HandleScope handle_scope(isolate); |
| 581 context = v8::Context::New(); | 590 context = v8::Context::New(); |
| 582 } | 591 for (int i = 0; i < kNThreads; i++) { |
| 583 i::List<JoinableThread*> threads(kNThreads); | 592 threads.Add(new LockUnlockLockThread( |
| 584 for (int i = 0; i < kNThreads; i++) { | 593 isolate, v8::Local<v8::Context>::New(isolate, context))); |
| 585 threads.Add(new LockUnlockLockThread(isolate, context)); | 594 } |
| 586 } | 595 } |
| 587 StartJoinAndDeleteThreads(threads); | 596 StartJoinAndDeleteThreads(threads); |
| 588 isolate->Dispose(); | 597 isolate->Dispose(); |
| 589 } | 598 } |
| 590 | 599 |
| 591 class LockUnlockLockDefaultIsolateThread : public JoinableThread { | 600 class LockUnlockLockDefaultIsolateThread : public JoinableThread { |
| 592 public: | 601 public: |
| 593 explicit LockUnlockLockDefaultIsolateThread(v8::Handle<v8::Context> context) | 602 explicit LockUnlockLockDefaultIsolateThread(v8::Local<v8::Context> context) |
| 594 : JoinableThread("LockUnlockLockDefaultIsolateThread"), | 603 : JoinableThread("LockUnlockLockDefaultIsolateThread"), |
| 595 context_(context) { | 604 context_(CcTest::default_isolate(), context) {} |
| 596 } | |
| 597 | 605 |
| 598 virtual void Run() { | 606 virtual void Run() { |
| 599 v8::Locker lock1(CcTest::default_isolate()); | 607 v8::Locker lock1(CcTest::default_isolate()); |
| 600 { | 608 { |
| 601 v8::HandleScope handle_scope(CcTest::default_isolate()); | 609 v8::HandleScope handle_scope(CcTest::default_isolate()); |
| 602 v8::Context::Scope context_scope(context_); | 610 v8::Context::Scope context_scope(context_); |
| 603 CalcFibAndCheck(); | 611 CalcFibAndCheck(); |
| 604 } | 612 } |
| 605 { | 613 { |
| 606 v8::Unlocker unlock1(CcTest::default_isolate()); | 614 v8::Unlocker unlock1(CcTest::default_isolate()); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 618 }; | 626 }; |
| 619 | 627 |
| 620 // Locker inside an Unlocker inside a Locker for default isolate. | 628 // Locker inside an Unlocker inside a Locker for default isolate. |
| 621 TEST(LockUnlockLockDefaultIsolateMultithreaded) { | 629 TEST(LockUnlockLockDefaultIsolateMultithreaded) { |
| 622 #ifdef V8_TARGET_ARCH_MIPS | 630 #ifdef V8_TARGET_ARCH_MIPS |
| 623 const int kNThreads = 50; | 631 const int kNThreads = 50; |
| 624 #else | 632 #else |
| 625 const int kNThreads = 100; | 633 const int kNThreads = 100; |
| 626 #endif | 634 #endif |
| 627 Persistent<v8::Context> context; | 635 Persistent<v8::Context> context; |
| 636 i::List<JoinableThread*> threads(kNThreads); | |
| 628 { | 637 { |
| 629 v8::Locker locker_(CcTest::default_isolate()); | 638 v8::Locker locker_(CcTest::default_isolate()); |
| 630 v8::HandleScope handle_scope(CcTest::default_isolate()); | 639 v8::HandleScope handle_scope(CcTest::default_isolate()); |
| 631 context = v8::Context::New(); | 640 context = v8::Context::New(); |
| 632 } | 641 for (int i = 0; i < kNThreads; i++) { |
| 633 i::List<JoinableThread*> threads(kNThreads); | 642 threads.Add(new LockUnlockLockDefaultIsolateThread( |
| 634 for (int i = 0; i < kNThreads; i++) { | 643 v8::Local<v8::Context>::New(CcTest::default_isolate(), context))); |
| 635 threads.Add(new LockUnlockLockDefaultIsolateThread(context)); | 644 } |
| 636 } | 645 } |
| 637 StartJoinAndDeleteThreads(threads); | 646 StartJoinAndDeleteThreads(threads); |
| 638 } | 647 } |
| 639 | 648 |
| 640 | 649 |
| 641 TEST(Regress1433) { | 650 TEST(Regress1433) { |
| 642 for (int i = 0; i < 10; i++) { | 651 for (int i = 0; i < 10; i++) { |
| 643 v8::Isolate* isolate = v8::Isolate::New(); | 652 v8::Isolate* isolate = v8::Isolate::New(); |
| 644 { | 653 { |
| 645 v8::Locker lock(isolate); | 654 v8::Locker lock(isolate); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 714 kSimpleExtensionSource)); | 723 kSimpleExtensionSource)); |
| 715 const char* extension_names[] = { "test0", "test1", | 724 const char* extension_names[] = { "test0", "test1", |
| 716 "test2", "test3", "test4", | 725 "test2", "test3", "test4", |
| 717 "test5", "test6", "test7" }; | 726 "test5", "test6", "test7" }; |
| 718 i::List<JoinableThread*> threads(kNThreads); | 727 i::List<JoinableThread*> threads(kNThreads); |
| 719 for (int i = 0; i < kNThreads; i++) { | 728 for (int i = 0; i < kNThreads; i++) { |
| 720 threads.Add(new IsolateGenesisThread(8, extension_names)); | 729 threads.Add(new IsolateGenesisThread(8, extension_names)); |
| 721 } | 730 } |
| 722 StartJoinAndDeleteThreads(threads); | 731 StartJoinAndDeleteThreads(threads); |
| 723 } | 732 } |
| OLD | NEW |