| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <errno.h> | 5 #include <errno.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 data_->realm_current_ = 0; | 718 data_->realm_current_ = 0; |
| 719 data_->realm_switch_ = 0; | 719 data_->realm_switch_ = 0; |
| 720 data_->realms_ = new Global<Context>[1]; | 720 data_->realms_ = new Global<Context>[1]; |
| 721 data_->realms_[0].Reset(data_->isolate_, | 721 data_->realms_[0].Reset(data_->isolate_, |
| 722 data_->isolate_->GetEnteredContext()); | 722 data_->isolate_->GetEnteredContext()); |
| 723 } | 723 } |
| 724 | 724 |
| 725 | 725 |
| 726 PerIsolateData::RealmScope::~RealmScope() { | 726 PerIsolateData::RealmScope::~RealmScope() { |
| 727 // Drop realms to avoid keeping them alive. | 727 // Drop realms to avoid keeping them alive. |
| 728 for (int i = 0; i < data_->realm_count_; ++i) { | 728 for (int i = 0; i < data_->realm_count_; ++i) |
| 729 Global<Context>& realm = data_->realms_[i]; | 729 data_->realms_[i].Reset(); |
| 730 if (realm.IsEmpty()) continue; | |
| 731 DisposeModuleEmbedderData(realm.Get(data_->isolate_)); | |
| 732 realm.Reset(); | |
| 733 } | |
| 734 delete[] data_->realms_; | 730 delete[] data_->realms_; |
| 735 if (!data_->realm_shared_.IsEmpty()) | 731 if (!data_->realm_shared_.IsEmpty()) |
| 736 data_->realm_shared_.Reset(); | 732 data_->realm_shared_.Reset(); |
| 737 } | 733 } |
| 738 | 734 |
| 739 | 735 |
| 740 int PerIsolateData::RealmFind(Local<Context> context) { | 736 int PerIsolateData::RealmFind(Local<Context> context) { |
| 741 for (int i = 0; i < realm_count_; ++i) { | 737 for (int i = 0; i < realm_count_; ++i) { |
| 742 if (realms_[i] == context) return i; | 738 if (realms_[i] == context) return i; |
| 743 } | 739 } |
| (...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2817 } | 2813 } |
| 2818 | 2814 |
| 2819 } // namespace v8 | 2815 } // namespace v8 |
| 2820 | 2816 |
| 2821 | 2817 |
| 2822 #ifndef GOOGLE3 | 2818 #ifndef GOOGLE3 |
| 2823 int main(int argc, char* argv[]) { | 2819 int main(int argc, char* argv[]) { |
| 2824 return v8::Shell::Main(argc, argv); | 2820 return v8::Shell::Main(argc, argv); |
| 2825 } | 2821 } |
| 2826 #endif | 2822 #endif |
| OLD | NEW |