Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: src/mksnapshot.cc

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips64/stub-cache-mips64.cc ('k') | src/natives-external.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #ifdef COMPRESS_STARTUP_DATA_BZ2 7 #ifdef COMPRESS_STARTUP_DATA_BZ2
8 #include <bzlib.h> 8 #include <bzlib.h>
9 #endif 9 #endif
10 #include <signal.h> 10 #include <signal.h>
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (!compressor_) { 141 if (!compressor_) {
142 data_to_be_written = &source_data; 142 data_to_be_written = &source_data;
143 } else if (compressor_->Compress(source_data.ToVector())) { 143 } else if (compressor_->Compress(source_data.ToVector())) {
144 compressed_data.AddAll(*compressor_->output()); 144 compressed_data.AddAll(*compressor_->output());
145 data_to_be_written = &compressed_data; 145 data_to_be_written = &compressed_data;
146 } else { 146 } else {
147 i::PrintF("Compression failed. Aborting.\n"); 147 i::PrintF("Compression failed. Aborting.\n");
148 exit(1); 148 exit(1);
149 } 149 }
150 150
151 ASSERT(data_to_be_written); 151 DCHECK(data_to_be_written);
152 MaybeWriteRawFile(data_to_be_written, raw_file); 152 MaybeWriteRawFile(data_to_be_written, raw_file);
153 WriteData(prefix, source_data, data_to_be_written); 153 WriteData(prefix, source_data, data_to_be_written);
154 } 154 }
155 155
156 void MaybeWriteRawFile(const i::List<i::byte>* data, FILE* raw_file) const { 156 void MaybeWriteRawFile(const i::List<i::byte>* data, FILE* raw_file) const {
157 if (!data || !raw_file) 157 if (!data || !raw_file)
158 return; 158 return;
159 159
160 // Sanity check, whether i::List iterators truly return pointers to an 160 // Sanity check, whether i::List iterators truly return pointers to an
161 // internal array. 161 // internal array.
162 ASSERT(data->end() - data->begin() == data->length()); 162 DCHECK(data->end() - data->begin() == data->length());
163 163
164 size_t written = fwrite(data->begin(), 1, data->length(), raw_file); 164 size_t written = fwrite(data->begin(), 1, data->length(), raw_file);
165 if (written != (size_t)data->length()) { 165 if (written != (size_t)data->length()) {
166 i::PrintF("Writing raw file failed.. Aborting.\n"); 166 i::PrintF("Writing raw file failed.. Aborting.\n");
167 exit(1); 167 exit(1);
168 } 168 }
169 } 169 }
170 170
171 void WriteData(const char* prefix, const i::List<i::byte>& source_data, 171 void WriteData(const char* prefix, const i::List<i::byte>& source_data,
172 const i::List<i::byte>* data_to_be_written) const { 172 const i::List<i::byte>* data_to_be_written) const {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 class BZip2Decompressor : public StartupDataDecompressor { 266 class BZip2Decompressor : public StartupDataDecompressor {
267 public: 267 public:
268 virtual ~BZip2Decompressor() { } 268 virtual ~BZip2Decompressor() { }
269 269
270 protected: 270 protected:
271 virtual int DecompressData(char* raw_data, 271 virtual int DecompressData(char* raw_data,
272 int* raw_data_size, 272 int* raw_data_size,
273 const char* compressed_data, 273 const char* compressed_data,
274 int compressed_data_size) { 274 int compressed_data_size) {
275 ASSERT_EQ(StartupData::kBZip2, 275 DCHECK_EQ(StartupData::kBZip2,
276 V8::GetCompressedStartupDataAlgorithm()); 276 V8::GetCompressedStartupDataAlgorithm());
277 unsigned int decompressed_size = *raw_data_size; 277 unsigned int decompressed_size = *raw_data_size;
278 int result = 278 int result =
279 BZ2_bzBuffToBuffDecompress(raw_data, 279 BZ2_bzBuffToBuffDecompress(raw_data,
280 &decompressed_size, 280 &decompressed_size,
281 const_cast<char*>(compressed_data), 281 const_cast<char*>(compressed_data),
282 compressed_data_size, 282 compressed_data_size,
283 0, 1); 283 0, 1);
284 if (result == BZ_OK) { 284 if (result == BZ_OK) {
285 *raw_data_size = decompressed_size; 285 *raw_data_size = decompressed_size;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); 426 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser);
427 } 427 }
428 } 428 }
429 429
430 isolate->Dispose(); 430 isolate->Dispose();
431 V8::Dispose(); 431 V8::Dispose();
432 V8::ShutdownPlatform(); 432 V8::ShutdownPlatform();
433 delete platform; 433 delete platform;
434 return 0; 434 return 0;
435 } 435 }
OLDNEW
« no previous file with comments | « src/mips64/stub-cache-mips64.cc ('k') | src/natives-external.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698