V8 Project
v8::internal::NativesStore Class Reference

NativesStore stores the 'native' (builtin) JS libraries. More...

+ Collaboration diagram for v8::internal::NativesStore:

Public Member Functions

 ~NativesStore ()
 
int GetBuiltinsCount ()
 
int GetDebuggerCount ()
 
Vector< const char > GetScriptName (int index)
 
Vector< const char > GetRawScriptSource (int index)
 
int GetIndex (const char *name)
 
int GetRawScriptsSize ()
 
Vector< const byteGetScriptsSource ()
 

Static Public Member Functions

static NativesStoreMakeFromScriptsSource (SnapshotByteSource *source)
 

Private Member Functions

 NativesStore ()
 
bool ReadNameAndContentPair (SnapshotByteSource *bytes)
 
 DISALLOW_COPY_AND_ASSIGN (NativesStore)
 

Private Attributes

List< Vector< const char > > native_names_
 
List< Vector< const char > > native_source_
 
int debugger_count_
 

Detailed Description

NativesStore stores the 'native' (builtin) JS libraries.

NativesStore needs to be initialized before using V8, usually by the embedder calling v8::SetNativesDataBlob, which calls SetNativesFromFile below.

Definition at line 24 of file natives-external.cc.

Constructor & Destructor Documentation

◆ ~NativesStore()

v8::internal::NativesStore::~NativesStore ( )
inline

Definition at line 26 of file natives-external.cc.

26 {}

◆ NativesStore()

v8::internal::NativesStore::NativesStore ( )
inlineprivate

Definition at line 76 of file natives-external.cc.

Referenced by MakeFromScriptsSource().

+ Here is the caller graph for this function:

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::NativesStore::DISALLOW_COPY_AND_ASSIGN ( NativesStore  )
private

◆ GetBuiltinsCount()

int v8::internal::NativesStore::GetBuiltinsCount ( )
inline

Definition at line 28 of file natives-external.cc.

28 { return native_names_.length(); }
List< Vector< const char > > native_names_

References native_names_.

Referenced by v8::internal::NativesCollection< type >::GetBuiltinsCount().

+ Here is the caller graph for this function:

◆ GetDebuggerCount()

int v8::internal::NativesStore::GetDebuggerCount ( )
inline

Definition at line 29 of file natives-external.cc.

29 { return debugger_count_; }

References debugger_count_.

Referenced by v8::internal::NativesCollection< type >::GetDebuggerCount().

+ Here is the caller graph for this function:

◆ GetIndex()

int v8::internal::NativesStore::GetIndex ( const char *  name)
inline

Definition at line 35 of file natives-external.cc.

35  {
36  for (int i = 0; i < native_names_.length(); ++i) {
37  int native_name_length = native_names_[i].length();
38  if ((static_cast<int>(strlen(name)) == native_name_length) &&
39  (strncmp(name, native_names_[i].start(), native_name_length) == 0)) {
40  return i;
41  }
42  }
43  DCHECK(false);
44  return -1;
45  }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, name, and native_names_.

Referenced by v8::internal::NativesCollection< type >::GetIndex().

+ Here is the caller graph for this function:

◆ GetRawScriptSource()

Vector<const char> v8::internal::NativesStore::GetRawScriptSource ( int  index)
inline

Definition at line 31 of file natives-external.cc.

31  {
32  return native_source_[index];
33  }
List< Vector< const char > > native_source_

References native_source_.

Referenced by v8::internal::NativesCollection< type >::GetRawScriptSource().

+ Here is the caller graph for this function:

◆ GetRawScriptsSize()

int v8::internal::NativesStore::GetRawScriptsSize ( )
inline

Definition at line 47 of file natives-external.cc.

47  {
48  DCHECK(false); // Used for compression. Doesn't really make sense here.
49  return 0;
50  }

References DCHECK.

Referenced by v8::internal::NativesCollection< type >::GetRawScriptsSize().

+ Here is the caller graph for this function:

◆ GetScriptName()

Vector<const char> v8::internal::NativesStore::GetScriptName ( int  index)
inline

Definition at line 30 of file natives-external.cc.

30 { return native_names_[index]; }

References native_names_.

Referenced by v8::internal::NativesCollection< type >::GetScriptName().

+ Here is the caller graph for this function:

◆ GetScriptsSource()

Vector<const byte> v8::internal::NativesStore::GetScriptsSource ( )
inline

Definition at line 52 of file natives-external.cc.

52  {
53  DCHECK(false); // Used for compression. Doesn't really make sense here.
54  return Vector<const byte>();
55  }

References DCHECK.

Referenced by v8::internal::NativesCollection< type >::GetScriptsSource().

+ Here is the caller graph for this function:

◆ MakeFromScriptsSource()

static NativesStore* v8::internal::NativesStore::MakeFromScriptsSource ( SnapshotByteSource *  source)
inlinestatic

Definition at line 57 of file natives-external.cc.

57  {
58  NativesStore* store = new NativesStore;
59 
60  // We expect the libraries in the following format:
61  // int: # of debugger sources.
62  // 2N blobs: N pairs of source name + actual source.
63  // then, repeat for non-debugger sources.
64  int debugger_count = source->GetInt();
65  for (int i = 0; i < debugger_count; ++i)
66  store->ReadNameAndContentPair(source);
67  int library_count = source->GetInt();
68  for (int i = 0; i < library_count; ++i)
69  store->ReadNameAndContentPair(source);
70 
71  store->debugger_count_ = debugger_count;
72  return store;
73  }

References debugger_count_, NativesStore(), and ReadNameAndContentPair().

Referenced by v8::internal::SetNativesFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadNameAndContentPair()

bool v8::internal::NativesStore::ReadNameAndContentPair ( SnapshotByteSource *  bytes)
inlineprivate

Definition at line 78 of file natives-external.cc.

78  {
79  const byte* name;
80  int name_length;
81  const byte* source;
82  int source_length;
83  bool success = bytes->GetBlob(&name, &name_length) &&
84  bytes->GetBlob(&source, &source_length);
85  if (success) {
86  Vector<const char> name_vector(
87  reinterpret_cast<const char*>(name), name_length);
88  Vector<const char> source_vector(
89  reinterpret_cast<const char*>(source), source_length);
90  native_names_.Add(name_vector);
91  native_source_.Add(source_vector);
92  }
93  return success;
94  }

References name, native_names_, and native_source_.

Referenced by MakeFromScriptsSource().

+ Here is the caller graph for this function:

Member Data Documentation

◆ debugger_count_

int v8::internal::NativesStore::debugger_count_
private

Definition at line 98 of file natives-external.cc.

Referenced by GetDebuggerCount(), and MakeFromScriptsSource().

◆ native_names_

List<Vector<const char> > v8::internal::NativesStore::native_names_
private

◆ native_source_

List<Vector<const char> > v8::internal::NativesStore::native_source_
private

Definition at line 97 of file natives-external.cc.

Referenced by GetRawScriptSource(), and ReadNameAndContentPair().


The documentation for this class was generated from the following file: