5 #ifndef V8_SNAPSHOT_NATIVES_H_ 6 #define V8_SNAPSHOT_NATIVES_H_ 8 #include "include/v8.h" 9 #include "src/objects.h" 10 #include "src/vector.h" 12 namespace v8 {
class StartupData; }
27 template <NativeType type>
28 #ifdef USING_V8_SHARED 29 class NativesCollection {
32 #endif // USING_V8_SHARED 38 static int GetBuiltinsCount();
40 static int GetDebuggerCount();
46 static int GetIndex(
const char* name);
57 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 59 void SetNativesFromFile(StartupData* natives_blob);
61 void DisposeNatives();
69 const char*
data()
const override {
return data_; }
70 size_t length()
const override {
return length_; }
73 DCHECK(type_ == CORE || type_ == EXTRAS);
74 intptr_t val = (index_ << 1) | ((type_ == CORE) ? 0 : 1);
75 val = val << kPointerSizeLog2;
80 static NativesExternalStringResource* DecodeForDeserialization(
82 intptr_t val =
reinterpret_cast<intptr_t
>(encoded) >> kPointerSizeLog2;
83 NativeType
type = (val & 1) ? EXTRAS : CORE;
84 int index =
static_cast<int>(val >> 1);
85 return new NativesExternalStringResource(
type, index);
98 #endif // V8_SNAPSHOT_NATIVES_H_ size_t length() const override
const char * data() const override