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 | |
405 kCompressedStartupDataCount | 402 kCompressedStartupDataCount |
406 }; | 403 }; |
407 | 404 |
408 | 405 |
409 int V8::GetCompressedStartupDataCount() { | 406 int V8::GetCompressedStartupDataCount() { |
410 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 407 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
411 return kCompressedStartupDataCount; | 408 return kCompressedStartupDataCount; |
412 #else | 409 #else |
413 return 0; | 410 return 0; |
414 #endif | 411 #endif |
(...skipping 20 matching lines...) Expand all Loading... |
435 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); | 432 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); |
436 | 433 |
437 i::Vector<const i::byte> exp_libraries_source = | 434 i::Vector<const i::byte> exp_libraries_source = |
438 i::ExperimentalNatives::GetScriptsSource(); | 435 i::ExperimentalNatives::GetScriptsSource(); |
439 compressed_data[kExperimentalLibraries].data = | 436 compressed_data[kExperimentalLibraries].data = |
440 reinterpret_cast<const char*>(exp_libraries_source.start()); | 437 reinterpret_cast<const char*>(exp_libraries_source.start()); |
441 compressed_data[kExperimentalLibraries].compressed_size = | 438 compressed_data[kExperimentalLibraries].compressed_size = |
442 exp_libraries_source.length(); | 439 exp_libraries_source.length(); |
443 compressed_data[kExperimentalLibraries].raw_size = | 440 compressed_data[kExperimentalLibraries].raw_size = |
444 i::ExperimentalNatives::GetRawScriptsSize(); | 441 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 | |
456 #endif | 442 #endif |
457 } | 443 } |
458 | 444 |
459 | 445 |
460 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { | 446 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { |
461 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 447 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
462 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); | 448 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); |
463 i::Snapshot::set_raw_data( | 449 i::Snapshot::set_raw_data( |
464 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); | 450 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); |
465 | 451 |
466 ASSERT_EQ(i::Snapshot::context_raw_size(), | 452 ASSERT_EQ(i::Snapshot::context_raw_size(), |
467 decompressed_data[kSnapshotContext].raw_size); | 453 decompressed_data[kSnapshotContext].raw_size); |
468 i::Snapshot::set_context_raw_data( | 454 i::Snapshot::set_context_raw_data( |
469 reinterpret_cast<const i::byte*>( | 455 reinterpret_cast<const i::byte*>( |
470 decompressed_data[kSnapshotContext].data)); | 456 decompressed_data[kSnapshotContext].data)); |
471 | 457 |
472 ASSERT_EQ(i::Natives::GetRawScriptsSize(), | 458 ASSERT_EQ(i::Natives::GetRawScriptsSize(), |
473 decompressed_data[kLibraries].raw_size); | 459 decompressed_data[kLibraries].raw_size); |
474 i::Vector<const char> libraries_source( | 460 i::Vector<const char> libraries_source( |
475 decompressed_data[kLibraries].data, | 461 decompressed_data[kLibraries].data, |
476 decompressed_data[kLibraries].raw_size); | 462 decompressed_data[kLibraries].raw_size); |
477 i::Natives::SetRawScriptsSource(libraries_source); | 463 i::Natives::SetRawScriptsSource(libraries_source); |
478 | 464 |
479 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), | 465 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), |
480 decompressed_data[kExperimentalLibraries].raw_size); | 466 decompressed_data[kExperimentalLibraries].raw_size); |
481 i::Vector<const char> exp_libraries_source( | 467 i::Vector<const char> exp_libraries_source( |
482 decompressed_data[kExperimentalLibraries].data, | 468 decompressed_data[kExperimentalLibraries].data, |
483 decompressed_data[kExperimentalLibraries].raw_size); | 469 decompressed_data[kExperimentalLibraries].raw_size); |
484 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); | 470 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 | |
494 #endif | 471 #endif |
495 } | 472 } |
496 | 473 |
497 | 474 |
498 void V8::SetFatalErrorHandler(FatalErrorCallback that) { | 475 void V8::SetFatalErrorHandler(FatalErrorCallback that) { |
499 i::Isolate* isolate = EnterIsolateIfNeeded(); | 476 i::Isolate* isolate = EnterIsolateIfNeeded(); |
500 isolate->set_exception_behavior(that); | 477 isolate->set_exception_behavior(that); |
501 } | 478 } |
502 | 479 |
503 | 480 |
(...skipping 7669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8173 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8150 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8174 Address callback_address = | 8151 Address callback_address = |
8175 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8152 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8176 VMState<EXTERNAL> state(isolate); | 8153 VMState<EXTERNAL> state(isolate); |
8177 ExternalCallbackScope call_scope(isolate, callback_address); | 8154 ExternalCallbackScope call_scope(isolate, callback_address); |
8178 return callback(info); | 8155 return callback(info); |
8179 } | 8156 } |
8180 | 8157 |
8181 | 8158 |
8182 } } // namespace v8::internal | 8159 } } // namespace v8::internal |
OLD | NEW |