| Index: src/snapshot/natives.h
|
| diff --git a/src/snapshot/natives.h b/src/snapshot/natives.h
|
| index 8c24bd23d089d6abd2bf9290487ec0e12f7c37a2..f4f31a8de4d1011139f3d1cd45218dd570a87036 100644
|
| --- a/src/snapshot/natives.h
|
| +++ b/src/snapshot/natives.h
|
| @@ -18,8 +18,17 @@ namespace internal {
|
|
|
| enum NativeType { CORE, CODE_STUB, EXPERIMENTAL, EXTRAS, D8, TEST };
|
|
|
| +
|
| +template <NativeType type>
|
| +class NativesCollectionBase {
|
| + public:
|
| + static FixedArray* GetSourceCache(Heap* heap);
|
| + static void UpdateSourceCache(Heap* heap);
|
| +};
|
| +
|
| +
|
| template <NativeType type>
|
| -class NativesCollection {
|
| +class NativesCollection : public NativesCollectionBase<type> {
|
| public:
|
| // The following methods are implemented in js2c-generated code:
|
|
|
| @@ -36,11 +45,6 @@ class NativesCollection {
|
| static Vector<const char> GetScriptSource(int index);
|
| static Vector<const char> GetScriptName(int index);
|
| static Vector<const char> GetScriptsSource();
|
| -
|
| - // The following methods are implemented below:
|
| -
|
| - inline static FixedArray* GetSourceCache(Heap* heap);
|
| - static void UpdateSourceCache(Heap* heap);
|
| };
|
|
|
| typedef NativesCollection<CORE> Natives;
|
| @@ -49,40 +53,6 @@ typedef NativesCollection<EXPERIMENTAL> ExperimentalNatives;
|
| typedef NativesCollection<EXTRAS> ExtraNatives;
|
|
|
|
|
| -template <>
|
| -inline FixedArray* Natives::GetSourceCache(Heap* heap) {
|
| - return heap->natives_source_cache();
|
| -}
|
| -
|
| -
|
| -template <>
|
| -inline FixedArray* ExperimentalNatives::GetSourceCache(Heap* heap) {
|
| - return heap->experimental_natives_source_cache();
|
| -}
|
| -
|
| -
|
| -template <>
|
| -inline FixedArray* ExtraNatives::GetSourceCache(Heap* heap) {
|
| - return heap->extra_natives_source_cache();
|
| -}
|
| -
|
| -
|
| -template <>
|
| -inline FixedArray* CodeStubNatives::GetSourceCache(Heap* heap) {
|
| - return heap->code_stub_natives_source_cache();
|
| -}
|
| -
|
| -template <NativeType type>
|
| -void NativesCollection<type>::UpdateSourceCache(Heap* heap) {
|
| - for (int i = 0; i < GetBuiltinsCount(); i++) {
|
| - Object* source = GetSourceCache(heap)->get(i);
|
| - if (!source->IsUndefined()) {
|
| - ExternalOneByteString::cast(source)->update_data_cache();
|
| - }
|
| - }
|
| -}
|
| -
|
| -
|
| #ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
| // Used for reading the natives at runtime. Implementation in natives-empty.cc
|
| void SetNativesFromFile(StartupData* natives_blob);
|
|
|