| 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; | 653 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; |
| 654 LOG_API(isolate, "Persistent::New"); | 654 LOG_API(isolate, "Persistent::New"); |
| 655 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); | 655 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); |
| 656 #ifdef DEBUG | 656 #ifdef DEBUG |
| 657 (*obj)->Verify(); | 657 (*obj)->Verify(); |
| 658 #endif // DEBUG | 658 #endif // DEBUG |
| 659 return result.location(); | 659 return result.location(); |
| 660 } | 660 } |
| 661 | 661 |
| 662 | 662 |
| 663 i::Object** V8::CopyPersistent(i::Object** obj) { |
| 664 i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj); |
| 665 #ifdef DEBUG |
| 666 (*obj)->Verify(); |
| 667 #endif // DEBUG |
| 668 return result.location(); |
| 669 } |
| 670 |
| 671 |
| 663 void V8::MakeWeak(i::Object** object, | 672 void V8::MakeWeak(i::Object** object, |
| 664 void* parameters, | 673 void* parameters, |
| 674 WeakCallback weak_callback, |
| 665 RevivableCallback weak_reference_callback) { | 675 RevivableCallback weak_reference_callback) { |
| 666 i::GlobalHandles::MakeWeak(object, | 676 i::GlobalHandles::MakeWeak(object, |
| 667 parameters, | 677 parameters, |
| 678 weak_callback, |
| 668 weak_reference_callback); | 679 weak_reference_callback); |
| 669 } | 680 } |
| 670 | 681 |
| 671 | 682 |
| 672 void V8::ClearWeak(i::Object** obj) { | 683 void V8::ClearWeak(i::Object** obj) { |
| 673 i::GlobalHandles::ClearWeakness(obj); | 684 i::GlobalHandles::ClearWeakness(obj); |
| 674 } | 685 } |
| 675 | 686 |
| 676 | 687 |
| 677 void V8::DisposeGlobal(i::Object** obj) { | 688 void V8::DisposeGlobal(i::Object** obj) { |
| (...skipping 4750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5428 global_constructor->set_needs_access_check( | 5439 global_constructor->set_needs_access_check( |
| 5429 proxy_constructor->needs_access_check()); | 5440 proxy_constructor->needs_access_check()); |
| 5430 } | 5441 } |
| 5431 isolate->runtime_profiler()->Reset(); | 5442 isolate->runtime_profiler()->Reset(); |
| 5432 } | 5443 } |
| 5433 // Leave V8. | 5444 // Leave V8. |
| 5434 | 5445 |
| 5435 return env; | 5446 return env; |
| 5436 } | 5447 } |
| 5437 | 5448 |
| 5438 #ifdef V8_USE_UNSAFE_HANDLES | |
| 5439 Persistent<Context> v8::Context::New( | |
| 5440 v8::ExtensionConfiguration* extensions, | |
| 5441 v8::Handle<ObjectTemplate> global_template, | |
| 5442 v8::Handle<Value> global_object) { | |
| 5443 i::Isolate::EnsureDefaultIsolate(); | |
| 5444 i::Isolate* isolate = i::Isolate::Current(); | |
| 5445 Isolate* external_isolate = reinterpret_cast<Isolate*>(isolate); | |
| 5446 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); | |
| 5447 LOG_API(isolate, "Context::New"); | |
| 5448 ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>()); | |
| 5449 i::HandleScope scope(isolate); | |
| 5450 i::Handle<i::Context> env = | |
| 5451 CreateEnvironment(isolate, extensions, global_template, global_object); | |
| 5452 if (env.is_null()) return Persistent<Context>(); | |
| 5453 return Persistent<Context>::New(external_isolate, Utils::ToLocal(env)); | |
| 5454 } | |
| 5455 #endif | |
| 5456 | |
| 5457 | |
| 5458 Local<Context> v8::Context::New( | 5449 Local<Context> v8::Context::New( |
| 5459 v8::Isolate* external_isolate, | 5450 v8::Isolate* external_isolate, |
| 5460 v8::ExtensionConfiguration* extensions, | 5451 v8::ExtensionConfiguration* extensions, |
| 5461 v8::Handle<ObjectTemplate> global_template, | 5452 v8::Handle<ObjectTemplate> global_template, |
| 5462 v8::Handle<Value> global_object) { | 5453 v8::Handle<Value> global_object) { |
| 5463 i::Isolate::EnsureDefaultIsolate(); | 5454 i::Isolate::EnsureDefaultIsolate(); |
| 5464 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); | 5455 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); |
| 5465 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); | 5456 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); |
| 5466 LOG_API(isolate, "Context::New"); | 5457 LOG_API(isolate, "Context::New"); |
| 5467 ON_BAILOUT(isolate, "v8::Context::New()", return Local<Context>()); | 5458 ON_BAILOUT(isolate, "v8::Context::New()", return Local<Context>()); |
| (...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7901 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7892 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7902 Address callback_address = | 7893 Address callback_address = |
| 7903 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7894 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7904 VMState<EXTERNAL> state(isolate); | 7895 VMState<EXTERNAL> state(isolate); |
| 7905 ExternalCallbackScope call_scope(isolate, callback_address); | 7896 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7906 callback(info); | 7897 callback(info); |
| 7907 } | 7898 } |
| 7908 | 7899 |
| 7909 | 7900 |
| 7910 } } // namespace v8::internal | 7901 } } // namespace v8::internal |
| OLD | NEW |