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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 return StartupData::kUncompressed; | 387 return StartupData::kUncompressed; |
388 #endif | 388 #endif |
389 } | 389 } |
390 | 390 |
391 | 391 |
392 enum CompressedStartupDataItems { | 392 enum CompressedStartupDataItems { |
393 kSnapshot = 0, | 393 kSnapshot = 0, |
394 kSnapshotContext, | 394 kSnapshotContext, |
395 kLibraries, | 395 kLibraries, |
396 kExperimentalLibraries, | 396 kExperimentalLibraries, |
397 #if defined(ENABLE_I18N_SUPPORT) | |
398 kI18NExtension, | |
399 #endif | |
397 kCompressedStartupDataCount | 400 kCompressedStartupDataCount |
398 }; | 401 }; |
399 | 402 |
400 int V8::GetCompressedStartupDataCount() { | 403 int V8::GetCompressedStartupDataCount() { |
401 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 404 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
402 return kCompressedStartupDataCount; | 405 return kCompressedStartupDataCount; |
403 #else | 406 #else |
404 return 0; | 407 return 0; |
405 #endif | 408 #endif |
406 } | 409 } |
(...skipping 19 matching lines...) Expand all Loading... | |
426 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); | 429 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); |
427 | 430 |
428 i::Vector<const i::byte> exp_libraries_source = | 431 i::Vector<const i::byte> exp_libraries_source = |
429 i::ExperimentalNatives::GetScriptsSource(); | 432 i::ExperimentalNatives::GetScriptsSource(); |
430 compressed_data[kExperimentalLibraries].data = | 433 compressed_data[kExperimentalLibraries].data = |
431 reinterpret_cast<const char*>(exp_libraries_source.start()); | 434 reinterpret_cast<const char*>(exp_libraries_source.start()); |
432 compressed_data[kExperimentalLibraries].compressed_size = | 435 compressed_data[kExperimentalLibraries].compressed_size = |
433 exp_libraries_source.length(); | 436 exp_libraries_source.length(); |
434 compressed_data[kExperimentalLibraries].raw_size = | 437 compressed_data[kExperimentalLibraries].raw_size = |
435 i::ExperimentalNatives::GetRawScriptsSize(); | 438 i::ExperimentalNatives::GetRawScriptsSize(); |
439 | |
440 #if defined(ENABLE_I18N_SUPPORT) | |
441 i::Vector<const ii:byte> i18n_extension_source = | |
442 i::I18NNatvies::GetScriptsSource(); | |
Nebojša Ćirić
2013/07/03 09:23:41
i::I18NNatives (misspelled).
| |
443 compressed_data[kI18NExtension].data = | |
444 reinterpret_cast<const char*>(i18n_extension_source.start()); | |
445 compressed_data[kI18NExtension].compressed_size = | |
446 i18n_extension_source.length(); | |
447 compressed_data[kI18NExtension].raw_size = | |
448 i::I18NNatives::GetRawScriptsSize(); | |
449 #endif | |
436 #endif | 450 #endif |
437 } | 451 } |
438 | 452 |
439 | 453 |
440 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { | 454 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { |
441 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 455 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
442 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); | 456 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); |
443 i::Snapshot::set_raw_data( | 457 i::Snapshot::set_raw_data( |
444 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); | 458 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); |
445 | 459 |
446 ASSERT_EQ(i::Snapshot::context_raw_size(), | 460 ASSERT_EQ(i::Snapshot::context_raw_size(), |
447 decompressed_data[kSnapshotContext].raw_size); | 461 decompressed_data[kSnapshotContext].raw_size); |
448 i::Snapshot::set_context_raw_data( | 462 i::Snapshot::set_context_raw_data( |
449 reinterpret_cast<const i::byte*>( | 463 reinterpret_cast<const i::byte*>( |
450 decompressed_data[kSnapshotContext].data)); | 464 decompressed_data[kSnapshotContext].data)); |
451 | 465 |
452 ASSERT_EQ(i::Natives::GetRawScriptsSize(), | 466 ASSERT_EQ(i::Natives::GetRawScriptsSize(), |
453 decompressed_data[kLibraries].raw_size); | 467 decompressed_data[kLibraries].raw_size); |
454 i::Vector<const char> libraries_source( | 468 i::Vector<const char> libraries_source( |
455 decompressed_data[kLibraries].data, | 469 decompressed_data[kLibraries].data, |
456 decompressed_data[kLibraries].raw_size); | 470 decompressed_data[kLibraries].raw_size); |
457 i::Natives::SetRawScriptsSource(libraries_source); | 471 i::Natives::SetRawScriptsSource(libraries_source); |
458 | 472 |
459 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), | 473 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), |
460 decompressed_data[kExperimentalLibraries].raw_size); | 474 decompressed_data[kExperimentalLibraries].raw_size); |
461 i::Vector<const char> exp_libraries_source( | 475 i::Vector<const char> exp_libraries_source( |
462 decompressed_data[kExperimentalLibraries].data, | 476 decompressed_data[kExperimentalLibraries].data, |
463 decompressed_data[kExperimentalLibraries].raw_size); | 477 decompressed_data[kExperimentalLibraries].raw_size); |
464 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); | 478 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); |
479 | |
480 #if defined(ENABLE_I18N_SUPPORT) | |
481 ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(), | |
482 decompressed_data[kI18NExtension].raw_size); | |
483 i::Vector<const char> i18n_extension_source( | |
484 decompressed_data[kI18NExtension].data, | |
485 decompressed_data[kI18NExtension].raw_size); | |
486 i::I18NNatives::SetRawScriptsSource(i18n_extension_source); | |
487 #endif | |
465 #endif | 488 #endif |
466 } | 489 } |
467 | 490 |
468 | 491 |
469 void V8::SetFatalErrorHandler(FatalErrorCallback that) { | 492 void V8::SetFatalErrorHandler(FatalErrorCallback that) { |
470 i::Isolate* isolate = EnterIsolateIfNeeded(); | 493 i::Isolate* isolate = EnterIsolateIfNeeded(); |
471 isolate->set_exception_behavior(that); | 494 isolate->set_exception_behavior(that); |
472 } | 495 } |
473 | 496 |
474 | 497 |
(...skipping 7564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8039 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8062 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8040 Address callback_address = | 8063 Address callback_address = |
8041 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8064 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8042 VMState<EXTERNAL> state(isolate); | 8065 VMState<EXTERNAL> state(isolate); |
8043 ExternalCallbackScope call_scope(isolate, callback_address); | 8066 ExternalCallbackScope call_scope(isolate, callback_address); |
8044 return callback(info); | 8067 return callback(info); |
8045 } | 8068 } |
8046 | 8069 |
8047 | 8070 |
8048 } } // namespace v8::internal | 8071 } } // namespace v8::internal |
OLD | NEW |