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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 i::OS::PrintError("Cannot open file %s for reading.\n", filename); | 121 i::OS::PrintError("Cannot open file %s for reading.\n", filename); |
122 return 0; | 122 return 0; |
123 } | 123 } |
124 fprintf(f, "// Autogenerated snapshot file. Do not edit.\n\n"); | 124 fprintf(f, "// Autogenerated snapshot file. Do not edit.\n\n"); |
125 fprintf(f, "#include \"v8.h\"\n"); | 125 fprintf(f, "#include \"v8.h\"\n"); |
126 fprintf(f, "#include \"platform.h\"\n\n"); | 126 fprintf(f, "#include \"platform.h\"\n\n"); |
127 fprintf(f, "#include \"snapshot.h\"\n\n"); | 127 fprintf(f, "#include \"snapshot.h\"\n\n"); |
128 fprintf(f, "namespace v8 {\nnamespace internal {\n\n"); | 128 fprintf(f, "namespace v8 {\nnamespace internal {\n\n"); |
129 fprintf(f, "const char Snapshot::data_[] = {"); | 129 fprintf(f, "const char Snapshot::data_[] = {"); |
130 int written = 0; | 130 int written = 0; |
131 written += fprintf(f, "%i", str[0]); | 131 written += fprintf(f, "0x%x", str[0]); |
132 for (int i = 1; i < size; ++i) { | 132 for (int i = 1; i < size; ++i) { |
133 written += fprintf(f, ",%i", str[i]); | 133 written += fprintf(f, ",0x%x", str[i]); |
134 // The following is needed to keep the line length low on Visual C++: | 134 // The following is needed to keep the line length low on Visual C++: |
135 if (i % 512 == 0) fprintf(f, "\n"); | 135 if (i % 512 == 0) fprintf(f, "\n"); |
136 } | 136 } |
137 fprintf(f, "};\n\n"); | 137 fprintf(f, "};\n\n"); |
138 fprintf(f, "int Snapshot::size_ = %d;\n\n", size); | 138 fprintf(f, "int Snapshot::size_ = %d;\n\n", size); |
139 fprintf(f, "} } // namespace v8::internal\n"); | 139 fprintf(f, "} } // namespace v8::internal\n"); |
140 fclose(f); | 140 fclose(f); |
141 return written; | 141 return written; |
142 } | 142 } |
143 | 143 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 char* str; | 177 char* str; |
178 int len; | 178 int len; |
179 ser.Finalize(&str, &len); | 179 ser.Finalize(&str, &len); |
180 | 180 |
181 WriteInternalSnapshotToFile(argv[1], str, len); | 181 WriteInternalSnapshotToFile(argv[1], str, len); |
182 | 182 |
183 i::DeleteArray(str); | 183 i::DeleteArray(str); |
184 | 184 |
185 return 0; | 185 return 0; |
186 } | 186 } |
OLD | NEW |