OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring); | 562 i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring); |
563 CHECK(isymbol->IsSymbol()); | 563 CHECK(isymbol->IsSymbol()); |
564 } | 564 } |
565 i::Heap::CollectAllGarbage(false); | 565 i::Heap::CollectAllGarbage(false); |
566 i::Heap::CollectAllGarbage(false); | 566 i::Heap::CollectAllGarbage(false); |
567 } | 567 } |
568 | 568 |
569 | 569 |
570 THREADED_TEST(ScavengeExternalString) { | 570 THREADED_TEST(ScavengeExternalString) { |
571 TestResource::dispose_count = 0; | 571 TestResource::dispose_count = 0; |
| 572 bool in_new_space = false; |
572 { | 573 { |
573 v8::HandleScope scope; | 574 v8::HandleScope scope; |
574 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); | 575 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); |
575 Local<String> string = | 576 Local<String> string = |
576 String::NewExternal(new TestResource(two_byte_string)); | 577 String::NewExternal(new TestResource(two_byte_string)); |
577 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 578 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
578 i::Heap::CollectGarbage(0, i::NEW_SPACE); | 579 i::Heap::CollectGarbage(0, i::NEW_SPACE); |
579 CHECK(i::Heap::InNewSpace(*istring)); | 580 in_new_space = i::Heap::InNewSpace(*istring); |
| 581 CHECK(in_new_space || i::Heap::old_data_space()->Contains(*istring)); |
580 CHECK_EQ(0, TestResource::dispose_count); | 582 CHECK_EQ(0, TestResource::dispose_count); |
581 } | 583 } |
582 i::Heap::CollectGarbage(0, i::NEW_SPACE); | 584 i::Heap::CollectGarbage(0, in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE); |
583 CHECK_EQ(1, TestResource::dispose_count); | 585 CHECK_EQ(1, TestResource::dispose_count); |
584 } | 586 } |
585 | 587 |
586 | 588 |
587 THREADED_TEST(ScavengeExternalAsciiString) { | 589 THREADED_TEST(ScavengeExternalAsciiString) { |
588 TestAsciiResource::dispose_count = 0; | 590 TestAsciiResource::dispose_count = 0; |
| 591 bool in_new_space = false; |
589 { | 592 { |
590 v8::HandleScope scope; | 593 v8::HandleScope scope; |
591 const char* one_byte_string = "test string"; | 594 const char* one_byte_string = "test string"; |
592 Local<String> string = String::NewExternal( | 595 Local<String> string = String::NewExternal( |
593 new TestAsciiResource(i::StrDup(one_byte_string))); | 596 new TestAsciiResource(i::StrDup(one_byte_string))); |
594 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 597 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
595 i::Heap::CollectGarbage(0, i::NEW_SPACE); | 598 i::Heap::CollectGarbage(0, i::NEW_SPACE); |
596 CHECK(i::Heap::InNewSpace(*istring)); | 599 in_new_space = i::Heap::InNewSpace(*istring); |
| 600 CHECK(in_new_space || i::Heap::old_data_space()->Contains(*istring)); |
597 CHECK_EQ(0, TestAsciiResource::dispose_count); | 601 CHECK_EQ(0, TestAsciiResource::dispose_count); |
598 } | 602 } |
599 i::Heap::CollectGarbage(0, i::NEW_SPACE); | 603 i::Heap::CollectGarbage(0, in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE); |
600 CHECK_EQ(1, TestAsciiResource::dispose_count); | 604 CHECK_EQ(1, TestAsciiResource::dispose_count); |
601 } | 605 } |
602 | 606 |
603 | 607 |
604 THREADED_TEST(StringConcat) { | 608 THREADED_TEST(StringConcat) { |
605 { | 609 { |
606 v8::HandleScope scope; | 610 v8::HandleScope scope; |
607 LocalContext env; | 611 LocalContext env; |
608 const char* one_byte_string_1 = "function a_times_t"; | 612 const char* one_byte_string_1 = "function a_times_t"; |
609 const char* two_byte_string_1 = "wo_plus_b(a, b) {return "; | 613 const char* two_byte_string_1 = "wo_plus_b(a, b) {return "; |
(...skipping 9534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10144 CHECK_EQ(2, prologue_call_count_second); | 10148 CHECK_EQ(2, prologue_call_count_second); |
10145 CHECK_EQ(2, epilogue_call_count_second); | 10149 CHECK_EQ(2, epilogue_call_count_second); |
10146 v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond); | 10150 v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond); |
10147 v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond); | 10151 v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond); |
10148 i::Heap::CollectAllGarbage(false); | 10152 i::Heap::CollectAllGarbage(false); |
10149 CHECK_EQ(2, prologue_call_count); | 10153 CHECK_EQ(2, prologue_call_count); |
10150 CHECK_EQ(2, epilogue_call_count); | 10154 CHECK_EQ(2, epilogue_call_count); |
10151 CHECK_EQ(2, prologue_call_count_second); | 10155 CHECK_EQ(2, prologue_call_count_second); |
10152 CHECK_EQ(2, epilogue_call_count_second); | 10156 CHECK_EQ(2, epilogue_call_count_second); |
10153 } | 10157 } |
OLD | NEW |