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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 counter_table_[counter] = ptr; | 109 counter_table_[counter] = ptr; |
110 return ptr; | 110 return ptr; |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 // Write C++ code that defines Snapshot::snapshot_ to contain the snapshot | 114 // Write C++ code that defines Snapshot::snapshot_ to contain the snapshot |
115 // to the file given by filename. Only the first size chars are written. | 115 // to the file given by filename. Only the first size chars are written. |
116 static int WriteInternalSnapshotToFile(const char* filename, | 116 static int WriteInternalSnapshotToFile(const char* filename, |
117 const char* str, | 117 const char* str, |
118 int size) { | 118 int size) { |
119 FILE* f = fopen(filename, "wb"); | 119 FILE* f = i::OS::FOpen(filename, "wb"); |
120 if (f == NULL) { | 120 if (f == NULL) { |
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_[] = {"); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 char* str; | 181 char* str; |
182 int len; | 182 int len; |
183 ser.Finalize(&str, &len); | 183 ser.Finalize(&str, &len); |
184 | 184 |
185 WriteInternalSnapshotToFile(argv[1], str, len); | 185 WriteInternalSnapshotToFile(argv[1], str, len); |
186 | 186 |
187 i::DeleteArray(str); | 187 i::DeleteArray(str); |
188 | 188 |
189 return 0; | 189 return 0; |
190 } | 190 } |
OLD | NEW |