Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: src/d8.cc

Issue 2403303002: [d8] Fix LeakSanitizer failures on the bots due to ModuleEmbedderData (Closed)
Patch Set: Simplify Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 data_->realms_[i].Reset(); 729 Global<Context>& realm = data_->realms_[i];
730 if (realm.IsEmpty()) continue;
731 DisposeModuleEmbedderData(realm.Get(data_->isolate_));
732 realm.Reset();
733 }
730 delete[] data_->realms_; 734 delete[] data_->realms_;
731 if (!data_->realm_shared_.IsEmpty()) 735 if (!data_->realm_shared_.IsEmpty())
732 data_->realm_shared_.Reset(); 736 data_->realm_shared_.Reset();
733 } 737 }
734 738
735 739
736 int PerIsolateData::RealmFind(Local<Context> context) { 740 int PerIsolateData::RealmFind(Local<Context> context) {
737 for (int i = 0; i < realm_count_; ++i) { 741 for (int i = 0; i < realm_count_; ++i) {
738 if (realms_[i] == context) return i; 742 if (realms_[i] == context) return i;
739 } 743 }
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 } 2817 }
2814 2818
2815 } // namespace v8 2819 } // namespace v8
2816 2820
2817 2821
2818 #ifndef GOOGLE3 2822 #ifndef GOOGLE3
2819 int main(int argc, char* argv[]) { 2823 int main(int argc, char* argv[]) {
2820 return v8::Shell::Main(argc, argv); 2824 return v8::Shell::Main(argc, argv);
2821 } 2825 }
2822 #endif 2826 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698