| 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 3321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3829 return Utils::OpenHandle(this)->IsDirty(); | 3806 return Utils::OpenHandle(this)->IsDirty(); |
| 3830 } | 3807 } |
| 3831 | 3808 |
| 3832 | 3809 |
| 3833 Local<v8::Object> v8::Object::Clone() { | 3810 Local<v8::Object> v8::Object::Clone() { |
| 3834 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3811 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3835 ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>()); | 3812 ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>()); |
| 3836 ENTER_V8(isolate); | 3813 ENTER_V8(isolate); |
| 3837 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3814 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3838 EXCEPTION_PREAMBLE(isolate); | 3815 EXCEPTION_PREAMBLE(isolate); |
| 3839 i::Handle<i::JSObject> result = i::Copy(self); | 3816 i::Handle<i::JSObject> result = i::JSObject::Copy(self); |
| 3840 has_pending_exception = result.is_null(); | 3817 has_pending_exception = result.is_null(); |
| 3841 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); | 3818 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); |
| 3842 return Utils::ToLocal(result); | 3819 return Utils::ToLocal(result); |
| 3843 } | 3820 } |
| 3844 | 3821 |
| 3845 | 3822 |
| 3846 static i::Context* GetCreationContext(i::JSObject* object) { | 3823 static i::Context* GetCreationContext(i::JSObject* object) { |
| 3847 i::Object* constructor = object->map()->constructor(); | 3824 i::Object* constructor = object->map()->constructor(); |
| 3848 i::JSFunction* function; | 3825 i::JSFunction* function; |
| 3849 if (!constructor->IsJSFunction()) { | 3826 if (!constructor->IsJSFunction()) { |
| (...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6228 return Local<Object>(); | 6205 return Local<Object>(); |
| 6229 } | 6206 } |
| 6230 i::FixedArray* elms = i::FixedArray::cast(self->elements()); | 6207 i::FixedArray* elms = i::FixedArray::cast(self->elements()); |
| 6231 i::Object* paragon = elms->get(index); | 6208 i::Object* paragon = elms->get(index); |
| 6232 if (!paragon->IsJSObject()) { | 6209 if (!paragon->IsJSObject()) { |
| 6233 return Local<Object>(); | 6210 return Local<Object>(); |
| 6234 } | 6211 } |
| 6235 i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon)); | 6212 i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon)); |
| 6236 EXCEPTION_PREAMBLE(isolate); | 6213 EXCEPTION_PREAMBLE(isolate); |
| 6237 ENTER_V8(isolate); | 6214 ENTER_V8(isolate); |
| 6238 i::Handle<i::JSObject> result = i::Copy(paragon_handle); | 6215 i::Handle<i::JSObject> result = i::JSObject::Copy(paragon_handle); |
| 6239 has_pending_exception = result.is_null(); | 6216 has_pending_exception = result.is_null(); |
| 6240 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); | 6217 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); |
| 6241 return Utils::ToLocal(result); | 6218 return Utils::ToLocal(result); |
| 6242 } | 6219 } |
| 6243 | 6220 |
| 6244 | 6221 |
| 6245 bool v8::ArrayBuffer::IsExternal() const { | 6222 bool v8::ArrayBuffer::IsExternal() const { |
| 6246 return Utils::OpenHandle(this)->is_external(); | 6223 return Utils::OpenHandle(this)->is_external(); |
| 6247 } | 6224 } |
| 6248 | 6225 |
| (...skipping 1638 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 |