Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // The common functionality when building with internal or external natives. | |
| 6 | |
| 7 #include "src/heap/heap.h" | |
| 8 #include "src/objects-inl.h" | |
| 9 #include "src/snapshot/natives.h" | |
| 10 | |
| 11 namespace v8 { | |
| 12 namespace internal { | |
| 13 | |
| 14 template <> | |
| 15 FixedArray* Natives::GetSourceCache(Heap* heap) { | |
|
titzer
2015/08/18 12:42:44
Can we have the explicit templated things instead
Michael Starzinger
2015/08/18 12:45:53
Done.
| |
| 16 return heap->natives_source_cache(); | |
| 17 } | |
| 18 | |
| 19 | |
| 20 template <> | |
| 21 FixedArray* ExperimentalNatives::GetSourceCache(Heap* heap) { | |
| 22 return heap->experimental_natives_source_cache(); | |
| 23 } | |
| 24 | |
| 25 | |
| 26 template <> | |
| 27 FixedArray* ExtraNatives::GetSourceCache(Heap* heap) { | |
| 28 return heap->extra_natives_source_cache(); | |
| 29 } | |
| 30 | |
| 31 | |
| 32 template <> | |
| 33 FixedArray* CodeStubNatives::GetSourceCache(Heap* heap) { | |
| 34 return heap->code_stub_natives_source_cache(); | |
| 35 } | |
| 36 | |
| 37 | |
| 38 template <NativeType type> | |
| 39 void NativesCollection<type>::UpdateSourceCache(Heap* heap) { | |
| 40 for (int i = 0; i < GetBuiltinsCount(); i++) { | |
| 41 Object* source = GetSourceCache(heap)->get(i); | |
| 42 if (!source->IsUndefined()) { | |
| 43 ExternalOneByteString::cast(source)->update_data_cache(); | |
| 44 } | |
| 45 } | |
| 46 } | |
| 47 | |
| 48 | |
| 49 // Explicit template instantiations. | |
| 50 template void NativesCollection<CORE>::UpdateSourceCache(Heap* heap); | |
| 51 template void NativesCollection<CODE_STUB>::UpdateSourceCache(Heap* heap); | |
| 52 template void NativesCollection<EXPERIMENTAL>::UpdateSourceCache(Heap* heap); | |
| 53 template void NativesCollection<EXTRAS>::UpdateSourceCache(Heap* heap); | |
| 54 | |
| 55 } // namespace internal | |
| 56 } // namespace v8 | |
| OLD | NEW |