| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 return StartupData::kUncompressed; | 396 return StartupData::kUncompressed; |
| 397 #endif | 397 #endif |
| 398 } | 398 } |
| 399 | 399 |
| 400 | 400 |
| 401 enum CompressedStartupDataItems { | 401 enum CompressedStartupDataItems { |
| 402 kSnapshot = 0, | 402 kSnapshot = 0, |
| 403 kSnapshotContext, | 403 kSnapshotContext, |
| 404 kLibraries, | 404 kLibraries, |
| 405 kExperimentalLibraries, | 405 kExperimentalLibraries, |
| 406 #if defined(V8_I18N_SUPPORT) | |
| 407 kI18NExtension, | |
| 408 #endif | |
| 409 kCompressedStartupDataCount | 406 kCompressedStartupDataCount |
| 410 }; | 407 }; |
| 411 | 408 |
| 412 | 409 |
| 413 int V8::GetCompressedStartupDataCount() { | 410 int V8::GetCompressedStartupDataCount() { |
| 414 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 411 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
| 415 return kCompressedStartupDataCount; | 412 return kCompressedStartupDataCount; |
| 416 #else | 413 #else |
| 417 return 0; | 414 return 0; |
| 418 #endif | 415 #endif |
| (...skipping 20 matching lines...) Expand all Loading... |
| 439 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); | 436 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); |
| 440 | 437 |
| 441 i::Vector<const i::byte> exp_libraries_source = | 438 i::Vector<const i::byte> exp_libraries_source = |
| 442 i::ExperimentalNatives::GetScriptsSource(); | 439 i::ExperimentalNatives::GetScriptsSource(); |
| 443 compressed_data[kExperimentalLibraries].data = | 440 compressed_data[kExperimentalLibraries].data = |
| 444 reinterpret_cast<const char*>(exp_libraries_source.start()); | 441 reinterpret_cast<const char*>(exp_libraries_source.start()); |
| 445 compressed_data[kExperimentalLibraries].compressed_size = | 442 compressed_data[kExperimentalLibraries].compressed_size = |
| 446 exp_libraries_source.length(); | 443 exp_libraries_source.length(); |
| 447 compressed_data[kExperimentalLibraries].raw_size = | 444 compressed_data[kExperimentalLibraries].raw_size = |
| 448 i::ExperimentalNatives::GetRawScriptsSize(); | 445 i::ExperimentalNatives::GetRawScriptsSize(); |
| 449 | |
| 450 #if defined(V8_I18N_SUPPORT) | |
| 451 i::Vector<const ii:byte> i18n_extension_source = | |
| 452 i::I18NNatives::GetScriptsSource(); | |
| 453 compressed_data[kI18NExtension].data = | |
| 454 reinterpret_cast<const char*>(i18n_extension_source.start()); | |
| 455 compressed_data[kI18NExtension].compressed_size = | |
| 456 i18n_extension_source.length(); | |
| 457 compressed_data[kI18NExtension].raw_size = | |
| 458 i::I18NNatives::GetRawScriptsSize(); | |
| 459 #endif | |
| 460 #endif | 446 #endif |
| 461 } | 447 } |
| 462 | 448 |
| 463 | 449 |
| 464 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { | 450 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { |
| 465 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 451 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
| 466 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); | 452 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); |
| 467 i::Snapshot::set_raw_data( | 453 i::Snapshot::set_raw_data( |
| 468 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); | 454 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); |
| 469 | 455 |
| 470 ASSERT_EQ(i::Snapshot::context_raw_size(), | 456 ASSERT_EQ(i::Snapshot::context_raw_size(), |
| 471 decompressed_data[kSnapshotContext].raw_size); | 457 decompressed_data[kSnapshotContext].raw_size); |
| 472 i::Snapshot::set_context_raw_data( | 458 i::Snapshot::set_context_raw_data( |
| 473 reinterpret_cast<const i::byte*>( | 459 reinterpret_cast<const i::byte*>( |
| 474 decompressed_data[kSnapshotContext].data)); | 460 decompressed_data[kSnapshotContext].data)); |
| 475 | 461 |
| 476 ASSERT_EQ(i::Natives::GetRawScriptsSize(), | 462 ASSERT_EQ(i::Natives::GetRawScriptsSize(), |
| 477 decompressed_data[kLibraries].raw_size); | 463 decompressed_data[kLibraries].raw_size); |
| 478 i::Vector<const char> libraries_source( | 464 i::Vector<const char> libraries_source( |
| 479 decompressed_data[kLibraries].data, | 465 decompressed_data[kLibraries].data, |
| 480 decompressed_data[kLibraries].raw_size); | 466 decompressed_data[kLibraries].raw_size); |
| 481 i::Natives::SetRawScriptsSource(libraries_source); | 467 i::Natives::SetRawScriptsSource(libraries_source); |
| 482 | 468 |
| 483 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), | 469 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), |
| 484 decompressed_data[kExperimentalLibraries].raw_size); | 470 decompressed_data[kExperimentalLibraries].raw_size); |
| 485 i::Vector<const char> exp_libraries_source( | 471 i::Vector<const char> exp_libraries_source( |
| 486 decompressed_data[kExperimentalLibraries].data, | 472 decompressed_data[kExperimentalLibraries].data, |
| 487 decompressed_data[kExperimentalLibraries].raw_size); | 473 decompressed_data[kExperimentalLibraries].raw_size); |
| 488 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); | 474 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); |
| 489 | |
| 490 #if defined(V8_I18N_SUPPORT) | |
| 491 ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(), | |
| 492 decompressed_data[kI18NExtension].raw_size); | |
| 493 i::Vector<const char> i18n_extension_source( | |
| 494 decompressed_data[kI18NExtension].data, | |
| 495 decompressed_data[kI18NExtension].raw_size); | |
| 496 i::I18NNatives::SetRawScriptsSource(i18n_extension_source); | |
| 497 #endif | |
| 498 #endif | 475 #endif |
| 499 } | 476 } |
| 500 | 477 |
| 501 | 478 |
| 502 void V8::SetFatalErrorHandler(FatalErrorCallback that) { | 479 void V8::SetFatalErrorHandler(FatalErrorCallback that) { |
| 503 i::Isolate* isolate = EnterIsolateIfNeeded(); | 480 i::Isolate* isolate = EnterIsolateIfNeeded(); |
| 504 isolate->set_exception_behavior(that); | 481 isolate->set_exception_behavior(that); |
| 505 } | 482 } |
| 506 | 483 |
| 507 | 484 |
| (...skipping 7379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7887 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7864 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7888 Address callback_address = | 7865 Address callback_address = |
| 7889 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7866 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7890 VMState<EXTERNAL> state(isolate); | 7867 VMState<EXTERNAL> state(isolate); |
| 7891 ExternalCallbackScope call_scope(isolate, callback_address); | 7868 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7892 callback(info); | 7869 callback(info); |
| 7893 } | 7870 } |
| 7894 | 7871 |
| 7895 | 7872 |
| 7896 } } // namespace v8::internal | 7873 } } // namespace v8::internal |
| OLD | NEW |