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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return StartupData::kUncompressed; | 392 return StartupData::kUncompressed; |
393 #endif | 393 #endif |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 enum CompressedStartupDataItems { | 397 enum CompressedStartupDataItems { |
398 kSnapshot = 0, | 398 kSnapshot = 0, |
399 kSnapshotContext, | 399 kSnapshotContext, |
400 kLibraries, | 400 kLibraries, |
401 kExperimentalLibraries, | 401 kExperimentalLibraries, |
| 402 #if defined(V8_I18N_SUPPORT) |
| 403 kI18NExtension, |
| 404 #endif |
402 kCompressedStartupDataCount | 405 kCompressedStartupDataCount |
403 }; | 406 }; |
404 | 407 |
405 | 408 |
406 int V8::GetCompressedStartupDataCount() { | 409 int V8::GetCompressedStartupDataCount() { |
407 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 410 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
408 return kCompressedStartupDataCount; | 411 return kCompressedStartupDataCount; |
409 #else | 412 #else |
410 return 0; | 413 return 0; |
411 #endif | 414 #endif |
(...skipping 20 matching lines...) Expand all Loading... |
432 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); | 435 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); |
433 | 436 |
434 i::Vector<const i::byte> exp_libraries_source = | 437 i::Vector<const i::byte> exp_libraries_source = |
435 i::ExperimentalNatives::GetScriptsSource(); | 438 i::ExperimentalNatives::GetScriptsSource(); |
436 compressed_data[kExperimentalLibraries].data = | 439 compressed_data[kExperimentalLibraries].data = |
437 reinterpret_cast<const char*>(exp_libraries_source.start()); | 440 reinterpret_cast<const char*>(exp_libraries_source.start()); |
438 compressed_data[kExperimentalLibraries].compressed_size = | 441 compressed_data[kExperimentalLibraries].compressed_size = |
439 exp_libraries_source.length(); | 442 exp_libraries_source.length(); |
440 compressed_data[kExperimentalLibraries].raw_size = | 443 compressed_data[kExperimentalLibraries].raw_size = |
441 i::ExperimentalNatives::GetRawScriptsSize(); | 444 i::ExperimentalNatives::GetRawScriptsSize(); |
| 445 |
| 446 #if defined(V8_I18N_SUPPORT) |
| 447 i::Vector<const ii:byte> i18n_extension_source = |
| 448 i::I18NNatives::GetScriptsSource(); |
| 449 compressed_data[kI18NExtension].data = |
| 450 reinterpret_cast<const char*>(i18n_extension_source.start()); |
| 451 compressed_data[kI18NExtension].compressed_size = |
| 452 i18n_extension_source.length(); |
| 453 compressed_data[kI18NExtension].raw_size = |
| 454 i::I18NNatives::GetRawScriptsSize(); |
| 455 #endif |
442 #endif | 456 #endif |
443 } | 457 } |
444 | 458 |
445 | 459 |
446 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { | 460 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { |
447 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 461 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
448 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); | 462 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); |
449 i::Snapshot::set_raw_data( | 463 i::Snapshot::set_raw_data( |
450 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); | 464 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); |
451 | 465 |
452 ASSERT_EQ(i::Snapshot::context_raw_size(), | 466 ASSERT_EQ(i::Snapshot::context_raw_size(), |
453 decompressed_data[kSnapshotContext].raw_size); | 467 decompressed_data[kSnapshotContext].raw_size); |
454 i::Snapshot::set_context_raw_data( | 468 i::Snapshot::set_context_raw_data( |
455 reinterpret_cast<const i::byte*>( | 469 reinterpret_cast<const i::byte*>( |
456 decompressed_data[kSnapshotContext].data)); | 470 decompressed_data[kSnapshotContext].data)); |
457 | 471 |
458 ASSERT_EQ(i::Natives::GetRawScriptsSize(), | 472 ASSERT_EQ(i::Natives::GetRawScriptsSize(), |
459 decompressed_data[kLibraries].raw_size); | 473 decompressed_data[kLibraries].raw_size); |
460 i::Vector<const char> libraries_source( | 474 i::Vector<const char> libraries_source( |
461 decompressed_data[kLibraries].data, | 475 decompressed_data[kLibraries].data, |
462 decompressed_data[kLibraries].raw_size); | 476 decompressed_data[kLibraries].raw_size); |
463 i::Natives::SetRawScriptsSource(libraries_source); | 477 i::Natives::SetRawScriptsSource(libraries_source); |
464 | 478 |
465 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), | 479 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), |
466 decompressed_data[kExperimentalLibraries].raw_size); | 480 decompressed_data[kExperimentalLibraries].raw_size); |
467 i::Vector<const char> exp_libraries_source( | 481 i::Vector<const char> exp_libraries_source( |
468 decompressed_data[kExperimentalLibraries].data, | 482 decompressed_data[kExperimentalLibraries].data, |
469 decompressed_data[kExperimentalLibraries].raw_size); | 483 decompressed_data[kExperimentalLibraries].raw_size); |
470 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); | 484 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); |
| 485 |
| 486 #if defined(V8_I18N_SUPPORT) |
| 487 ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(), |
| 488 decompressed_data[kI18NExtension].raw_size); |
| 489 i::Vector<const char> i18n_extension_source( |
| 490 decompressed_data[kI18NExtension].data, |
| 491 decompressed_data[kI18NExtension].raw_size); |
| 492 i::I18NNatives::SetRawScriptsSource(i18n_extension_source); |
| 493 #endif |
471 #endif | 494 #endif |
472 } | 495 } |
473 | 496 |
474 | 497 |
475 void V8::SetFatalErrorHandler(FatalErrorCallback that) { | 498 void V8::SetFatalErrorHandler(FatalErrorCallback that) { |
476 i::Isolate* isolate = EnterIsolateIfNeeded(); | 499 i::Isolate* isolate = EnterIsolateIfNeeded(); |
477 isolate->set_exception_behavior(that); | 500 isolate->set_exception_behavior(that); |
478 } | 501 } |
479 | 502 |
480 | 503 |
(...skipping 7713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8194 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8217 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8195 Address callback_address = | 8218 Address callback_address = |
8196 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8219 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8197 VMState<EXTERNAL> state(isolate); | 8220 VMState<EXTERNAL> state(isolate); |
8198 ExternalCallbackScope call_scope(isolate, callback_address); | 8221 ExternalCallbackScope call_scope(isolate, callback_address); |
8199 return callback(info); | 8222 return callback(info); |
8200 } | 8223 } |
8201 | 8224 |
8202 | 8225 |
8203 } } // namespace v8::internal | 8226 } } // namespace v8::internal |
OLD | NEW |