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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 { | 757 { |
758 v8::HandleScope scope(CcTest::isolate()); | 758 v8::HandleScope scope(CcTest::isolate()); |
759 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); | 759 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); |
760 Local<String> string = String::NewExternal( | 760 Local<String> string = String::NewExternal( |
761 CcTest::isolate(), new TestResource(two_byte_string)); | 761 CcTest::isolate(), new TestResource(two_byte_string)); |
762 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 762 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
763 // Trigger GCs so that the newly allocated string moves to old gen. | 763 // Trigger GCs so that the newly allocated string moves to old gen. |
764 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now | 764 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now |
765 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now | 765 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now |
766 i::Handle<i::String> isymbol = | 766 i::Handle<i::String> isymbol = |
767 factory->InternalizedStringFromString(istring); | 767 factory->InternalizeString(istring); |
768 CHECK(isymbol->IsInternalizedString()); | 768 CHECK(isymbol->IsInternalizedString()); |
769 } | 769 } |
770 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 770 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
771 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 771 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
772 } | 772 } |
773 | 773 |
774 | 774 |
775 THREADED_TEST(UsingExternalAsciiString) { | 775 THREADED_TEST(UsingExternalAsciiString) { |
776 i::Factory* factory = CcTest::i_isolate()->factory(); | 776 i::Factory* factory = CcTest::i_isolate()->factory(); |
777 { | 777 { |
778 v8::HandleScope scope(CcTest::isolate()); | 778 v8::HandleScope scope(CcTest::isolate()); |
779 const char* one_byte_string = "test string"; | 779 const char* one_byte_string = "test string"; |
780 Local<String> string = String::NewExternal( | 780 Local<String> string = String::NewExternal( |
781 CcTest::isolate(), new TestAsciiResource(i::StrDup(one_byte_string))); | 781 CcTest::isolate(), new TestAsciiResource(i::StrDup(one_byte_string))); |
782 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 782 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
783 // Trigger GCs so that the newly allocated string moves to old gen. | 783 // Trigger GCs so that the newly allocated string moves to old gen. |
784 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now | 784 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now |
785 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now | 785 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now |
786 i::Handle<i::String> isymbol = | 786 i::Handle<i::String> isymbol = |
787 factory->InternalizedStringFromString(istring); | 787 factory->InternalizeString(istring); |
788 CHECK(isymbol->IsInternalizedString()); | 788 CHECK(isymbol->IsInternalizedString()); |
789 } | 789 } |
790 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 790 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
791 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 791 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
792 } | 792 } |
793 | 793 |
794 | 794 |
795 THREADED_TEST(ScavengeExternalString) { | 795 THREADED_TEST(ScavengeExternalString) { |
796 i::FLAG_stress_compaction = false; | 796 i::FLAG_stress_compaction = false; |
797 i::FLAG_gc_global = false; | 797 i::FLAG_gc_global = false; |
(...skipping 21304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22102 Local<Object> ApiCallOptimizationChecker::holder; | 22102 Local<Object> ApiCallOptimizationChecker::holder; |
22103 Local<Object> ApiCallOptimizationChecker::callee; | 22103 Local<Object> ApiCallOptimizationChecker::callee; |
22104 int ApiCallOptimizationChecker::count = 0; | 22104 int ApiCallOptimizationChecker::count = 0; |
22105 | 22105 |
22106 | 22106 |
22107 TEST(TestFunctionCallOptimization) { | 22107 TEST(TestFunctionCallOptimization) { |
22108 i::FLAG_allow_natives_syntax = true; | 22108 i::FLAG_allow_natives_syntax = true; |
22109 ApiCallOptimizationChecker checker; | 22109 ApiCallOptimizationChecker checker; |
22110 checker.RunAll(); | 22110 checker.RunAll(); |
22111 } | 22111 } |
OLD | NEW |