OLD | NEW |
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/natives.h" | 5 #include "src/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-source-sink.h" | 10 #include "src/snapshot-source-sink.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 /** | 136 /** |
137 * Read the Natives (library sources) blob, as generated by js2c + the build | 137 * Read the Natives (library sources) blob, as generated by js2c + the build |
138 * system. | 138 * system. |
139 */ | 139 */ |
140 void SetNativesFromFile(StartupData* natives_blob) { | 140 void SetNativesFromFile(StartupData* natives_blob) { |
141 DCHECK(natives_blob); | 141 DCHECK(natives_blob); |
142 DCHECK(natives_blob->data); | 142 DCHECK(natives_blob->data); |
143 DCHECK(natives_blob->raw_size > 0); | 143 DCHECK(natives_blob->raw_size > 0); |
144 | 144 |
145 SnapshotByteSource bytes( | 145 SnapshotByteSource bytes(reinterpret_cast<const byte*>(natives_blob->data), |
146 reinterpret_cast<const byte*>(natives_blob->data), | 146 natives_blob->raw_size); |
147 natives_blob->raw_size); | |
148 NativesHolder<CORE>::set(NativesStore::MakeFromScriptsSource(&bytes)); | 147 NativesHolder<CORE>::set(NativesStore::MakeFromScriptsSource(&bytes)); |
149 NativesHolder<EXPERIMENTAL>::set(NativesStore::MakeFromScriptsSource(&bytes)); | 148 NativesHolder<EXPERIMENTAL>::set(NativesStore::MakeFromScriptsSource(&bytes)); |
150 DCHECK(!bytes.HasMore()); | 149 DCHECK(!bytes.HasMore()); |
151 } | 150 } |
152 | 151 |
153 | 152 |
154 // Implement NativesCollection<T> bsaed on NativesHolder + NativesStore. | 153 // Implement NativesCollection<T> bsaed on NativesHolder + NativesStore. |
155 // | 154 // |
156 // (The callers expect a purely static interface, since this is how the | 155 // (The callers expect a purely static interface, since this is how the |
157 // natives are usually compiled in. Since we implement them based on | 156 // natives are usually compiled in. Since we implement them based on |
(...skipping 30 matching lines...) Expand all Loading... |
188 } | 187 } |
189 | 188 |
190 | 189 |
191 // The compiler can't 'see' all uses of the static methods and hence | 190 // The compiler can't 'see' all uses of the static methods and hence |
192 // my chose to elide them. This we'll explicitly instantiate these. | 191 // my chose to elide them. This we'll explicitly instantiate these. |
193 template class NativesCollection<CORE>; | 192 template class NativesCollection<CORE>; |
194 template class NativesCollection<EXPERIMENTAL>; | 193 template class NativesCollection<EXPERIMENTAL>; |
195 | 194 |
196 } // namespace v8::internal | 195 } // namespace v8::internal |
197 } // namespace v8 | 196 } // namespace v8 |
OLD | NEW |