| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 virtual ~CppByteSink() { | 113 virtual ~CppByteSink() { |
| 114 if (fp_ != NULL) { | 114 if (fp_ != NULL) { |
| 115 fprintf(fp_, "};\n\n"); | 115 fprintf(fp_, "};\n\n"); |
| 116 fprintf(fp_, "int Snapshot::size_ = %d;\n\n", bytes_written_); | 116 fprintf(fp_, "int Snapshot::size_ = %d;\n\n", bytes_written_); |
| 117 fprintf(fp_, "} } // namespace v8::internal\n"); | 117 fprintf(fp_, "} } // namespace v8::internal\n"); |
| 118 fclose(fp_); | 118 fclose(fp_); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 virtual void Put(int byte, const char* description) { | 122 virtual void Put(int byte, const char* description) { |
| 123 i::SerializerDeserializer::Trace("Put %s: %d\n", description, byte); |
| 123 if (bytes_written_ != 0) { | 124 if (bytes_written_ != 0) { |
| 124 fprintf(fp_, ","); | 125 fprintf(fp_, ","); |
| 125 } | 126 } |
| 126 fprintf(fp_, "%d", byte); | 127 fprintf(fp_, "%d", byte); |
| 127 bytes_written_++; | 128 bytes_written_++; |
| 128 if ((bytes_written_ & 0x3f) == 0) { | 129 if ((bytes_written_ & 0x3f) == 0) { |
| 129 fprintf(fp_, "\n"); | 130 fprintf(fp_, "\n"); |
| 130 } | 131 } |
| 131 } | 132 } |
| 132 | 133 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 165 } |
| 165 context.Dispose(); | 166 context.Dispose(); |
| 166 CppByteSink sink(argv[1]); | 167 CppByteSink sink(argv[1]); |
| 167 // 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 |
| 168 // of some things that are cached between garbage collections. | 169 // of some things that are cached between garbage collections. |
| 169 i::Heap::CollectAllGarbage(true); | 170 i::Heap::CollectAllGarbage(true); |
| 170 i::StartupSerializer ser(&sink); | 171 i::StartupSerializer ser(&sink); |
| 171 ser.Serialize(); | 172 ser.Serialize(); |
| 172 return 0; | 173 return 0; |
| 173 } | 174 } |
| OLD | NEW |