OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 CHECK(IsCompiled("f")); | 847 CHECK(IsCompiled("f")); |
848 CHECK(IsCompiled("Math.sin")); | 848 CHECK(IsCompiled("Math.sin")); |
849 CHECK(!IsCompiled("g")); | 849 CHECK(!IsCompiled("g")); |
850 CHECK(!IsCompiled("Math.cos")); | 850 CHECK(!IsCompiled("Math.cos")); |
851 CHECK(!IsCompiled("Math.tan")); | 851 CHECK(!IsCompiled("Math.tan")); |
852 CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); | 852 CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); |
853 } | 853 } |
854 isolate->Dispose(); | 854 isolate->Dispose(); |
855 } | 855 } |
856 | 856 |
| 857 TEST(CustomSnapshotDataBlobImmortalImmovableRoots) { |
| 858 DisableTurbofan(); |
| 859 // Flood the startup snapshot with shared function infos. If they are |
| 860 // serialized before the immortal immovable root, the root will no longer end |
| 861 // up on the first page. |
| 862 Vector<const uint8_t> source = |
| 863 ConstructSource(STATIC_CHAR_VECTOR("var a = [];"), |
| 864 STATIC_CHAR_VECTOR("a.push(function() {return 7});"), |
| 865 STATIC_CHAR_VECTOR("\0"), 10000); |
| 866 |
| 867 v8::StartupData data = v8::V8::CreateSnapshotDataBlob( |
| 868 reinterpret_cast<const char*>(source.start())); |
| 869 |
| 870 v8::Isolate::CreateParams params; |
| 871 params.snapshot_blob = &data; |
| 872 params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 873 |
| 874 v8::Isolate* isolate = v8::Isolate::New(params); |
| 875 { |
| 876 v8::Isolate::Scope i_scope(isolate); |
| 877 v8::HandleScope h_scope(isolate); |
| 878 v8::Local<v8::Context> context = v8::Context::New(isolate); |
| 879 delete[] data.data; // We can dispose of the snapshot blob now. |
| 880 v8::Context::Scope c_scope(context); |
| 881 CHECK_EQ(7, CompileRun("a[0]()")->Int32Value(context).FromJust()); |
| 882 } |
| 883 isolate->Dispose(); |
| 884 source.Dispose(); |
| 885 } |
| 886 |
857 TEST(TestThatAlwaysSucceeds) { | 887 TEST(TestThatAlwaysSucceeds) { |
858 } | 888 } |
859 | 889 |
860 | 890 |
861 TEST(TestThatAlwaysFails) { | 891 TEST(TestThatAlwaysFails) { |
862 bool ArtificialFailure = false; | 892 bool ArtificialFailure = false; |
863 CHECK(ArtificialFailure); | 893 CHECK(ArtificialFailure); |
864 } | 894 } |
865 | 895 |
866 | 896 |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 delete script_data; | 1833 delete script_data; |
1804 } | 1834 } |
1805 | 1835 |
1806 | 1836 |
1807 TEST(SerializationMemoryStats) { | 1837 TEST(SerializationMemoryStats) { |
1808 FLAG_profile_deserialization = true; | 1838 FLAG_profile_deserialization = true; |
1809 FLAG_always_opt = false; | 1839 FLAG_always_opt = false; |
1810 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 1840 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
1811 delete[] blob.data; | 1841 delete[] blob.data; |
1812 } | 1842 } |
OLD | NEW |