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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 i::PrintF("Writing snapshot file failed.. Aborting.\n"); | 86 i::PrintF("Writing snapshot file failed.. Aborting.\n"); |
87 exit(1); | 87 exit(1); |
88 } | 88 } |
89 fclose(file); | 89 fclose(file); |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 static bool WriteToFile(Isolate* isolate, const char* snapshot_file) { | 93 static bool WriteToFile(Isolate* isolate, const char* snapshot_file) { |
94 SnapshotByteSink sink; | 94 SnapshotByteSink sink; |
95 StartupSerializer ser(isolate, &sink); | 95 StartupSerializer ser(isolate, &sink); |
96 ser.Serialize(); | 96 ser.SerializeStrongReferences(); |
| 97 ser.SerializeWeakReferencesAndDeferred(); |
97 SnapshotData snapshot_data(ser); | 98 SnapshotData snapshot_data(ser); |
98 WritePayload(snapshot_data.RawData(), snapshot_file); | 99 WritePayload(snapshot_data.RawData(), snapshot_file); |
99 return true; | 100 return true; |
100 } | 101 } |
101 | 102 |
102 | 103 |
103 static void Serialize(v8::Isolate* isolate) { | 104 static void Serialize(v8::Isolate* isolate) { |
104 // We have to create one context. One reason for this is so that the builtins | 105 // We have to create one context. One reason for this is so that the builtins |
105 // can be loaded from v8natives.js and their addresses can be processed. This | 106 // can be loaded from v8natives.js and their addresses can be processed. This |
106 // will clear the pending fixups array, which would otherwise contain GC roots | 107 // will clear the pending fixups array, which would otherwise contain GC roots |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 delete script_data; | 1765 delete script_data; |
1765 } | 1766 } |
1766 | 1767 |
1767 | 1768 |
1768 TEST(SerializationMemoryStats) { | 1769 TEST(SerializationMemoryStats) { |
1769 FLAG_profile_deserialization = true; | 1770 FLAG_profile_deserialization = true; |
1770 FLAG_always_opt = false; | 1771 FLAG_always_opt = false; |
1771 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 1772 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
1772 delete[] blob.data; | 1773 delete[] blob.data; |
1773 } | 1774 } |
OLD | NEW |