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

Side by Side Diff: src/bootstrapper.h

Issue 911543002: Correctly clean up natives sources on tear down. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | src/bootstrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_BOOTSTRAPPER_H_ 5 #ifndef V8_BOOTSTRAPPER_H_
6 #define V8_BOOTSTRAPPER_H_ 6 #define V8_BOOTSTRAPPER_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // Tells whether bootstrapping is active. 92 // Tells whether bootstrapping is active.
93 bool IsActive() const { return nesting_ != 0; } 93 bool IsActive() const { return nesting_ != 0; }
94 94
95 // Support for thread preemption. 95 // Support for thread preemption.
96 static int ArchiveSpacePerThread(); 96 static int ArchiveSpacePerThread();
97 char* ArchiveState(char* to); 97 char* ArchiveState(char* to);
98 char* RestoreState(char* from); 98 char* RestoreState(char* from);
99 void FreeThreadResources(); 99 void FreeThreadResources();
100 100
101 // This will allocate a char array that is deleted when V8 is shut down.
102 // It should only be used for strictly finite allocations.
103 char* AllocateAutoDeletedArray(int bytes);
104
105 // Used for new context creation. 101 // Used for new context creation.
106 bool InstallExtensions(Handle<Context> native_context, 102 bool InstallExtensions(Handle<Context> native_context,
107 v8::ExtensionConfiguration* extensions); 103 v8::ExtensionConfiguration* extensions);
108 104
109 SourceCodeCache* extensions_cache() { return &extensions_cache_; } 105 SourceCodeCache* extensions_cache() { return &extensions_cache_; }
110 106
111 private: 107 private:
112 Isolate* isolate_; 108 Isolate* isolate_;
113 typedef int NestingCounterType; 109 typedef int NestingCounterType;
114 NestingCounterType nesting_; 110 NestingCounterType nesting_;
115 SourceCodeCache extensions_cache_; 111 SourceCodeCache extensions_cache_;
116 // This is for delete, not delete[].
117 List<char*>* delete_these_non_arrays_on_tear_down_;
118 // This is for delete[]
119 List<char*>* delete_these_arrays_on_tear_down_;
120 112
121 friend class BootstrapperActive; 113 friend class BootstrapperActive;
122 friend class Isolate; 114 friend class Isolate;
123 friend class NativesExternalStringResource; 115 friend class NativesExternalStringResource;
124 116
125 explicit Bootstrapper(Isolate* isolate); 117 explicit Bootstrapper(Isolate* isolate);
126 118
127 static v8::Extension* free_buffer_extension_; 119 static v8::Extension* free_buffer_extension_;
128 static v8::Extension* gc_extension_; 120 static v8::Extension* gc_extension_;
129 static v8::Extension* externalize_string_extension_; 121 static v8::Extension* externalize_string_extension_;
(...skipping 18 matching lines...) Expand all
148 private: 140 private:
149 Bootstrapper* bootstrapper_; 141 Bootstrapper* bootstrapper_;
150 142
151 DISALLOW_COPY_AND_ASSIGN(BootstrapperActive); 143 DISALLOW_COPY_AND_ASSIGN(BootstrapperActive);
152 }; 144 };
153 145
154 146
155 class NativesExternalStringResource FINAL 147 class NativesExternalStringResource FINAL
156 : public v8::String::ExternalOneByteStringResource { 148 : public v8::String::ExternalOneByteStringResource {
157 public: 149 public:
158 NativesExternalStringResource(Bootstrapper* bootstrapper, 150 NativesExternalStringResource(const char* source, size_t length)
ulan 2015/02/09 08:22:52 Shouldn't the destructor of this delete data?
Yang 2015/02/09 08:37:16 No. The data is supplied either as an address in t
159 const char* source, 151 : data_(source), length_(length) {}
160 size_t length);
161 const char* data() const OVERRIDE { return data_; } 152 const char* data() const OVERRIDE { return data_; }
162 size_t length() const OVERRIDE { return length_; } 153 size_t length() const OVERRIDE { return length_; }
163 154
164 private: 155 private:
165 const char* data_; 156 const char* data_;
166 size_t length_; 157 size_t length_;
167 }; 158 };
168 159
169 }} // namespace v8::internal 160 }} // namespace v8::internal
170 161
171 #endif // V8_BOOTSTRAPPER_H_ 162 #endif // V8_BOOTSTRAPPER_H_
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698