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

Side by Side Diff: src/api.cc

Issue 6901090: Add support for startup data (snapshot) compression. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The version I'll commit Created 9 years, 7 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 | « samples/shell.cc ('k') | src/d8.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 304 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
305 if (isolate != NULL) 305 if (isolate != NULL)
306 return isolate; 306 return isolate;
307 307
308 i::Isolate::EnterDefaultIsolate(); 308 i::Isolate::EnterDefaultIsolate();
309 isolate = i::Isolate::Current(); 309 isolate = i::Isolate::Current();
310 return isolate; 310 return isolate;
311 } 311 }
312 312
313 313
314 StartupData::CompressionAlgorithm V8::GetCompressedStartupDataAlgorithm() {
315 #ifdef COMPRESS_STARTUP_DATA_BZ2
316 return StartupData::kBZip2;
317 #else
318 return StartupData::kUncompressed;
319 #endif
320 }
321
322
323 enum CompressedStartupDataItems {
324 kSnapshot = 0,
325 kSnapshotContext,
326 kCompressedStartupDataCount
327 };
328
329 int V8::GetCompressedStartupDataCount() {
330 #ifdef COMPRESS_STARTUP_DATA_BZ2
331 return kCompressedStartupDataCount;
332 #else
333 return 0;
334 #endif
335 }
336
337
338 void V8::GetCompressedStartupData(StartupData* compressed_data) {
339 #ifdef COMPRESS_STARTUP_DATA_BZ2
340 compressed_data[kSnapshot].data =
341 reinterpret_cast<const char*>(i::Snapshot::data());
342 compressed_data[kSnapshot].compressed_size = i::Snapshot::size();
343 compressed_data[kSnapshot].raw_size = i::Snapshot::raw_size();
344
345 compressed_data[kSnapshotContext].data =
346 reinterpret_cast<const char*>(i::Snapshot::context_data());
347 compressed_data[kSnapshotContext].compressed_size =
348 i::Snapshot::context_size();
349 compressed_data[kSnapshotContext].raw_size = i::Snapshot::context_raw_size();
350 #endif
351 }
352
353
354 void V8::SetDecompressedStartupData(StartupData* decompressed_data) {
355 #ifdef COMPRESS_STARTUP_DATA_BZ2
356 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size);
357 i::Snapshot::set_raw_data(
358 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data));
359
360 ASSERT_EQ(i::Snapshot::context_raw_size(),
361 decompressed_data[kSnapshotContext].raw_size);
362 i::Snapshot::set_context_raw_data(
363 reinterpret_cast<const i::byte*>(
364 decompressed_data[kSnapshotContext].data));
365 #endif
366 }
367
368
314 void V8::SetFatalErrorHandler(FatalErrorCallback that) { 369 void V8::SetFatalErrorHandler(FatalErrorCallback that) {
315 i::Isolate* isolate = EnterIsolateIfNeeded(); 370 i::Isolate* isolate = EnterIsolateIfNeeded();
316 isolate->set_exception_behavior(that); 371 isolate->set_exception_behavior(that);
317 } 372 }
318 373
319 374
320 #ifdef DEBUG 375 #ifdef DEBUG
321 void ImplementationUtilities::ZapHandleRange(i::Object** begin, 376 void ImplementationUtilities::ZapHandleRange(i::Object** begin,
322 i::Object** end) { 377 i::Object** end) {
323 i::HandleScope::ZapRange(begin, end); 378 i::HandleScope::ZapRange(begin, end);
(...skipping 5361 matching lines...) Expand 10 before | Expand all | Expand 10 after
5685 5740
5686 5741
5687 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5742 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5688 HandleScopeImplementer* scope_implementer = 5743 HandleScopeImplementer* scope_implementer =
5689 reinterpret_cast<HandleScopeImplementer*>(storage); 5744 reinterpret_cast<HandleScopeImplementer*>(storage);
5690 scope_implementer->IterateThis(v); 5745 scope_implementer->IterateThis(v);
5691 return storage + ArchiveSpacePerThread(); 5746 return storage + ArchiveSpacePerThread();
5692 } 5747 }
5693 5748
5694 } } // namespace v8::internal 5749 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « samples/shell.cc ('k') | src/d8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698