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

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: 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,
326 kCompressedStartupDataCount 327 kSnapshotDataCount
327 }; 328 };
328 329
329 int V8::GetCompressedStartupDataCount() { 330 int V8::GetCompressedStartupDataCount() {
330 #ifdef COMPRESS_STARTUP_DATA_BZ2 331 #ifdef COMPRESS_STARTUP_DATA_BZ2
331 return kCompressedStartupDataCount; 332 return kSnapshotDataCount +
333 i::Natives::GetBuiltinsCount() +
334 i::ExperimentalNatives::GetBuiltinsCount();
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 for (int i = 0, idx = kSnapshotDataCount;
Vitaly Repeshko 2011/06/06 10:08:23 It may be easier to read to maintain a separate of
mnaganov (inactive) 2011/06/06 13:40:18 Done.
355 i < i::Natives::GetBuiltinsCount();
Vitaly Repeshko 2011/06/06 10:08:23 I hope no compiler will have trouble with 'i' both
mnaganov (inactive) 2011/06/06 13:40:18 Bots will tell ;)
356 ++i, ++idx) {
357 i::Vector<const i::byte> source = i::Natives::GetScriptSource(i);
358 compressed_data[idx].data =
359 reinterpret_cast<const char*>(source.start());
360 compressed_data[idx].compressed_size = source.length();
361 compressed_data[idx].raw_size = i::Natives::GetRawScriptSize(i);
362 }
363
364 for (int i = 0, idx = kSnapshotDataCount + i::Natives::GetBuiltinsCount();
365 i < i::ExperimentalNatives::GetBuiltinsCount();
366 ++i, ++idx) {
367 i::Vector<const i::byte> source =
368 i::ExperimentalNatives::GetScriptSource(i);
369 compressed_data[idx].data =
370 reinterpret_cast<const char*>(source.start());
371 compressed_data[idx].compressed_size = source.length();
372 compressed_data[idx].raw_size =
373 i::ExperimentalNatives::GetRawScriptSize(i);
374 }
350 #endif 375 #endif
351 } 376 }
352 377
353 378
354 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { 379 void V8::SetDecompressedStartupData(StartupData* decompressed_data) {
355 #ifdef COMPRESS_STARTUP_DATA_BZ2 380 #ifdef COMPRESS_STARTUP_DATA_BZ2
356 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); 381 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size);
357 i::Snapshot::set_raw_data( 382 i::Snapshot::set_raw_data(
358 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); 383 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data));
359 384
360 ASSERT_EQ(i::Snapshot::context_raw_size(), 385 ASSERT_EQ(i::Snapshot::context_raw_size(),
361 decompressed_data[kSnapshotContext].raw_size); 386 decompressed_data[kSnapshotContext].raw_size);
362 i::Snapshot::set_context_raw_data( 387 i::Snapshot::set_context_raw_data(
363 reinterpret_cast<const i::byte*>( 388 reinterpret_cast<const i::byte*>(
364 decompressed_data[kSnapshotContext].data)); 389 decompressed_data[kSnapshotContext].data));
390
391 for (int i = 0, idx = kSnapshotDataCount;
Vitaly Repeshko 2011/06/06 10:08:23 Same here.
392 i < i::Natives::GetBuiltinsCount();
393 ++i, ++idx) {
394 ASSERT_EQ(i::Natives::GetRawScriptSize(i),
395 decompressed_data[idx].raw_size);
396 i::Vector<const char> source(decompressed_data[idx].data,
397 decompressed_data[idx].raw_size);
398 i::Natives::SetRawScriptSource(i, source);
399 }
400
401 for (int i = 0, idx = kSnapshotDataCount + i::Natives::GetBuiltinsCount();
402 i < i::ExperimentalNatives::GetBuiltinsCount();
403 ++i, ++idx) {
404 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptSize(i),
405 decompressed_data[idx].raw_size);
406 i::Vector<const char> source(decompressed_data[idx].data,
407 decompressed_data[idx].raw_size);
408 i::ExperimentalNatives::SetRawScriptSource(i, source);
409 }
365 #endif 410 #endif
366 } 411 }
367 412
368 413
369 void V8::SetFatalErrorHandler(FatalErrorCallback that) { 414 void V8::SetFatalErrorHandler(FatalErrorCallback that) {
370 i::Isolate* isolate = EnterIsolateIfNeeded(); 415 i::Isolate* isolate = EnterIsolateIfNeeded();
371 isolate->set_exception_behavior(that); 416 isolate->set_exception_behavior(that);
372 } 417 }
373 418
374 419
(...skipping 5469 matching lines...) Expand 10 before | Expand all | Expand 10 after
5844 5889
5845 5890
5846 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5891 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5847 HandleScopeImplementer* scope_implementer = 5892 HandleScopeImplementer* scope_implementer =
5848 reinterpret_cast<HandleScopeImplementer*>(storage); 5893 reinterpret_cast<HandleScopeImplementer*>(storage);
5849 scope_implementer->IterateThis(v); 5894 scope_implementer->IterateThis(v);
5850 return storage + ArchiveSpacePerThread(); 5895 return storage + ArchiveSpacePerThread();
5851 } 5896 }
5852 5897
5853 } } // namespace v8::internal 5898 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698