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

Side by Side Diff: src/api.cc

Issue 7066048: Compress sources of JS libraries in addition to the snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 9 years, 6 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
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 20 matching lines...) Expand all
31 31
32 #include "arguments.h" 32 #include "arguments.h"
33 #include "bootstrapper.h" 33 #include "bootstrapper.h"
34 #include "compiler.h" 34 #include "compiler.h"
35 #include "debug.h" 35 #include "debug.h"
36 #include "deoptimizer.h" 36 #include "deoptimizer.h"
37 #include "execution.h" 37 #include "execution.h"
38 #include "global-handles.h" 38 #include "global-handles.h"
39 #include "heap-profiler.h" 39 #include "heap-profiler.h"
40 #include "messages.h" 40 #include "messages.h"
41 #include "natives.h"
41 #include "parser.h" 42 #include "parser.h"
42 #include "platform.h" 43 #include "platform.h"
43 #include "profile-generator-inl.h" 44 #include "profile-generator-inl.h"
44 #include "runtime-profiler.h" 45 #include "runtime-profiler.h"
45 #include "serialize.h" 46 #include "serialize.h"
46 #include "snapshot.h" 47 #include "snapshot.h"
47 #include "v8threads.h" 48 #include "v8threads.h"
48 #include "version.h" 49 #include "version.h"
49 #include "vm-state-inl.h" 50 #include "vm-state-inl.h"
50 51
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return StartupData::kBZip2; 317 return StartupData::kBZip2;
317 #else 318 #else
318 return StartupData::kUncompressed; 319 return StartupData::kUncompressed;
319 #endif 320 #endif
320 } 321 }
321 322
322 323
323 enum CompressedStartupDataItems { 324 enum CompressedStartupDataItems {
324 kSnapshot = 0, 325 kSnapshot = 0,
325 kSnapshotContext, 326 kSnapshotContext,
327 kLibraries,
328 kExperimentalLibraries,
326 kCompressedStartupDataCount 329 kCompressedStartupDataCount
327 }; 330 };
328 331
329 int V8::GetCompressedStartupDataCount() { 332 int V8::GetCompressedStartupDataCount() {
330 #ifdef COMPRESS_STARTUP_DATA_BZ2 333 #ifdef COMPRESS_STARTUP_DATA_BZ2
331 return kCompressedStartupDataCount; 334 return kCompressedStartupDataCount;
332 #else 335 #else
333 return 0; 336 return 0;
334 #endif 337 #endif
335 } 338 }
336 339
337 340
338 void V8::GetCompressedStartupData(StartupData* compressed_data) { 341 void V8::GetCompressedStartupData(StartupData* compressed_data) {
339 #ifdef COMPRESS_STARTUP_DATA_BZ2 342 #ifdef COMPRESS_STARTUP_DATA_BZ2
340 compressed_data[kSnapshot].data = 343 compressed_data[kSnapshot].data =
341 reinterpret_cast<const char*>(i::Snapshot::data()); 344 reinterpret_cast<const char*>(i::Snapshot::data());
342 compressed_data[kSnapshot].compressed_size = i::Snapshot::size(); 345 compressed_data[kSnapshot].compressed_size = i::Snapshot::size();
343 compressed_data[kSnapshot].raw_size = i::Snapshot::raw_size(); 346 compressed_data[kSnapshot].raw_size = i::Snapshot::raw_size();
344 347
345 compressed_data[kSnapshotContext].data = 348 compressed_data[kSnapshotContext].data =
346 reinterpret_cast<const char*>(i::Snapshot::context_data()); 349 reinterpret_cast<const char*>(i::Snapshot::context_data());
347 compressed_data[kSnapshotContext].compressed_size = 350 compressed_data[kSnapshotContext].compressed_size =
348 i::Snapshot::context_size(); 351 i::Snapshot::context_size();
349 compressed_data[kSnapshotContext].raw_size = i::Snapshot::context_raw_size(); 352 compressed_data[kSnapshotContext].raw_size = i::Snapshot::context_raw_size();
353
354 i::Vector<const i::byte> libraries_source = i::Natives::GetScriptsSource();
355 compressed_data[kLibraries].data =
356 reinterpret_cast<const char*>(libraries_source.start());
357 compressed_data[kLibraries].compressed_size = libraries_source.length();
358 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize();
359
360 i::Vector<const i::byte> exp_libraries_source =
361 i::ExperimentalNatives::GetScriptsSource();
362 compressed_data[kExperimentalLibraries].data =
363 reinterpret_cast<const char*>(exp_libraries_source.start());
364 compressed_data[kExperimentalLibraries].compressed_size =
365 exp_libraries_source.length();
366 compressed_data[kExperimentalLibraries].raw_size =
367 i::ExperimentalNatives::GetRawScriptsSize();
350 #endif 368 #endif
351 } 369 }
352 370
353 371
354 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { 372 void V8::SetDecompressedStartupData(StartupData* decompressed_data) {
355 #ifdef COMPRESS_STARTUP_DATA_BZ2 373 #ifdef COMPRESS_STARTUP_DATA_BZ2
356 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); 374 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size);
357 i::Snapshot::set_raw_data( 375 i::Snapshot::set_raw_data(
358 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); 376 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data));
359 377
360 ASSERT_EQ(i::Snapshot::context_raw_size(), 378 ASSERT_EQ(i::Snapshot::context_raw_size(),
361 decompressed_data[kSnapshotContext].raw_size); 379 decompressed_data[kSnapshotContext].raw_size);
362 i::Snapshot::set_context_raw_data( 380 i::Snapshot::set_context_raw_data(
363 reinterpret_cast<const i::byte*>( 381 reinterpret_cast<const i::byte*>(
364 decompressed_data[kSnapshotContext].data)); 382 decompressed_data[kSnapshotContext].data));
383
384 ASSERT_EQ(i::Natives::GetRawScriptsSize(),
385 decompressed_data[kLibraries].raw_size);
386 i::Vector<const char> libraries_source(
387 decompressed_data[kLibraries].data,
388 decompressed_data[kLibraries].raw_size);
389 i::Natives::SetRawScriptsSource(libraries_source);
390
391 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(),
392 decompressed_data[kExperimentalLibraries].raw_size);
393 i::Vector<const char> exp_libraries_source(
394 decompressed_data[kExperimentalLibraries].data,
395 decompressed_data[kExperimentalLibraries].raw_size);
396 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source);
365 #endif 397 #endif
366 } 398 }
367 399
368 400
369 void V8::SetFatalErrorHandler(FatalErrorCallback that) { 401 void V8::SetFatalErrorHandler(FatalErrorCallback that) {
370 i::Isolate* isolate = EnterIsolateIfNeeded(); 402 i::Isolate* isolate = EnterIsolateIfNeeded();
371 isolate->set_exception_behavior(that); 403 isolate->set_exception_behavior(that);
372 } 404 }
373 405
374 406
(...skipping 5653 matching lines...) Expand 10 before | Expand all | Expand 10 after
6028 6060
6029 6061
6030 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6062 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6031 HandleScopeImplementer* scope_implementer = 6063 HandleScopeImplementer* scope_implementer =
6032 reinterpret_cast<HandleScopeImplementer*>(storage); 6064 reinterpret_cast<HandleScopeImplementer*>(storage);
6033 scope_implementer->IterateThis(v); 6065 scope_implementer->IterateThis(v);
6034 return storage + ArchiveSpacePerThread(); 6066 return storage + ArchiveSpacePerThread();
6035 } 6067 }
6036 6068
6037 } } // namespace v8::internal 6069 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698