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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (bytes_written_ != 0) { | 123 if (bytes_written_ != 0) { |
124 fprintf(fp_, ","); | 124 fprintf(fp_, ","); |
125 } | 125 } |
126 fprintf(fp_, "%d", byte); | 126 fprintf(fp_, "%d", byte); |
127 bytes_written_++; | 127 bytes_written_++; |
128 if ((bytes_written_ & 0x3f) == 0) { | 128 if ((bytes_written_ & 0x3f) == 0) { |
129 fprintf(fp_, "\n"); | 129 fprintf(fp_, "\n"); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
| 133 virtual int Position() { |
| 134 return bytes_written_; |
| 135 } |
| 136 |
133 private: | 137 private: |
134 FILE* fp_; | 138 FILE* fp_; |
135 int bytes_written_; | 139 int bytes_written_; |
136 }; | 140 }; |
137 | 141 |
138 | 142 |
139 int main(int argc, char** argv) { | 143 int main(int argc, char** argv) { |
140 #ifdef ENABLE_LOGGING_AND_PROFILING | 144 #ifdef ENABLE_LOGGING_AND_PROFILING |
141 // By default, log code create information in the snapshot. | 145 // By default, log code create information in the snapshot. |
142 i::FLAG_log_code = true; | 146 i::FLAG_log_code = true; |
(...skipping 17 matching lines...) Expand all Loading... |
160 } | 164 } |
161 context.Dispose(); | 165 context.Dispose(); |
162 CppByteSink sink(argv[1]); | 166 CppByteSink sink(argv[1]); |
163 i::Serializer ser(&sink); | 167 i::Serializer ser(&sink); |
164 // This results in a somewhat smaller snapshot, probably because it gets rid | 168 // This results in a somewhat smaller snapshot, probably because it gets rid |
165 // of some things that are cached between garbage collections. | 169 // of some things that are cached between garbage collections. |
166 i::Heap::CollectAllGarbage(true); | 170 i::Heap::CollectAllGarbage(true); |
167 ser.Serialize(); | 171 ser.Serialize(); |
168 return 0; | 172 return 0; |
169 } | 173 } |
OLD | NEW |