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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; | 650 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; |
651 LOG_API(isolate, "Persistent::New"); | 651 LOG_API(isolate, "Persistent::New"); |
652 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); | 652 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); |
653 #ifdef DEBUG | 653 #ifdef DEBUG |
654 (*obj)->Verify(); | 654 (*obj)->Verify(); |
655 #endif // DEBUG | 655 #endif // DEBUG |
656 return result.location(); | 656 return result.location(); |
657 } | 657 } |
658 | 658 |
659 | 659 |
| 660 i::Object** V8::CopyPersistent(i::Object** obj) { |
| 661 i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj); |
| 662 #ifdef DEBUG |
| 663 (*obj)->Verify(); |
| 664 #endif // DEBUG |
| 665 return result.location(); |
| 666 } |
| 667 |
| 668 |
660 void V8::MakeWeak(i::Object** object, | 669 void V8::MakeWeak(i::Object** object, |
661 void* parameters, | 670 void* parameters, |
| 671 WeakCallback weak_callback, |
662 RevivableCallback weak_reference_callback) { | 672 RevivableCallback weak_reference_callback) { |
663 i::GlobalHandles::MakeWeak(object, | 673 i::GlobalHandles::MakeWeak(object, |
664 parameters, | 674 parameters, |
| 675 weak_callback, |
665 weak_reference_callback); | 676 weak_reference_callback); |
666 } | 677 } |
667 | 678 |
668 | 679 |
669 void V8::ClearWeak(i::Object** obj) { | 680 void V8::ClearWeak(i::Object** obj) { |
670 i::GlobalHandles::ClearWeakness(obj); | 681 i::GlobalHandles::ClearWeakness(obj); |
671 } | 682 } |
672 | 683 |
673 | 684 |
674 void V8::DisposeGlobal(i::Object** obj) { | 685 void V8::DisposeGlobal(i::Object** obj) { |
(...skipping 4891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5566 global_constructor->set_needs_access_check( | 5577 global_constructor->set_needs_access_check( |
5567 proxy_constructor->needs_access_check()); | 5578 proxy_constructor->needs_access_check()); |
5568 } | 5579 } |
5569 isolate->runtime_profiler()->Reset(); | 5580 isolate->runtime_profiler()->Reset(); |
5570 } | 5581 } |
5571 // Leave V8. | 5582 // Leave V8. |
5572 | 5583 |
5573 return env; | 5584 return env; |
5574 } | 5585 } |
5575 | 5586 |
5576 #ifdef V8_USE_UNSAFE_HANDLES | |
5577 Persistent<Context> v8::Context::New( | |
5578 v8::ExtensionConfiguration* extensions, | |
5579 v8::Handle<ObjectTemplate> global_template, | |
5580 v8::Handle<Value> global_object) { | |
5581 i::Isolate::EnsureDefaultIsolate(); | |
5582 i::Isolate* isolate = i::Isolate::Current(); | |
5583 Isolate* external_isolate = reinterpret_cast<Isolate*>(isolate); | |
5584 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); | |
5585 LOG_API(isolate, "Context::New"); | |
5586 ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>()); | |
5587 i::HandleScope scope(isolate); | |
5588 i::Handle<i::Context> env = | |
5589 CreateEnvironment(isolate, extensions, global_template, global_object); | |
5590 if (env.is_null()) return Persistent<Context>(); | |
5591 return Persistent<Context>::New(external_isolate, Utils::ToLocal(env)); | |
5592 } | |
5593 #endif | |
5594 | |
5595 | |
5596 Local<Context> v8::Context::New( | 5587 Local<Context> v8::Context::New( |
5597 v8::Isolate* external_isolate, | 5588 v8::Isolate* external_isolate, |
5598 v8::ExtensionConfiguration* extensions, | 5589 v8::ExtensionConfiguration* extensions, |
5599 v8::Handle<ObjectTemplate> global_template, | 5590 v8::Handle<ObjectTemplate> global_template, |
5600 v8::Handle<Value> global_object) { | 5591 v8::Handle<Value> global_object) { |
5601 i::Isolate::EnsureDefaultIsolate(); | 5592 i::Isolate::EnsureDefaultIsolate(); |
5602 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); | 5593 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); |
5603 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); | 5594 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); |
5604 LOG_API(isolate, "Context::New"); | 5595 LOG_API(isolate, "Context::New"); |
5605 ON_BAILOUT(isolate, "v8::Context::New()", return Local<Context>()); | 5596 ON_BAILOUT(isolate, "v8::Context::New()", return Local<Context>()); |
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8173 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8164 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8174 Address callback_address = | 8165 Address callback_address = |
8175 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8166 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8176 VMState<EXTERNAL> state(isolate); | 8167 VMState<EXTERNAL> state(isolate); |
8177 ExternalCallbackScope call_scope(isolate, callback_address); | 8168 ExternalCallbackScope call_scope(isolate, callback_address); |
8178 return callback(info); | 8169 return callback(info); |
8179 } | 8170 } |
8180 | 8171 |
8181 | 8172 |
8182 } } // namespace v8::internal | 8173 } } // namespace v8::internal |
OLD | NEW |