1 // Copyright 2011 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.
5 #ifndef V8_SNAPSHOT_NATIVES_H_
6 #define V8_SNAPSHOT_NATIVES_H_
8 #include "src/objects.h"
9 #include "src/vector.h"
11 namespace v8 { class StartupData; } // Forward declaration.
26 template <NativeType type>
27 class NativesCollection {
29 // The following methods are implemented in js2c-generated code:
31 // Number of built-in scripts.
32 static int GetBuiltinsCount();
33 // Number of debugger implementation scripts.
34 static int GetDebuggerCount();
36 // These are used to access built-in scripts. The debugger implementation
37 // scripts have an index in the interval [0, GetDebuggerCount()). The
38 // non-debugger scripts have an index in the interval [GetDebuggerCount(),
39 // GetNativesCount()).
40 static int GetIndex(const char* name);
41 static Vector<const char> GetScriptSource(int index);
42 static Vector<const char> GetScriptName(int index);
43 static Vector<const char> GetScriptsSource();
45 // The following methods are implemented in natives-common.cc:
47 static FixedArray* GetSourceCache(Heap* heap);
48 static void UpdateSourceCache(Heap* heap);
51 typedef NativesCollection<CORE> Natives;
52 typedef NativesCollection<CODE_STUB> CodeStubNatives;
53 typedef NativesCollection<EXPERIMENTAL> ExperimentalNatives;
54 typedef NativesCollection<EXTRAS> ExtraNatives;
55 typedef NativesCollection<EXPERIMENTAL_EXTRAS> ExperimentalExtraNatives;
58 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
59 // Used for reading the natives at runtime. Implementation in natives-empty.cc
60 void SetNativesFromFile(StartupData* natives_blob);
62 void DisposeNatives();
65 } } // namespace v8::internal
67 #endif // V8_SNAPSHOT_NATIVES_H_