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

Side by Side Diff: src/serialize.h

Issue 671153002: Fix memory leak in RootIndexMap. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« 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 #ifndef V8_SERIALIZE_H_ 5 #ifndef V8_SERIALIZE_H_
6 #define V8_SERIALIZE_H_ 6 #define V8_SERIALIZE_H_
7 7
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/hashmap.h" 9 #include "src/hashmap.h"
10 #include "src/heap-profiler.h" 10 #include "src/heap-profiler.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 static void* Key(HeapObject* obj) { 162 static void* Key(HeapObject* obj) {
163 return reinterpret_cast<void*>(obj->address()); 163 return reinterpret_cast<void*>(obj->address());
164 } 164 }
165 }; 165 };
166 166
167 167
168 class RootIndexMap : public AddressMapBase { 168 class RootIndexMap : public AddressMapBase {
169 public: 169 public:
170 explicit RootIndexMap(Isolate* isolate); 170 explicit RootIndexMap(Isolate* isolate);
171 171
172 ~RootIndexMap() { delete map_; }
173
172 static const int kInvalidRootIndex = -1; 174 static const int kInvalidRootIndex = -1;
173 int Lookup(HeapObject* obj) { 175 int Lookup(HeapObject* obj) {
174 HashMap::Entry* entry = LookupEntry(map_, obj, false); 176 HashMap::Entry* entry = LookupEntry(map_, obj, false);
175 if (entry) return GetValue(entry); 177 if (entry) return GetValue(entry);
176 return kInvalidRootIndex; 178 return kInvalidRootIndex;
177 } 179 }
178 180
179 private: 181 private:
180 HashMap* map_; 182 HashMap* map_;
181 183
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // Following the header, we store, in sequential order 829 // Following the header, we store, in sequential order
828 // - code stub keys 830 // - code stub keys
829 // - serialization payload 831 // - serialization payload
830 832
831 ScriptData* script_data_; 833 ScriptData* script_data_;
832 bool owns_script_data_; 834 bool owns_script_data_;
833 }; 835 };
834 } } // namespace v8::internal 836 } } // namespace v8::internal
835 837
836 #endif // V8_SERIALIZE_H_ 838 #endif // V8_SERIALIZE_H_
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