OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 bool Snapshot::Initialize2(const char* snapshot_file) { | 69 bool Snapshot::Initialize2(const char* snapshot_file) { |
70 if (snapshot_file) { | 70 if (snapshot_file) { |
71 int len; | 71 int len; |
72 byte* str = ReadBytes(snapshot_file, &len); | 72 byte* str = ReadBytes(snapshot_file, &len); |
73 if (!str) return false; | 73 if (!str) return false; |
74 Deserialize2(str, len); | 74 Deserialize2(str, len); |
75 DeleteArray(str); | 75 DeleteArray(str); |
| 76 return true; |
76 } else if (size_ > 0) { | 77 } else if (size_ > 0) { |
77 Deserialize2(data_, size_); | 78 Deserialize2(data_, size_); |
| 79 return true; |
78 } | 80 } |
79 return true; | 81 return false; |
80 } | 82 } |
81 | 83 |
82 | 84 |
83 bool Snapshot::WriteToFile(const char* snapshot_file) { | 85 bool Snapshot::WriteToFile(const char* snapshot_file) { |
84 Serializer ser; | 86 Serializer ser; |
85 ser.Serialize(); | 87 ser.Serialize(); |
86 byte* str; | 88 byte* str; |
87 int len; | 89 int len; |
88 ser.Finalize(&str, &len); | 90 ser.Finalize(&str, &len); |
89 | 91 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 bool Snapshot::WriteToFile2(const char* snapshot_file) { | 124 bool Snapshot::WriteToFile2(const char* snapshot_file) { |
123 FileByteSink file(snapshot_file); | 125 FileByteSink file(snapshot_file); |
124 Serializer2 ser(&file); | 126 Serializer2 ser(&file); |
125 ser.Serialize(); | 127 ser.Serialize(); |
126 return true; | 128 return true; |
127 } | 129 } |
128 | 130 |
129 | 131 |
130 | 132 |
131 } } // namespace v8::internal | 133 } } // namespace v8::internal |
OLD | NEW |