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

Side by Side Diff: src/snapshot/natives-external.cc

Issue 1284413002: Add experimental, non-snapshotted V8 extras (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@non-experimental-extras
Patch Set: Missing gn entries Created 5 years, 4 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 | « src/snapshot/natives-common.cc ('k') | test/cctest/test-api.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 #include "src/snapshot/natives.h" 5 #include "src/snapshot/natives.h"
6 6
7 #include "src/base/logging.h" 7 #include "src/base/logging.h"
8 #include "src/list.h" 8 #include "src/list.h"
9 #include "src/list-inl.h" 9 #include "src/list-inl.h"
10 #include "src/snapshot/snapshot-source-sink.h" 10 #include "src/snapshot/snapshot-source-sink.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 * Read the Natives blob, as previously set by SetNativesFromFile. 154 * Read the Natives blob, as previously set by SetNativesFromFile.
155 */ 155 */
156 void ReadNatives() { 156 void ReadNatives() {
157 if (natives_blob_ && NativesHolder<CORE>::empty()) { 157 if (natives_blob_ && NativesHolder<CORE>::empty()) {
158 SnapshotByteSource bytes(natives_blob_->data, natives_blob_->raw_size); 158 SnapshotByteSource bytes(natives_blob_->data, natives_blob_->raw_size);
159 NativesHolder<CORE>::set(NativesStore::MakeFromScriptsSource(&bytes)); 159 NativesHolder<CORE>::set(NativesStore::MakeFromScriptsSource(&bytes));
160 NativesHolder<CODE_STUB>::set(NativesStore::MakeFromScriptsSource(&bytes)); 160 NativesHolder<CODE_STUB>::set(NativesStore::MakeFromScriptsSource(&bytes));
161 NativesHolder<EXPERIMENTAL>::set( 161 NativesHolder<EXPERIMENTAL>::set(
162 NativesStore::MakeFromScriptsSource(&bytes)); 162 NativesStore::MakeFromScriptsSource(&bytes));
163 NativesHolder<EXTRAS>::set(NativesStore::MakeFromScriptsSource(&bytes)); 163 NativesHolder<EXTRAS>::set(NativesStore::MakeFromScriptsSource(&bytes));
164 NativesHolder<EXPERIMENTAL_EXTRAS>::set(
165 NativesStore::MakeFromScriptsSource(&bytes));
164 DCHECK(!bytes.HasMore()); 166 DCHECK(!bytes.HasMore());
165 } 167 }
166 } 168 }
167 169
168 170
169 /** 171 /**
170 * Set the Natives (library sources) blob, as generated by js2c + the build 172 * Set the Natives (library sources) blob, as generated by js2c + the build
171 * system. 173 * system.
172 */ 174 */
173 void SetNativesFromFile(StartupData* natives_blob) { 175 void SetNativesFromFile(StartupData* natives_blob) {
174 DCHECK(!natives_blob_); 176 DCHECK(!natives_blob_);
175 DCHECK(natives_blob); 177 DCHECK(natives_blob);
176 DCHECK(natives_blob->data); 178 DCHECK(natives_blob->data);
177 DCHECK(natives_blob->raw_size > 0); 179 DCHECK(natives_blob->raw_size > 0);
178 180
179 natives_blob_ = natives_blob; 181 natives_blob_ = natives_blob;
180 ReadNatives(); 182 ReadNatives();
181 } 183 }
182 184
183 185
184 /** 186 /**
185 * Release memory allocated by SetNativesFromFile. 187 * Release memory allocated by SetNativesFromFile.
186 */ 188 */
187 void DisposeNatives() { 189 void DisposeNatives() {
188 NativesHolder<CORE>::Dispose(); 190 NativesHolder<CORE>::Dispose();
189 NativesHolder<CODE_STUB>::Dispose(); 191 NativesHolder<CODE_STUB>::Dispose();
190 NativesHolder<EXPERIMENTAL>::Dispose(); 192 NativesHolder<EXPERIMENTAL>::Dispose();
191 NativesHolder<EXTRAS>::Dispose(); 193 NativesHolder<EXTRAS>::Dispose();
194 NativesHolder<EXPERIMENTAL_EXTRAS>::Dispose();
192 } 195 }
193 196
194 197
195 // Implement NativesCollection<T> bsaed on NativesHolder + NativesStore. 198 // Implement NativesCollection<T> bsaed on NativesHolder + NativesStore.
196 // 199 //
197 // (The callers expect a purely static interface, since this is how the 200 // (The callers expect a purely static interface, since this is how the
198 // natives are usually compiled in. Since we implement them based on 201 // natives are usually compiled in. Since we implement them based on
199 // runtime content, we have to implement this indirection to offer 202 // runtime content, we have to implement this indirection to offer
200 // a static interface.) 203 // a static interface.)
201 template<NativeType type> 204 template<NativeType type>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 template int NativesCollection<T>::GetBuiltinsCount(); \ 237 template int NativesCollection<T>::GetBuiltinsCount(); \
235 template int NativesCollection<T>::GetDebuggerCount(); \ 238 template int NativesCollection<T>::GetDebuggerCount(); \
236 template int NativesCollection<T>::GetIndex(const char* name); \ 239 template int NativesCollection<T>::GetIndex(const char* name); \
237 template Vector<const char> NativesCollection<T>::GetScriptSource(int i); \ 240 template Vector<const char> NativesCollection<T>::GetScriptSource(int i); \
238 template Vector<const char> NativesCollection<T>::GetScriptName(int i); \ 241 template Vector<const char> NativesCollection<T>::GetScriptName(int i); \
239 template Vector<const char> NativesCollection<T>::GetScriptsSource(); 242 template Vector<const char> NativesCollection<T>::GetScriptsSource();
240 INSTANTIATE_TEMPLATES(CORE) 243 INSTANTIATE_TEMPLATES(CORE)
241 INSTANTIATE_TEMPLATES(CODE_STUB) 244 INSTANTIATE_TEMPLATES(CODE_STUB)
242 INSTANTIATE_TEMPLATES(EXPERIMENTAL) 245 INSTANTIATE_TEMPLATES(EXPERIMENTAL)
243 INSTANTIATE_TEMPLATES(EXTRAS) 246 INSTANTIATE_TEMPLATES(EXTRAS)
247 INSTANTIATE_TEMPLATES(EXPERIMENTAL_EXTRAS)
244 #undef INSTANTIATE_TEMPLATES 248 #undef INSTANTIATE_TEMPLATES
245 249
246 } // namespace internal 250 } // namespace internal
247 } // namespace v8 251 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/natives-common.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698