| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now | 619 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now |
| 620 i::Handle<i::String> isymbol = FACTORY->SymbolFromString(istring); | 620 i::Handle<i::String> isymbol = FACTORY->SymbolFromString(istring); |
| 621 CHECK(isymbol->IsSymbol()); | 621 CHECK(isymbol->IsSymbol()); |
| 622 } | 622 } |
| 623 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 623 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 624 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 624 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 625 } | 625 } |
| 626 | 626 |
| 627 | 627 |
| 628 THREADED_TEST(ScavengeExternalString) { | 628 THREADED_TEST(ScavengeExternalString) { |
| 629 i::FLAG_stress_compaction = false; |
| 630 i::FLAG_gc_global = false; |
| 629 int dispose_count = 0; | 631 int dispose_count = 0; |
| 630 bool in_new_space = false; | 632 bool in_new_space = false; |
| 631 { | 633 { |
| 632 v8::HandleScope scope; | 634 v8::HandleScope scope; |
| 633 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); | 635 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); |
| 634 Local<String> string = | 636 Local<String> string = |
| 635 String::NewExternal(new TestResource(two_byte_string, | 637 String::NewExternal(new TestResource(two_byte_string, |
| 636 &dispose_count)); | 638 &dispose_count)); |
| 637 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 639 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
| 638 HEAP->CollectGarbage(i::NEW_SPACE); | 640 HEAP->CollectGarbage(i::NEW_SPACE); |
| 639 in_new_space = HEAP->InNewSpace(*istring); | 641 in_new_space = HEAP->InNewSpace(*istring); |
| 640 CHECK(in_new_space || HEAP->old_data_space()->Contains(*istring)); | 642 CHECK(in_new_space || HEAP->old_data_space()->Contains(*istring)); |
| 641 CHECK_EQ(0, dispose_count); | 643 CHECK_EQ(0, dispose_count); |
| 642 } | 644 } |
| 643 HEAP->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE); | 645 HEAP->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE); |
| 644 CHECK_EQ(1, dispose_count); | 646 CHECK_EQ(1, dispose_count); |
| 645 } | 647 } |
| 646 | 648 |
| 647 | 649 |
| 648 THREADED_TEST(ScavengeExternalAsciiString) { | 650 THREADED_TEST(ScavengeExternalAsciiString) { |
| 651 i::FLAG_stress_compaction = false; |
| 652 i::FLAG_gc_global = false; |
| 649 int dispose_count = 0; | 653 int dispose_count = 0; |
| 650 bool in_new_space = false; | 654 bool in_new_space = false; |
| 651 { | 655 { |
| 652 v8::HandleScope scope; | 656 v8::HandleScope scope; |
| 653 const char* one_byte_string = "test string"; | 657 const char* one_byte_string = "test string"; |
| 654 Local<String> string = String::NewExternal( | 658 Local<String> string = String::NewExternal( |
| 655 new TestAsciiResource(i::StrDup(one_byte_string), &dispose_count)); | 659 new TestAsciiResource(i::StrDup(one_byte_string), &dispose_count)); |
| 656 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 660 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
| 657 HEAP->CollectGarbage(i::NEW_SPACE); | 661 HEAP->CollectGarbage(i::NEW_SPACE); |
| 658 in_new_space = HEAP->InNewSpace(*istring); | 662 in_new_space = HEAP->InNewSpace(*istring); |
| (...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2539 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); | 2543 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); |
| 2540 | 2544 |
| 2541 // All objects should be gone. 7 global handles in total. | 2545 // All objects should be gone. 7 global handles in total. |
| 2542 CHECK_EQ(7, counter.NumberOfWeakCalls()); | 2546 CHECK_EQ(7, counter.NumberOfWeakCalls()); |
| 2543 } | 2547 } |
| 2544 | 2548 |
| 2545 | 2549 |
| 2546 // TODO(mstarzinger): This should be a THREADED_TEST but causes failures | 2550 // TODO(mstarzinger): This should be a THREADED_TEST but causes failures |
| 2547 // on the buildbots, so was made non-threaded for the time being. | 2551 // on the buildbots, so was made non-threaded for the time being. |
| 2548 TEST(ApiObjectGroupsCycleForScavenger) { | 2552 TEST(ApiObjectGroupsCycleForScavenger) { |
| 2553 i::FLAG_stress_compaction = false; |
| 2554 i::FLAG_gc_global = false; |
| 2549 HandleScope scope; | 2555 HandleScope scope; |
| 2550 LocalContext env; | 2556 LocalContext env; |
| 2551 | 2557 |
| 2552 WeakCallCounter counter(1234); | 2558 WeakCallCounter counter(1234); |
| 2553 | 2559 |
| 2554 Persistent<Object> g1s1; | 2560 Persistent<Object> g1s1; |
| 2555 Persistent<Object> g1s2; | 2561 Persistent<Object> g1s2; |
| 2556 Persistent<Object> g2s1; | 2562 Persistent<Object> g2s1; |
| 2557 Persistent<Object> g2s2; | 2563 Persistent<Object> g2s2; |
| 2558 Persistent<Object> g3s1; | 2564 Persistent<Object> g3s1; |
| (...skipping 15433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17992 | 17998 |
| 17993 i::Semaphore* sem_; | 17999 i::Semaphore* sem_; |
| 17994 volatile int sem_value_; | 18000 volatile int sem_value_; |
| 17995 }; | 18001 }; |
| 17996 | 18002 |
| 17997 | 18003 |
| 17998 THREADED_TEST(SemaphoreInterruption) { | 18004 THREADED_TEST(SemaphoreInterruption) { |
| 17999 ThreadInterruptTest().RunTest(); | 18005 ThreadInterruptTest().RunTest(); |
| 18000 } | 18006 } |
| 18001 #endif // WIN32 | 18007 #endif // WIN32 |
| OLD | NEW |