V8 Project
v8 Namespace Reference

Debugger support for the V8 JavaScript engine. More...

Namespaces

 anonymous_namespace{api.cc}
 
 base
 
 internal
 
 platform
 

Classes

struct  OneByteMask
 
struct  OneByteMask< 4 >
 
struct  OneByteMask< 8 >
 
class  ContainsOnlyOneByteHelper
 
class  Utf8LengthHelper
 
class  Utf8WriterVisitor
 
class  VisitorAdapter
 
class  Consts
 
class  NeanderObject
 
class  NeanderArray
 
class  ApiFunction
 
class  RegisteredExtension
 
class  Utils
 
class  Handle
 An object reference managed by the v8 garbage collector. More...
 
class  ZombieProtector
 
class  OpenFDCloser
 
class  ExecArgs
 
class  ReadLineEditor
 
class  PerIsolateData
 
class  DumbLineEditor
 
struct  CounterAndKey
 
struct  DataAndPersistent
 
class  ShellArrayBufferAllocator
 
class  MockArrayBufferAllocator
 
class  Counter
 
class  CounterCollection
 
class  CounterMap
 
class  LineEditor
 
class  SourceGroup
 
class  BinaryResource
 
class  ShellOptions
 
class  Shell
 
class  TestWithIsolate
 
class  TestWithContext
 
class  Debug
 
class  Task
 A Task represents a unit of work. More...
 
class  Platform
 V8 Platform abstraction layer. More...
 
class  CpuProfileNode
 CpuProfileNode represents a node in a call graph. More...
 
class  CpuProfile
 CpuProfile contains a CPU profile in a form of top-down call tree (from main() down to functions that do all the work). More...
 
class  CpuProfiler
 Interface for controlling CPU profiling. More...
 
class  HeapGraphEdge
 HeapSnapshotEdge represents a directed connection between heap graph nodes: from retainers to retained nodes. More...
 
class  HeapGraphNode
 HeapGraphNode represents a node in a heap graph. More...
 
class  OutputStream
 An interface for exporting data from V8, using "push" model. More...
 
class  HeapSnapshot
 HeapSnapshots record the state of the JS heap at some moment. More...
 
class  ActivityControl
 An interface for reporting progress and controlling long-running activities. More...
 
class  HeapProfiler
 Interface for controlling heap profiling. More...
 
class  RetainedObjectInfo
 Interface for providing information about embedder's objects held by global handles. More...
 
struct  HeapStatsUpdate
 A struct for exporting HeapStats data from V8, using "push" model. More...
 
class  Testing
 
class  StdMapTraits
 A default trait implemenation for PersistentValueMap which uses std::map as a backing map. More...
 
class  DefaultPersistentValueMapTraits
 A default trait implementation for PersistentValueMap, which inherits a std:map backing map from StdMapTraits and holds non-weak persistent objects and has no special Dispose handling. More...
 
class  PersistentValueMap
 A map wrapper that allows using UniquePersistent as a mapped value. More...
 
class  StdPersistentValueMap
 A map that uses UniquePersistent as value and std::map as the backing implementation. More...
 
class  DefaultPersistentValueVectorTraits
 
class  PersistentValueVector
 A vector wrapper that safely stores UniquePersistent values. More...
 
class  Local
 A light-weight stack-allocated object handle. More...
 
class  Eternal
 
class  NonCopyablePersistentTraits
 Default traits for Persistent. More...
 
class  PersistentBase
 An object reference that is independent of any handle scope. More...
 
class  Persistent
 A PersistentBase which allows copy and assignment. More...
 
class  UniquePersistent
 A PersistentBase which has move semantics. More...
 
class  WeakCallbackObject
 
class  FunctionCallbackInfo
 The argument information given to function call callbacks. More...
 
class  PropertyCallbackInfo
 The information passed to a property callback about the context of the property access. More...
 
class  ReturnValue
 
class  UniqueId
 General purpose unique identifier. More...
 
class  WeakCallbackData
 
struct  CopyablePersistentTraits
 Helper class traits to allow copying and assignment of Persistent. More...
 
class  HandleScope
 A stack-allocated class that governs a number of local handles. More...
 
class  EscapableHandleScope
 A HandleScope which first allocates a handle in the current scope which will be later filled with the escape value. More...
 
struct  Maybe
 A simple Maybe type, representing an object which may or may not have a value. More...
 
class  Data
 The superclass of values and API object templates. More...
 
class  ScriptOrigin
 The origin, within a file, of a script. More...
 
class  UnboundScript
 A compiled JavaScript script, not yet tied to a Context. More...
 
class  Script
 A compiled JavaScript script, tied to a Context which was active when the script was compiled. More...
 
class  ScriptCompiler
 For compiling scripts. More...
 
class  Message
 An error message. More...
 
class  StackTrace
 Representation of a JavaScript stack trace. More...
 
class  StackFrame
 A single JavaScript stack frame. More...
 
class  JSON
 A JSON Parser. More...
 
class  Value
 The superclass of all JavaScript values and objects. More...
 
class  Primitive
 The superclass of primitive values. More...
 
class  Boolean
 A primitive boolean value (ECMA-262, 4.3.14). More...
 
class  Name
 A superclass for symbols and strings. More...
 
class  String
 A JavaScript string value (ECMA-262, 4.3.17). More...
 
class  Symbol
 A JavaScript symbol (ECMA-262 edition 6) More...
 
class  Private
 A private symbol. More...
 
class  Number
 A JavaScript number value (ECMA-262, 4.3.20) More...
 
class  Integer
 A JavaScript value representing a signed integer. More...
 
class  Int32
 A JavaScript value representing a 32-bit signed integer. More...
 
class  Uint32
 A JavaScript value representing a 32-bit unsigned integer. More...
 
class  Object
 A JavaScript object (ECMA-262, 4.3.3) More...
 
class  Array
 An instance of the built-in array constructor (ECMA-262, 15.4.2). More...
 
class  Function
 A JavaScript function object (ECMA-262, 15.3). More...
 
class  Promise
 An instance of the built-in Promise constructor (ES6 draft). More...
 
class  ArrayBuffer
 An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). More...
 
class  ArrayBufferView
 A base class for an instance of one of "views" over ArrayBuffer, including TypedArrays and DataView (ES6 draft 15.13). More...
 
class  TypedArray
 A base class for an instance of TypedArray series of constructors (ES6 draft 15.13.6). More...
 
class  Uint8Array
 An instance of Uint8Array constructor (ES6 draft 15.13.6). More...
 
class  Uint8ClampedArray
 An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). More...
 
class  Int8Array
 An instance of Int8Array constructor (ES6 draft 15.13.6). More...
 
class  Uint16Array
 An instance of Uint16Array constructor (ES6 draft 15.13.6). More...
 
class  Int16Array
 An instance of Int16Array constructor (ES6 draft 15.13.6). More...
 
class  Uint32Array
 An instance of Uint32Array constructor (ES6 draft 15.13.6). More...
 
class  Int32Array
 An instance of Int32Array constructor (ES6 draft 15.13.6). More...
 
class  Float32Array
 An instance of Float32Array constructor (ES6 draft 15.13.6). More...
 
class  Float64Array
 An instance of Float64Array constructor (ES6 draft 15.13.6). More...
 
class  DataView
 An instance of DataView constructor (ES6 draft 15.13.7). More...
 
class  Date
 An instance of the built-in Date constructor (ECMA-262, 15.9). More...
 
class  NumberObject
 A Number object (ECMA-262, 4.3.21). More...
 
class  BooleanObject
 A Boolean object (ECMA-262, 4.3.15). More...
 
class  StringObject
 A String object (ECMA-262, 4.3.18). More...
 
class  SymbolObject
 A Symbol object (ECMA-262 edition 6). More...
 
class  RegExp
 An instance of the built-in RegExp constructor (ECMA-262, 15.10). More...
 
class  External
 A JavaScript value that wraps a C++ void*. More...
 
class  Template
 The superclass of object and function templates. More...
 
class  FunctionTemplate
 A FunctionTemplate is used to create functions at runtime. More...
 
class  ObjectTemplate
 An ObjectTemplate is used to create objects at runtime. More...
 
class  Signature
 A Signature specifies which receivers and arguments are valid parameters to a function. More...
 
class  AccessorSignature
 An AccessorSignature specifies which receivers are valid parameters to an accessor callback. More...
 
class  DeclaredAccessorDescriptor
 
class  ObjectOperationDescriptor
 
class  RawOperationDescriptor
 
class  TypeSwitch
 A utility for determining the type of objects based on the template they were constructed from. More...
 
class  ExternalOneByteStringResourceImpl
 
class  Extension
 Ignore. More...
 
class  ResourceConstraints
 A set of constraints that specifies the limits of the runtime's memory use. More...
 
class  Exception
 Create new error objects by calling the corresponding error object constructor with the message. More...
 
class  HeapStatistics
 Collection of V8 heap information. More...
 
struct  JitCodeEvent
 A JIT code event is issued each time code is added, moved or removed. More...
 
class  Isolate
 Isolate represents an isolated instance of the V8 engine. More...
 
class  StartupData
 
class  StartupDataDecompressor
 A helper class for driving V8 startup data decompression. More...
 
class  ExternalResourceVisitor
 Interface for iterating through all external resources in the heap. More...
 
class  PersistentHandleVisitor
 Interface for iterating through all the persistent handles in the heap. More...
 
class  V8
 Container class for static utility functions. More...
 
class  TryCatch
 An external exception handler. More...
 
class  ExtensionConfiguration
 A container for extension names. More...
 
class  Context
 A sandboxed execution context with its own set of built-in objects and functions. More...
 
class  Unlocker
 Multiple threads in V8 are allowed, but only one thread at a time is allowed to use any given V8 isolate, see the comments in the Isolate class. More...
 
class  Locker
 
class  AlignOfHelper
 

Typedefs

typedef uint32_t SnapshotObjectId
 
typedef uintptr_t PersistentContainerValue
 
typedef void(* AccessorGetterCallback) (Local< String > property, const PropertyCallbackInfo< Value > &info)
 Accessor[Getter|Setter] are used as callback functions when setting|getting a particular property. More...
 
typedef void(* AccessorNameGetterCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info)
 
typedef void(* AccessorSetterCallback) (Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
 
typedef void(* AccessorNameSetterCallback) (Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
 
typedef void(* FunctionCallback) (const FunctionCallbackInfo< Value > &info)
 
typedef void(* NamedPropertyGetterCallback) (Local< String > property, const PropertyCallbackInfo< Value > &info)
 NamedProperty[Getter|Setter] are used as interceptors on object. More...
 
typedef void(* NamedPropertySetterCallback) (Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
 Returns the value if the setter intercepts the request. More...
 
typedef void(* NamedPropertyQueryCallback) (Local< String > property, const PropertyCallbackInfo< Integer > &info)
 Returns a non-empty handle if the interceptor intercepts the request. More...
 
typedef void(* NamedPropertyDeleterCallback) (Local< String > property, const PropertyCallbackInfo< Boolean > &info)
 Returns a non-empty handle if the deleter intercepts the request. More...
 
typedef void(* NamedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)
 Returns an array containing the names of the properties the named property getter intercepts. More...
 
typedef void(* IndexedPropertyGetterCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info)
 Returns the value of the property if the getter intercepts the request. More...
 
typedef void(* IndexedPropertySetterCallback) (uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
 Returns the value if the setter intercepts the request. More...
 
typedef void(* IndexedPropertyQueryCallback) (uint32_t index, const PropertyCallbackInfo< Integer > &info)
 Returns a non-empty handle if the interceptor intercepts the request. More...
 
typedef void(* IndexedPropertyDeleterCallback) (uint32_t index, const PropertyCallbackInfo< Boolean > &info)
 Returns a non-empty handle if the deleter intercepts the request. More...
 
typedef void(* IndexedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)
 Returns an array containing the indices of the properties the indexed property getter intercepts. More...
 
typedef bool(* NamedSecurityCallback) (Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
 Returns true if cross-context access should be allowed to the named property with the given key on the host object. More...
 
typedef bool(* IndexedSecurityCallback) (Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
 Returns true if cross-context access should be allowed to the indexed property with the given index on the host object. More...
 
typedef void(* FatalErrorCallback) (const char *location, const char *message)
 
typedef void(* MessageCallback) (Handle< Message > message, Handle< Value > error)
 
typedef void(* LogEventCallback) (const char *name, int event)
 
typedef int *(* CounterLookupCallback) (const char *name)
 
typedef void *(* CreateHistogramCallback) (const char *name, int min, int max, size_t buckets)
 
typedef void(* AddHistogramSampleCallback) (void *histogram, int sample)
 
typedef void(* MemoryAllocationCallback) (ObjectSpace space, AllocationAction action, int size)
 
typedef void(* CallCompletedCallback) ()
 
typedef void(* MicrotaskCallback) (void *data)
 
typedef void(* FailedAccessCheckCallback) (Local< Object > target, AccessType type, Local< Value > data)
 
typedef bool(* AllowCodeGenerationFromStringsCallback) (Local< Context > context)
 Callback to check if code generation from strings is allowed. More...
 
typedef void(* GCPrologueCallback) (GCType type, GCCallbackFlags flags)
 
typedef void(* GCEpilogueCallback) (GCType type, GCCallbackFlags flags)
 
typedef void(* InterruptCallback) (Isolate *isolate, void *data)
 
typedef void(* FunctionEntryHook) (uintptr_t function, uintptr_t return_addr_location)
 FunctionEntryHook is the type of the profile entry hook called at entry to any generated function when function-level profiling is enabled. More...
 
typedef void(* JitCodeEventHandler) (const JitCodeEvent *event)
 Callback function passed to SetJitCodeEventHandler. More...
 
typedef bool(* EntropySource) (unsigned char *buffer, size_t length)
 EntropySource is used as a callback function when v8 needs a source of entropy. More...
 
typedef uintptr_t(* ReturnAddressLocationResolver) (uintptr_t return_addr_location)
 ReturnAddressLocationResolver is used as a callback function when v8 is resolving the location of a return address on the stack. More...
 

Enumerations

enum  CompressedStartupDataItems {
  kSnapshot = 0 , kSnapshotContext , kLibraries , kExperimentalLibraries ,
  kCompressedStartupDataCount
}
 
enum  DebugEvent {
  Break = 1 , Exception = 2 , NewFunction = 3 , BeforeCompile = 4 ,
  AfterCompile = 5 , CompileError = 6 , PromiseEvent = 7 , AsyncTaskEvent = 8 ,
  BreakForCommand = 9
}
 
enum  PersistentContainerCallbackType { kNotWeak , kWeak }
 
enum  PropertyAttribute { None = 0 , ReadOnly = 1 << 0 , DontEnum = 1 << 1 , DontDelete = 1 << 2 }
 
enum  ExternalArrayType {
  kExternalInt8Array = 1 , kExternalUint8Array , kExternalInt16Array , kExternalUint16Array ,
  kExternalInt32Array , kExternalUint32Array , kExternalFloat32Array , kExternalFloat64Array ,
  kExternalUint8ClampedArray , kExternalByteArray = kExternalInt8Array , kExternalUnsignedByteArray = kExternalUint8Array , kExternalShortArray = kExternalInt16Array ,
  kExternalUnsignedShortArray = kExternalUint16Array , kExternalIntArray = kExternalInt32Array , kExternalUnsignedIntArray = kExternalUint32Array , kExternalFloatArray = kExternalFloat32Array ,
  kExternalDoubleArray = kExternalFloat64Array , kExternalPixelArray = kExternalUint8ClampedArray
}
 
enum  AccessControl { DEFAULT = 0 , ALL_CAN_READ = 1 , ALL_CAN_WRITE = 1 << 1 , PROHIBITS_OVERWRITING = 1 << 2 }
 Access control specifications. More...
 
enum  AccessType {
  ACCESS_GET , ACCESS_SET , ACCESS_HAS , ACCESS_DELETE ,
  ACCESS_KEYS
}
 Access type specification. More...
 
enum  DeclaredAccessorDescriptorDataType {
  kDescriptorBoolType , kDescriptorInt8Type , kDescriptorUint8Type , kDescriptorInt16Type ,
  kDescriptorUint16Type , kDescriptorInt32Type , kDescriptorUint32Type , kDescriptorFloatType ,
  kDescriptorDoubleType
}
 
enum  ObjectSpace {
  kObjectSpaceNewSpace = 1 << 0 , kObjectSpaceOldPointerSpace = 1 << 1 , kObjectSpaceOldDataSpace = 1 << 2 , kObjectSpaceCodeSpace = 1 << 3 ,
  kObjectSpaceMapSpace = 1 << 4 , kObjectSpaceLoSpace = 1 << 5 , kObjectSpaceAll
}
 
enum  AllocationAction { kAllocationActionAllocate = 1 << 0 , kAllocationActionFree = 1 << 1 , kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree }
 
enum  GCType { kGCTypeScavenge = 1 << 0 , kGCTypeMarkSweepCompact = 1 << 1 , kGCTypeAll = kGCTypeScavenge | kGCTypeMarkSweepCompact }
 Applications can register callback functions which will be called before and after a garbage collection. More...
 
enum  GCCallbackFlags { kNoGCCallbackFlags = 0 , kGCCallbackFlagCompacted = 1 << 0 , kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1 , kGCCallbackFlagForced = 1 << 2 }
 
enum  JitCodeEventOptions { kJitCodeEventDefault = 0 , kJitCodeEventEnumExisting = 1 }
 Option flags passed to the SetJitCodeEventHandler function. More...
 

Functions

static bool IsExecutionTerminatingCheck (i::Isolate *isolate)
 
void RegisterExtension (Extension *that)
 
void SetResourceConstraints (i::Isolate *isolate, const ResourceConstraints &constraints)
 
static void * DecodeSmiToAligned (i::Object *value, const char *location)
 
static i::SmiEncodeAlignedAsSmi (void *value, const char *location)
 
static i::Handle< i::FixedArrayEmbedderDataFor (Context *context, int index, bool can_grow, const char *location)
 
static void InitializeTemplate (i::Handle< i::TemplateInfo > that, int type)
 
static void TemplateSet (i::Isolate *isolate, v8::Template *templ, int length, v8::Handle< v8::Data > *data)
 
static void InitializeFunctionTemplate (i::Handle< i::FunctionTemplateInfo > info)
 
static Local< FunctionTemplateFunctionTemplateNew (i::Isolate *isolate, FunctionCallback callback, v8::Handle< Value > data, v8::Handle< Signature > signature, int length, bool do_not_cache)
 
template<typename Operation >
static Local< Operation > NewDescriptor (Isolate *isolate, const i::DeclaredAccessorDescriptorData &data, Data *previous_descriptor)
 
template<typename T >
static Local< DeclaredAccessorDescriptorNewBitmaskCompare (Isolate *isolate, T bitmask, T compare_value, RawOperationDescriptor *operation)
 
static i::Handle< i::AccessorInfoSetAccessorInfoProperties (i::Handle< i::AccessorInfo > obj, v8::Handle< Name > name, v8::AccessControl settings, v8::PropertyAttribute attributes, v8::Handle< AccessorSignature > signature)
 
template<typename Getter , typename Setter >
static i::Handle< i::AccessorInfoMakeAccessorInfo (v8::Handle< Name > name, Getter getter, Setter setter, v8::Handle< Value > data, v8::AccessControl settings, v8::PropertyAttribute attributes, v8::Handle< AccessorSignature > signature)
 
static i::Handle< i::AccessorInfoMakeAccessorInfo (v8::Handle< Name > name, v8::Handle< v8::DeclaredAccessorDescriptor > descriptor, void *setter_ignored, void *data_ignored, v8::AccessControl settings, v8::PropertyAttribute attributes, v8::Handle< AccessorSignature > signature)
 
static i::Handle< i::FunctionTemplateInfoEnsureConstructor (i::Isolate *isolate, ObjectTemplate *object_template)
 
static void AddPropertyToTemplate (i::Handle< i::TemplateInfo > info, i::Handle< i::AccessorInfo > obj)
 
static i::Handle< i::TemplateInfoGetTemplateInfo (i::Isolate *isolate, Template *template_obj)
 
static i::Handle< i::TemplateInfoGetTemplateInfo (i::Isolate *isolate, ObjectTemplate *object_template)
 
template<typename Getter , typename Setter , typename Data , typename Template >
static bool TemplateSetAccessor (Template *template_obj, v8::Local< Name > name, Getter getter, Setter setter, Data data, AccessControl settings, PropertyAttribute attribute, v8::Local< AccessorSignature > signature)
 
static MUST_USE_RESULT i::MaybeHandle< i::ObjectCallV8HeapFunction (const char *name, i::Handle< i::Object > recv, int argc, i::Handle< i::Object > argv[])
 
static MUST_USE_RESULT i::MaybeHandle< i::ObjectCallV8HeapFunction (const char *name, i::Handle< i::Object > data)
 
static int getIntProperty (const StackFrame *f, const char *propertyName, int defaultValue)
 
static Local< StringgetStringProperty (const StackFrame *f, const char *propertyName)
 
static bool getBoolProperty (const StackFrame *f, const char *propertyName)
 
static bool CheckConstructor (i::Isolate *isolate, i::Handle< i::JSObject > obj, const char *class_name)
 
template<typename Getter , typename Setter , typename Data >
static bool ObjectSetAccessor (Object *obj, Handle< Name > name, Getter getter, Setter setter, Data data, AccessControl settings, PropertyAttribute attributes)
 
static Local< ValueGetPropertyByLookup (i::LookupIterator *it)
 
static bool Unaligned (const uint16_t *chars)
 
static const uint16_t * Align (const uint16_t *chars)
 
static int Utf8Length (i::String *str, i::Isolate *isolate)
 
static bool RecursivelySerializeToUtf8 (i::String *current, Utf8WriterVisitor *writer, int recursion_budget)
 
template<typename CharType >
static int WriteHelper (const String *string, CharType *buffer, int start, int length, int options)
 
static bool InternalFieldOK (i::Handle< i::JSObject > obj, int index, const char *location)
 
static void * ExternalValue (i::Object *obj)
 
static i::Handle< i::ContextCreateEnvironment (i::Isolate *isolate, v8::ExtensionConfiguration *extensions, v8::Handle< ObjectTemplate > global_template, v8::Handle< Value > maybe_global_proxy)
 
static i::MaybeHandle< i::StringNewExternalStringHandle (i::Isolate *isolate, v8::String::ExternalStringResource *resource)
 
static i::MaybeHandle< i::StringNewExternalOneByteStringHandle (i::Isolate *isolate, v8::String::ExternalOneByteStringResource *resource)
 
static i::Handle< i::StringRegExpFlagsToString (RegExp::Flags flags)
 
 REGEXP_FLAG_ASSERT_EQ (kNone, NONE)
 
 REGEXP_FLAG_ASSERT_EQ (kGlobal, GLOBAL)
 
 REGEXP_FLAG_ASSERT_EQ (kIgnoreCase, IGNORE_CASE)
 
 REGEXP_FLAG_ASSERT_EQ (kMultiline, MULTILINE)
 
static void SetupArrayBufferView (i::Isolate *isolate, i::Handle< i::JSArrayBufferView > obj, i::Handle< i::JSArrayBuffer > buffer, size_t byte_offset, size_t byte_length)
 
template<typename ElementType , ExternalArrayType array_type, i::ElementsKind elements_kind>
i::Handle< i::JSTypedArrayNewTypedArray (i::Isolate *isolate, Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
 
static i::Handle< i::SymbolSymbolFor (i::Isolate *isolate, i::Handle< i::String > name, i::Handle< i::String > part)
 
static Local< SymbolGetWellKnownSymbol (Isolate *isolate, const char *name)
 
static i::HeapGraphEdge * ToInternal (const HeapGraphEdge *edge)
 
static i::HeapEntry * ToInternal (const HeapGraphNode *entry)
 
static i::HeapSnapshotToInternal (const HeapSnapshot *snapshot)
 
static void SetFlagsFromString (const char *flags)
 
template<typename T >
T ToCData (v8::internal::Object *obj)
 
template<typename T >
v8::internal::Handle< v8::internal::ObjectFromCData (v8::internal::Isolate *isolate, T obj)
 
template<class T >
TToApi (v8::internal::Handle< v8::internal::Object > obj)
 
template<class T >
v8::Local< TToApiHandle (v8::internal::Handle< v8::internal::Object > obj)
 
void PrintPrompt (bool is_running)
 
void HandleDebugEvent (const Debug::EventDetails &event_details)
 
static int LengthWithoutIncompleteUtf8 (char *buffer, int len)
 
static bool WaitOnFD (int fd, int read_timeout, int total_timeout, const struct timeval &start_time)
 
static bool TimeIsOut (const struct timeval &start_time, const int &total_time)
 
static bool GetTimeouts (const v8::FunctionCallbackInfo< v8::Value > &args, int *read_timeout, int *total_timeout)
 
static void ExecSubprocess (int *exec_error_fds, int *stdout_fds, const ExecArgs &exec_args)
 
static bool ChildLaunchedOK (Isolate *isolate, int *exec_error_fds)
 
static Handle< ValueGetStdout (Isolate *isolate, int child_fd, const struct timeval &start_time, int read_timeout, int total_timeout)
 
static bool WaitForChild (Isolate *isolate, int pid, ZombieProtector &child_waiter, const struct timeval &start_time, int read_timeout, int total_timeout)
 
static bool CheckItsADirectory (Isolate *isolate, char *directory)
 
static bool mkdirp (Isolate *isolate, char *directory, mode_t mask)
 
static Handle< ValueThrow (Isolate *isolate, const char *message)
 
bool operator< (const CounterAndKey &lhs, const CounterAndKey &rhs)
 
static FILE * FOpen (const char *path, const char *mode)
 
static char * ReadChars (Isolate *isolate, const char *name, int *size_out)
 
static void ReadBufferWeakCallback (const v8::WeakCallbackData< ArrayBuffer, DataAndPersistent > &data)
 
static void DumpHeapConstants (i::Isolate *isolate)
 
template<class T >
Maybe< Tmaybe (T t)
 
Handle< PrimitiveUndefined (Isolate *isolate)
 
Handle< PrimitiveNull (Isolate *isolate)
 
Handle< BooleanTrue (Isolate *isolate)
 
Handle< BooleanFalse (Isolate *isolate)
 

Variables

static const uintptr_t kOneByteMask = OneByteMask<sizeof(uintptr_t)>::value
 
static const uintptr_t kAlignmentMask = sizeof(uintptr_t) - 1
 
static const int kReadFD = 0
 
static const int kWriteFD = 1
 
static ReadLineEditor read_line_editor
 
const int MB = 1024 * 1024
 
static const uintptr_t kPersistentContainerNotFound = 0
 

Detailed Description

Debugger support for the V8 JavaScript engine.

The v8 JavaScript engine.

Support for Persistent containers.

Testing support for the V8 JavaScript engine.

Profiler support for the V8 JavaScript engine.

C++11 embedders can use STL containers with UniquePersistent values, but pre-C++11 does not support the required move semantic and hence may want these container classes.

Typedef Documentation

◆ AccessorGetterCallback

typedef void(* v8::AccessorGetterCallback) (Local< String > property, const PropertyCallbackInfo< Value > &info)

Accessor[Getter|Setter] are used as callback functions when setting|getting a particular property.

See Object and ObjectTemplate's method SetAccessor.

Definition at line 2245 of file v8.h.

◆ AccessorNameGetterCallback

typedef void(* v8::AccessorNameGetterCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info)

Definition at line 2248 of file v8.h.

◆ AccessorNameSetterCallback

typedef void(* v8::AccessorNameSetterCallback) (Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)

Definition at line 2257 of file v8.h.

◆ AccessorSetterCallback

typedef void(* v8::AccessorSetterCallback) (Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)

Definition at line 2253 of file v8.h.

◆ AddHistogramSampleCallback

typedef void(* v8::AddHistogramSampleCallback) (void *histogram, int sample)

Definition at line 4149 of file v8.h.

◆ AllowCodeGenerationFromStringsCallback

typedef bool(* v8::AllowCodeGenerationFromStringsCallback) (Local< Context > context)

Callback to check if code generation from strings is allowed.

See Context::AllowCodeGenerationFromStrings.

Definition at line 4192 of file v8.h.

◆ CallCompletedCallback

typedef void(* v8::CallCompletedCallback) ()

Definition at line 4176 of file v8.h.

◆ CounterLookupCallback

typedef int*(* v8::CounterLookupCallback) (const char *name)

Definition at line 4142 of file v8.h.

◆ CreateHistogramCallback

typedef void*(* v8::CreateHistogramCallback) (const char *name, int min, int max, size_t buckets)

Definition at line 4144 of file v8.h.

◆ EntropySource

typedef bool(* v8::EntropySource) (unsigned char *buffer, size_t length)

EntropySource is used as a callback function when v8 needs a source of entropy.

Definition at line 4920 of file v8.h.

◆ FailedAccessCheckCallback

typedef void(* v8::FailedAccessCheckCallback) (Local< Object > target, AccessType type, Local< Value > data)

Definition at line 4182 of file v8.h.

◆ FatalErrorCallback

typedef void(* v8::FatalErrorCallback) (const char *location, const char *message)

Definition at line 4117 of file v8.h.

◆ FunctionCallback

typedef void(* v8::FunctionCallback) (const FunctionCallbackInfo< Value > &info)

Definition at line 2717 of file v8.h.

◆ FunctionEntryHook

typedef void(* v8::FunctionEntryHook) (uintptr_t function, uintptr_t return_addr_location)

FunctionEntryHook is the type of the profile entry hook called at entry to any generated function when function-level profiling is enabled.

Parameters
functionthe address of the function that's being entered.
return_addr_locationpoints to a location on stack where the machine return address resides. This can be used to identify the caller of function, and/or modified to divert execution when function exits.
Note
the entry hook must not cause garbage collection.

Definition at line 4263 of file v8.h.

◆ GCEpilogueCallback

typedef void(* v8::GCEpilogueCallback) (GCType type, GCCallbackFlags flags)

Definition at line 4217 of file v8.h.

◆ GCPrologueCallback

typedef void(* v8::GCPrologueCallback) (GCType type, GCCallbackFlags flags)

Definition at line 4216 of file v8.h.

◆ IndexedPropertyDeleterCallback

typedef void(* v8::IndexedPropertyDeleterCallback) (uint32_t index, const PropertyCallbackInfo< Boolean > &info)

Returns a non-empty handle if the deleter intercepts the request.

The return value is true if the property could be deleted and false otherwise.

Definition at line 3503 of file v8.h.

◆ IndexedPropertyEnumeratorCallback

typedef void(* v8::IndexedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)

Returns an array containing the indices of the properties the indexed property getter intercepts.

Definition at line 3512 of file v8.h.

◆ IndexedPropertyGetterCallback

typedef void(* v8::IndexedPropertyGetterCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info)

Returns the value of the property if the getter intercepts the request.

Otherwise, returns an empty handle.

Definition at line 3474 of file v8.h.

◆ IndexedPropertyQueryCallback

typedef void(* v8::IndexedPropertyQueryCallback) (uint32_t index, const PropertyCallbackInfo< Integer > &info)

Returns a non-empty handle if the interceptor intercepts the request.

The result is an integer encoding property attributes.

Definition at line 3493 of file v8.h.

◆ IndexedPropertySetterCallback

typedef void(* v8::IndexedPropertySetterCallback) (uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)

Returns the value if the setter intercepts the request.

Otherwise, returns an empty handle.

Definition at line 3483 of file v8.h.

◆ IndexedSecurityCallback

typedef bool(* v8::IndexedSecurityCallback) (Local< Object > host, uint32_t index, AccessType type, Local< Value > data)

Returns true if cross-context access should be allowed to the indexed property with the given index on the host object.

Definition at line 3542 of file v8.h.

◆ InterruptCallback

typedef void(* v8::InterruptCallback) (Isolate *isolate, void *data)

Definition at line 4219 of file v8.h.

◆ JitCodeEventHandler

typedef void(* v8::JitCodeEventHandler) (const JitCodeEvent *event)

Callback function passed to SetJitCodeEventHandler.

Parameters
eventcode add, move or removal event.

Definition at line 4345 of file v8.h.

◆ LogEventCallback

typedef void(* v8::LogEventCallback) (const char *name, int event)

Definition at line 4124 of file v8.h.

◆ MemoryAllocationCallback

typedef void(* v8::MemoryAllocationCallback) (ObjectSpace space, AllocationAction action, int size)

Definition at line 4171 of file v8.h.

◆ MessageCallback

typedef void(* v8::MessageCallback) (Handle< Message > message, Handle< Value > error)

Definition at line 4120 of file v8.h.

◆ MicrotaskCallback

typedef void(* v8::MicrotaskCallback) (void *data)

Definition at line 4179 of file v8.h.

◆ NamedPropertyDeleterCallback

typedef void(* v8::NamedPropertyDeleterCallback) (Local< String > property, const PropertyCallbackInfo< Boolean > &info)

Returns a non-empty handle if the deleter intercepts the request.

The return value is true if the property could be deleted and false otherwise.

Definition at line 3457 of file v8.h.

◆ NamedPropertyEnumeratorCallback

typedef void(* v8::NamedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)

Returns an array containing the names of the properties the named property getter intercepts.

Definition at line 3466 of file v8.h.

◆ NamedPropertyGetterCallback

typedef void(* v8::NamedPropertyGetterCallback) (Local< String > property, const PropertyCallbackInfo< Value > &info)

NamedProperty[Getter|Setter] are used as interceptors on object.

See ObjectTemplate::SetNamedPropertyHandler.

Definition at line 3427 of file v8.h.

◆ NamedPropertyQueryCallback

typedef void(* v8::NamedPropertyQueryCallback) (Local< String > property, const PropertyCallbackInfo< Integer > &info)

Returns a non-empty handle if the interceptor intercepts the request.

The result is an integer encoding property attributes (like v8::None, v8::DontEnum, etc.)

Definition at line 3447 of file v8.h.

◆ NamedPropertySetterCallback

typedef void(* v8::NamedPropertySetterCallback) (Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)

Returns the value if the setter intercepts the request.

Otherwise, returns an empty handle.

Definition at line 3436 of file v8.h.

◆ NamedSecurityCallback

typedef bool(* v8::NamedSecurityCallback) (Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)

Returns true if cross-context access should be allowed to the named property with the given key on the host object.

Definition at line 3532 of file v8.h.

◆ PersistentContainerValue

Definition at line 21 of file v8-util.h.

◆ ReturnAddressLocationResolver

typedef uintptr_t(* v8::ReturnAddressLocationResolver) (uintptr_t return_addr_location)

ReturnAddressLocationResolver is used as a callback function when v8 is resolving the location of a return address on the stack.

Profilers that change the return address on the stack can use this to resolve the stack location to whereever the profiler stashed the original return address.

Parameters
return_addr_locationpoints to a location on stack where a machine return address resides.
Returns
either return_addr_location, or else a pointer to the profiler's copy of the original return address.
Note
the resolver function must not cause garbage collection.

Definition at line 4936 of file v8.h.

◆ SnapshotObjectId

Definition at line 18 of file v8-profiler.h.

Enumeration Type Documentation

◆ AccessControl

Access control specifications.

Some accessors should be accessible across contexts. These accessors have an explicit access control parameter which specifies the kind of cross-context access that should be allowed.

TODO(dcarney): Remove PROHIBITS_OVERWRITING as it is now unused.

Enumerator
DEFAULT 
ALL_CAN_READ 
ALL_CAN_WRITE 
PROHIBITS_OVERWRITING 

Definition at line 2272 of file v8.h.

2272  {
2273  DEFAULT = 0,
2274  ALL_CAN_READ = 1,
2275  ALL_CAN_WRITE = 1 << 1,
2276  PROHIBITS_OVERWRITING = 1 << 2
2277 };
@ PROHIBITS_OVERWRITING
Definition: v8.h:2276
@ ALL_CAN_WRITE
Definition: v8.h:2275
@ ALL_CAN_READ
Definition: v8.h:2274
@ DEFAULT
Definition: v8.h:2273

◆ AccessType

Access type specification.

Enumerator
ACCESS_GET 
ACCESS_SET 
ACCESS_HAS 
ACCESS_DELETE 
ACCESS_KEYS 

Definition at line 3519 of file v8.h.

3519  {
3520  ACCESS_GET,
3521  ACCESS_SET,
3522  ACCESS_HAS,
3523  ACCESS_DELETE,
3524  ACCESS_KEYS
3525 };
@ ACCESS_SET
Definition: v8.h:3521
@ ACCESS_HAS
Definition: v8.h:3522
@ ACCESS_KEYS
Definition: v8.h:3524
@ ACCESS_GET
Definition: v8.h:3520
@ ACCESS_DELETE
Definition: v8.h:3523

◆ AllocationAction

Enumerator
kAllocationActionAllocate 
kAllocationActionFree 
kAllocationActionAll 

Definition at line 4165 of file v8.h.

4165  {
4166  kAllocationActionAllocate = 1 << 0,
4167  kAllocationActionFree = 1 << 1,
4169  };
@ kAllocationActionAllocate
Definition: v8.h:4166
@ kAllocationActionAll
Definition: v8.h:4168
@ kAllocationActionFree
Definition: v8.h:4167

◆ CompressedStartupDataItems

Enumerator
kSnapshot 
kSnapshotContext 
kLibraries 
kExperimentalLibraries 
kCompressedStartupDataCount 

Definition at line 255 of file api.cc.

255  {
256  kSnapshot = 0,
258  kLibraries,
261 };
@ kLibraries
Definition: api.cc:258
@ kSnapshotContext
Definition: api.cc:257
@ kExperimentalLibraries
Definition: api.cc:259
@ kCompressedStartupDataCount
Definition: api.cc:260
@ kSnapshot
Definition: api.cc:256

◆ DebugEvent

Enumerator
Break 
Exception 
NewFunction 
BeforeCompile 
AfterCompile 
CompileError 
PromiseEvent 
AsyncTaskEvent 
BreakForCommand 

Definition at line 16 of file v8-debug.h.

16  {
17  Break = 1,
18  Exception = 2,
19  NewFunction = 3,
20  BeforeCompile = 4,
21  AfterCompile = 5,
22  CompileError = 6,
23  PromiseEvent = 7,
24  AsyncTaskEvent = 8,
25  BreakForCommand = 9
26 };
@ PromiseEvent
Definition: v8-debug.h:23
@ BeforeCompile
Definition: v8-debug.h:20
@ AfterCompile
Definition: v8-debug.h:21
@ Exception
Definition: v8-debug.h:18
@ BreakForCommand
Definition: v8-debug.h:25
@ AsyncTaskEvent
Definition: v8-debug.h:24
@ CompileError
Definition: v8-debug.h:22
@ Break
Definition: v8-debug.h:17
@ NewFunction
Definition: v8-debug.h:19

◆ DeclaredAccessorDescriptorDataType

Enumerator
kDescriptorBoolType 
kDescriptorInt8Type 
kDescriptorUint8Type 
kDescriptorInt16Type 
kDescriptorUint16Type 
kDescriptorInt32Type 
kDescriptorUint32Type 
kDescriptorFloatType 
kDescriptorDoubleType 

Definition at line 3937 of file v8.h.

3937  {
3943 };
@ kDescriptorInt8Type
Definition: v8.h:3939
@ kDescriptorUint16Type
Definition: v8.h:3940
@ kDescriptorDoubleType
Definition: v8.h:3942
@ kDescriptorFloatType
Definition: v8.h:3942
@ kDescriptorInt16Type
Definition: v8.h:3940
@ kDescriptorUint8Type
Definition: v8.h:3939
@ kDescriptorUint32Type
Definition: v8.h:3941
@ kDescriptorInt32Type
Definition: v8.h:3941
@ kDescriptorBoolType
Definition: v8.h:3938

◆ ExternalArrayType

Enumerator
kExternalInt8Array 
kExternalUint8Array 
kExternalInt16Array 
kExternalUint16Array 
kExternalInt32Array 
kExternalUint32Array 
kExternalFloat32Array 
kExternalFloat64Array 
kExternalUint8ClampedArray 
kExternalByteArray 
kExternalUnsignedByteArray 
kExternalShortArray 
kExternalUnsignedShortArray 
kExternalIntArray 
kExternalUnsignedIntArray 
kExternalFloatArray 
kExternalDoubleArray 
kExternalPixelArray 

Definition at line 2217 of file v8.h.

2217  {
2218  kExternalInt8Array = 1,
2227 
2228  // Legacy constant names
2238 };
@ kExternalFloat32Array
Definition: v8.h:2224
@ kExternalIntArray
Definition: v8.h:2233
@ kExternalUnsignedByteArray
Definition: v8.h:2230
@ kExternalInt32Array
Definition: v8.h:2222
@ kExternalUint32Array
Definition: v8.h:2223
@ kExternalUint16Array
Definition: v8.h:2221
@ kExternalPixelArray
Definition: v8.h:2237
@ kExternalShortArray
Definition: v8.h:2231
@ kExternalFloatArray
Definition: v8.h:2235
@ kExternalInt8Array
Definition: v8.h:2218
@ kExternalUint8Array
Definition: v8.h:2219
@ kExternalInt16Array
Definition: v8.h:2220
@ kExternalDoubleArray
Definition: v8.h:2236
@ kExternalUnsignedIntArray
Definition: v8.h:2234
@ kExternalUint8ClampedArray
Definition: v8.h:2226
@ kExternalUnsignedShortArray
Definition: v8.h:2232
@ kExternalFloat64Array
Definition: v8.h:2225
@ kExternalByteArray
Definition: v8.h:2229

◆ GCCallbackFlags

Enumerator
kNoGCCallbackFlags 
kGCCallbackFlagCompacted 
kGCCallbackFlagConstructRetainedObjectInfos 
kGCCallbackFlagForced 

Definition at line 4209 of file v8.h.

4209  {
4210  kNoGCCallbackFlags = 0,
4211  kGCCallbackFlagCompacted = 1 << 0,
4213  kGCCallbackFlagForced = 1 << 2
4214 };
@ kGCCallbackFlagConstructRetainedObjectInfos
Definition: v8.h:4212
@ kGCCallbackFlagForced
Definition: v8.h:4213
@ kNoGCCallbackFlags
Definition: v8.h:4210
@ kGCCallbackFlagCompacted
Definition: v8.h:4211

◆ GCType

enum v8::GCType

Applications can register callback functions which will be called before and after a garbage collection.

Allocations are not allowed in the callback functions, you therefore cannot manipulate objects (set or delete properties for example) since it is possible such operations will result in the allocation of objects.

Enumerator
kGCTypeScavenge 
kGCTypeMarkSweepCompact 
kGCTypeAll 

Definition at line 4203 of file v8.h.

4203  {
4204  kGCTypeScavenge = 1 << 0,
4205  kGCTypeMarkSweepCompact = 1 << 1,
4207 };
@ kGCTypeScavenge
Definition: v8.h:4204
@ kGCTypeMarkSweepCompact
Definition: v8.h:4205
@ kGCTypeAll
Definition: v8.h:4206

◆ JitCodeEventOptions

Option flags passed to the SetJitCodeEventHandler function.

Enumerator
kJitCodeEventDefault 
kJitCodeEventEnumExisting 

Definition at line 4333 of file v8.h.

4333  {
4335  // Generate callbacks for already existent code.
4337 };
@ kJitCodeEventEnumExisting
Definition: v8.h:4336
@ kJitCodeEventDefault
Definition: v8.h:4334

◆ ObjectSpace

Enumerator
kObjectSpaceNewSpace 
kObjectSpaceOldPointerSpace 
kObjectSpaceOldDataSpace 
kObjectSpaceCodeSpace 
kObjectSpaceMapSpace 
kObjectSpaceLoSpace 
kObjectSpaceAll 

Definition at line 4152 of file v8.h.

4152  {
4153  kObjectSpaceNewSpace = 1 << 0,
4154  kObjectSpaceOldPointerSpace = 1 << 1,
4155  kObjectSpaceOldDataSpace = 1 << 2,
4156  kObjectSpaceCodeSpace = 1 << 3,
4157  kObjectSpaceMapSpace = 1 << 4,
4158  kObjectSpaceLoSpace = 1 << 5,
4159 
4163  };
@ kObjectSpaceAll
Definition: v8.h:4160
@ kObjectSpaceMapSpace
Definition: v8.h:4157
@ kObjectSpaceNewSpace
Definition: v8.h:4153
@ kObjectSpaceOldDataSpace
Definition: v8.h:4155
@ kObjectSpaceOldPointerSpace
Definition: v8.h:4154
@ kObjectSpaceLoSpace
Definition: v8.h:4158
@ kObjectSpaceCodeSpace
Definition: v8.h:4156

◆ PersistentContainerCallbackType

Enumerator
kNotWeak 
kWeak 

Definition at line 23 of file v8-util.h.

23  {
24  kNotWeak,
25  kWeak
26 };
@ kWeak
Definition: v8-util.h:25
@ kNotWeak
Definition: v8-util.h:24

◆ PropertyAttribute

Enumerator
None 
ReadOnly 
DontEnum 
DontDelete 

Definition at line 2210 of file v8.h.

2210  {
2211  None = 0,
2212  ReadOnly = 1 << 0,
2213  DontEnum = 1 << 1,
2214  DontDelete = 1 << 2
2215 };
@ DontEnum
Definition: v8.h:2213
@ None
Definition: v8.h:2211
@ DontDelete
Definition: v8.h:2214
@ ReadOnly
Definition: v8.h:2212

Function Documentation

◆ AddPropertyToTemplate()

static void v8::AddPropertyToTemplate ( i::Handle< i::TemplateInfo info,
i::Handle< i::AccessorInfo obj 
)
inlinestatic

Definition at line 1285 of file api.cc.

1287  {
1288  i::Isolate* isolate = info->GetIsolate();
1289  i::Handle<i::Object> list(info->property_accessors(), isolate);
1290  if (list->IsUndefined()) {
1291  list = NeanderArray(isolate).value();
1292  info->set_property_accessors(*list);
1293  }
1294  NeanderArray array(list);
1295  array.add(obj);
1296 }

References v8::NeanderArray::add(), and v8::NeanderArray::value().

Referenced by TemplateSetAccessor().

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

◆ Align()

static const uint16_t* v8::Align ( const uint16_t *  chars)
inlinestatic

Definition at line 4266 of file api.cc.

4266  {
4267  return reinterpret_cast<uint16_t*>(
4268  reinterpret_cast<uintptr_t>(chars) & ~kAlignmentMask);
4269 }
unsigned short uint16_t
Definition: unicode.cc:23
static const uintptr_t kAlignmentMask
Definition: api.cc:4260

References kAlignmentMask.

Referenced by v8::ContainsOnlyOneByteHelper::VisitTwoByteString().

+ Here is the caller graph for this function:

◆ CallV8HeapFunction() [1/2]

static MUST_USE_RESULT i::MaybeHandle<i::Object> v8::CallV8HeapFunction ( const char *  name,
i::Handle< i::Object data 
)
static

Definition at line 2126 of file api.cc.

2128  {
2129  i::Handle<i::Object> argv[] = { data };
2130  return CallV8HeapFunction(name,
2131  i::Isolate::Current()->js_builtins_object(),
2132  arraysize(argv),
2133  argv);
2134 }
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 arraysize(array)
Definition: macros.h:86
static MUST_USE_RESULT i::MaybeHandle< i::Object > CallV8HeapFunction(const char *name, i::Handle< i::Object > data)
Definition: api.cc:2126

References arraysize, CallV8HeapFunction(), and name.

+ Here is the call graph for this function:

◆ CallV8HeapFunction() [2/2]

static MUST_USE_RESULT i::MaybeHandle<i::Object> v8::CallV8HeapFunction ( const char *  name,
i::Handle< i::Object recv,
int  argc,
i::Handle< i::Object argv[] 
)
static

Definition at line 2112 of file api.cc.

2116  {
2117  i::Isolate* isolate = i::Isolate::Current();
2118  i::Handle<i::Object> object_fun =
2120  isolate, isolate->js_builtins_object(), name).ToHandleChecked();
2122  return i::Execution::Call(isolate, fun, recv, argc, argv);
2123 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
Handle< JSBuiltinsObject > js_builtins_object()
Definition: isolate.h:679
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
Definition: objects.cc:109

References v8::internal::Handle< T >::cast(), v8::internal::Object::GetProperty(), v8::internal::Isolate::js_builtins_object(), and name.

Referenced by CallV8HeapFunction(), v8::Value::Equals(), v8::Message::GetEndColumn(), v8::Message::GetLineNumber(), v8::Object::GetOwnPropertyDescriptor(), v8::Message::GetSourceLine(), and v8::Message::GetStartColumn().

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

◆ CheckConstructor()

static bool v8::CheckConstructor ( i::Isolate isolate,
i::Handle< i::JSObject obj,
const char *  class_name 
)
static

Definition at line 2534 of file api.cc.

2536  {
2537  i::Handle<i::Object> constr(obj->map()->constructor(), isolate);
2538  if (!constr->IsJSFunction()) return false;
2540  return func->shared()->native() && constr.is_identical_to(
2541  i::Object::GetProperty(isolate,
2542  isolate->js_builtins_object(),
2543  class_name).ToHandleChecked());
2544 }

References v8::internal::Handle< T >::cast(), v8::internal::Object::GetProperty(), and v8::internal::Isolate::js_builtins_object().

Referenced by v8::Value::IsNativeError().

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

◆ CheckItsADirectory()

static bool v8::CheckItsADirectory ( Isolate isolate,
char *  directory 
)
static

Definition at line 574 of file d8-posix.cc.

574  {
575  struct stat stat_buf;
576  int stat_result = stat(directory, &stat_buf);
577  if (stat_result != 0) {
578  isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
579  return false;
580  }
581  if ((stat_buf.st_mode & S_IFDIR) != 0) return true;
582  isolate->ThrowException(String::NewFromUtf8(isolate, strerror(EEXIST)));
583  return false;
584 }

References v8::String::NewFromUtf8(), and v8::Isolate::ThrowException().

Referenced by mkdirp().

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

◆ ChildLaunchedOK()

static bool v8::ChildLaunchedOK ( Isolate isolate,
int exec_error_fds 
)
static

Definition at line 277 of file d8-posix.cc.

277  {
278  int bytes_read;
279  int err;
280  do {
281  bytes_read = read(exec_error_fds[kReadFD], &err, sizeof(err));
282  } while (bytes_read == -1 && errno == EINTR);
283  if (bytes_read != 0) {
284  isolate->ThrowException(String::NewFromUtf8(isolate, strerror(err)));
285  return false;
286  }
287  return true;
288 }
static const int kReadFD
Definition: d8-posix.cc:247

References kReadFD, v8::String::NewFromUtf8(), and v8::Isolate::ThrowException().

Referenced by v8::Shell::System().

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

◆ CreateEnvironment()

static i::Handle<i::Context> v8::CreateEnvironment ( i::Isolate isolate,
v8::ExtensionConfiguration extensions,
v8::Handle< ObjectTemplate global_template,
v8::Handle< Value maybe_global_proxy 
)
static

Definition at line 5151 of file api.cc.

5155  {
5157 
5158  // Enter V8 via an ENTER_V8 scope.
5159  {
5160  ENTER_V8(isolate);
5161  v8::Handle<ObjectTemplate> proxy_template = global_template;
5162  i::Handle<i::FunctionTemplateInfo> proxy_constructor;
5163  i::Handle<i::FunctionTemplateInfo> global_constructor;
5164 
5165  if (!global_template.IsEmpty()) {
5166  // Make sure that the global_template has a constructor.
5167  global_constructor = EnsureConstructor(isolate, *global_template);
5168 
5169  // Create a fresh template for the global proxy object.
5170  proxy_template = ObjectTemplate::New(
5171  reinterpret_cast<v8::Isolate*>(isolate));
5172  proxy_constructor = EnsureConstructor(isolate, *proxy_template);
5173 
5174  // Set the global template to be the prototype template of
5175  // global proxy template.
5176  proxy_constructor->set_prototype_template(
5177  *Utils::OpenHandle(*global_template));
5178 
5179  // Migrate security handlers from global_template to
5180  // proxy_template. Temporarily removing access check
5181  // information from the global template.
5182  if (!global_constructor->access_check_info()->IsUndefined()) {
5183  proxy_constructor->set_access_check_info(
5184  global_constructor->access_check_info());
5185  proxy_constructor->set_needs_access_check(
5186  global_constructor->needs_access_check());
5187  global_constructor->set_needs_access_check(false);
5188  global_constructor->set_access_check_info(
5189  isolate->heap()->undefined_value());
5190  }
5191  }
5192 
5193  i::Handle<i::Object> proxy = Utils::OpenHandle(*maybe_global_proxy, true);
5195  if (!proxy.is_null()) {
5196  maybe_proxy = i::Handle<i::JSGlobalProxy>::cast(proxy);
5197  }
5198  // Create the environment.
5199  env = isolate->bootstrapper()->CreateEnvironment(
5200  maybe_proxy, proxy_template, extensions);
5201 
5202  // Restore the access check info on the global template.
5203  if (!global_template.IsEmpty()) {
5204  DCHECK(!global_constructor.is_null());
5205  DCHECK(!proxy_constructor.is_null());
5206  global_constructor->set_access_check_info(
5207  proxy_constructor->access_check_info());
5208  global_constructor->set_needs_access_check(
5209  proxy_constructor->needs_access_check());
5210  }
5211  }
5212  // Leave V8.
5213 
5214  return env;
5215 }
#define ENTER_V8(isolate)
Definition: api.cc:54
An object reference managed by the v8 garbage collector.
Definition: v8.h:198
bool IsEmpty() const
Returns true if the handle is empty.
Definition: v8.h:228
Isolate represents an isolated instance of the V8 engine.
Definition: v8.h:4356
bool is_null() const
Definition: handles.h:124
Bootstrapper * bootstrapper()
Definition: isolate.h:856
#define DCHECK(condition)
Definition: logging.h:205
static i::Handle< i::FunctionTemplateInfo > EnsureConstructor(i::Isolate *isolate, ObjectTemplate *object_template)
Definition: api.cc:1268

References v8::internal::Isolate::bootstrapper(), v8::internal::Handle< T >::cast(), DCHECK, EnsureConstructor(), ENTER_V8, v8::internal::Isolate::heap(), v8::internal::Handle< T >::is_null(), v8::Handle< T >::IsEmpty(), v8::ObjectTemplate::New(), and v8::Utils::OpenHandle().

Referenced by v8::Context::New().

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

◆ DecodeSmiToAligned()

static void* v8::DecodeSmiToAligned ( i::Object value,
const char *  location 
)
static

Definition at line 638 of file api.cc.

638  {
639  Utils::ApiCheck(value->IsSmi(), location, "Not a Smi");
640  return reinterpret_cast<void*>(value);
641 }

References v8::Utils::ApiCheck().

Referenced by v8::Context::SlowGetAlignedPointerFromEmbedderData(), and v8::Object::SlowGetAlignedPointerFromInternalField().

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

◆ DumpHeapConstants()

static void v8::DumpHeapConstants ( i::Isolate isolate)
static

Definition at line 1469 of file d8.cc.

1469  {
1470  i::Heap* heap = isolate->heap();
1471 
1472  // Dump the INSTANCE_TYPES table to the console.
1473  printf("# List of known V8 instance types.\n");
1474 #define DUMP_TYPE(T) printf(" %d: \"%s\",\n", i::T, #T);
1475  printf("INSTANCE_TYPES = {\n");
1477  printf("}\n");
1478 #undef DUMP_TYPE
1479 
1480  // Dump the KNOWN_MAP table to the console.
1481  printf("\n# List of known V8 maps.\n");
1482 #define ROOT_LIST_CASE(type, name, camel_name) \
1483  if (n == NULL && o == heap->name()) n = #camel_name;
1484 #define STRUCT_LIST_CASE(upper_name, camel_name, name) \
1485  if (n == NULL && o == heap->name##_map()) n = #camel_name "Map";
1486  i::HeapObjectIterator it(heap->map_space());
1487  printf("KNOWN_MAPS = {\n");
1488  for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
1489  i::Map* m = i::Map::cast(o);
1490  const char* n = NULL;
1491  intptr_t p = reinterpret_cast<intptr_t>(m) & 0xfffff;
1492  int t = m->instance_type();
1495  if (n == NULL) continue;
1496  printf(" 0x%05" V8PRIxPTR ": (%d, \"%s\"),\n", p, t, n);
1497  }
1498  printf("}\n");
1499 #undef STRUCT_LIST_CASE
1500 #undef ROOT_LIST_CASE
1501 
1502  // Dump the KNOWN_OBJECTS table to the console.
1503  printf("\n# List of known V8 objects.\n");
1504 #define ROOT_LIST_CASE(type, name, camel_name) \
1505  if (n == NULL && o == heap->name()) n = #camel_name;
1506  i::OldSpaces spit(heap);
1507  printf("KNOWN_OBJECTS = {\n");
1508  for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) {
1509  i::HeapObjectIterator it(s);
1510  const char* sname = AllocationSpaceName(s->identity());
1511  for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
1512  const char* n = NULL;
1513  intptr_t p = reinterpret_cast<intptr_t>(o) & 0xfffff;
1515  if (n == NULL) continue;
1516  printf(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n);
1517  }
1518  }
1519  printf("}\n");
1520 #undef ROOT_LIST_CASE
1521 }
MapSpace * map_space()
Definition: heap.h:597
InstanceType instance_type()
Definition: objects-inl.h:4323
#define ROOT_LIST_CASE(type, name, camel_name)
#define DUMP_TYPE(T)
#define STRUCT_LIST_CASE(upper_name, camel_name, name)
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 NULL
#define ROOT_LIST(V)
Definition: heap.h:206
#define V8PRIxPTR
Definition: macros.h:363
const char * AllocationSpaceName(AllocationSpace space)
#define INSTANCE_TYPE_LIST(V)
Definition: objects.h:339
#define STRUCT_LIST(V)
Definition: objects.h:515

References v8::internal::AllocationSpaceName(), DUMP_TYPE, v8::internal::Isolate::heap(), v8::internal::Map::instance_type(), INSTANCE_TYPE_LIST, v8::internal::Heap::map_space(), v8::internal::HeapObjectIterator::Next(), NULL, ROOT_LIST, ROOT_LIST_CASE, STRUCT_LIST, STRUCT_LIST_CASE, and V8PRIxPTR.

Referenced by v8::Shell::Main().

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

◆ EmbedderDataFor()

static i::Handle<i::FixedArray> v8::EmbedderDataFor ( Context context,
int  index,
bool  can_grow,
const char *  location 
)
static

Definition at line 651 of file api.cc.

654  {
655  i::Handle<i::Context> env = Utils::OpenHandle(context);
656  bool ok =
657  Utils::ApiCheck(env->IsNativeContext(),
658  location,
659  "Not a native context") &&
660  Utils::ApiCheck(index >= 0, location, "Negative index");
661  if (!ok) return i::Handle<i::FixedArray>();
662  i::Handle<i::FixedArray> data(env->embedder_data());
663  if (index < data->length()) return data;
664  if (!Utils::ApiCheck(can_grow, location, "Index too large")) {
665  return i::Handle<i::FixedArray>();
666  }
667  int new_size = i::Max(index, data->length() << 1) + 1;
668  data = i::FixedArray::CopySize(data, new_size);
669  env->set_embedder_data(*data);
670  return data;
671 }
static Handle< FixedArray > CopySize(Handle< FixedArray > array, int new_length, PretenureFlag pretenure=NOT_TENURED)
Definition: objects.cc:7749
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)

References v8::Utils::ApiCheck(), v8::internal::FixedArray::CopySize(), v8::internal::compiler::Max(), and v8::Utils::OpenHandle().

Referenced by v8::Context::SetAlignedPointerInEmbedderData(), v8::Context::SetEmbedderData(), v8::Context::SlowGetAlignedPointerFromEmbedderData(), and v8::Context::SlowGetEmbedderData().

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

◆ EncodeAlignedAsSmi()

static i::Smi* v8::EncodeAlignedAsSmi ( void *  value,
const char *  location 
)
static

Definition at line 644 of file api.cc.

644  {
645  i::Smi* smi = reinterpret_cast<i::Smi*>(value);
646  Utils::ApiCheck(smi->IsSmi(), location, "Pointer is not aligned");
647  return smi;
648 }

References v8::Utils::ApiCheck().

Referenced by v8::Context::SetAlignedPointerInEmbedderData(), and v8::Object::SetAlignedPointerInInternalField().

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

◆ EnsureConstructor()

static i::Handle<i::FunctionTemplateInfo> v8::EnsureConstructor ( i::Isolate isolate,
ObjectTemplate object_template 
)
static

Definition at line 1268 of file api.cc.

1270  {
1271  i::Object* obj = Utils::OpenHandle(object_template)->constructor();
1272  if (!obj ->IsUndefined()) {
1273  i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj);
1274  return i::Handle<i::FunctionTemplateInfo>(info, isolate);
1275  }
1276  Local<FunctionTemplate> templ =
1277  FunctionTemplate::New(reinterpret_cast<Isolate*>(isolate));
1278  i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ);
1279  constructor->set_instance_template(*Utils::OpenHandle(object_template));
1280  Utils::OpenHandle(object_template)->set_constructor(*constructor);
1281  return constructor;
1282 }

References v8::FunctionTemplate::New(), and v8::Utils::OpenHandle().

Referenced by CreateEnvironment(), GetTemplateInfo(), v8::ObjectTemplate::MarkAsUndetectable(), v8::ObjectTemplate::SetAccessCheckCallbacks(), v8::ObjectTemplate::SetCallAsFunctionHandler(), v8::ObjectTemplate::SetIndexedPropertyHandler(), v8::ObjectTemplate::SetInternalFieldCount(), and v8::ObjectTemplate::SetNamedPropertyHandler().

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

◆ ExecSubprocess()

static void v8::ExecSubprocess ( int exec_error_fds,
int stdout_fds,
const ExecArgs exec_args 
)
static

Definition at line 254 of file d8-posix.cc.

256  {
257  close(exec_error_fds[kReadFD]); // Don't need this in the child.
258  close(stdout_fds[kReadFD]); // Don't need this in the child.
259  close(1); // Close stdout.
260  dup2(stdout_fds[kWriteFD], 1); // Dup pipe fd to stdout.
261  close(stdout_fds[kWriteFD]); // Don't need the original fd now.
262  fcntl(exec_error_fds[kWriteFD], F_SETFD, FD_CLOEXEC);
263  execvp(exec_args.arg0(), exec_args.arg_array());
264  // Only get here if the exec failed. Write errno to the parent to tell
265  // them it went wrong. If it went well the pipe is closed.
266  int err = errno;
267  int bytes_written;
268  do {
269  bytes_written = write(exec_error_fds[kWriteFD], &err, sizeof(err));
270  } while (bytes_written == -1 && errno == EINTR);
271  // Return (and exit child process).
272 }
static const int kWriteFD
Definition: d8-posix.cc:248

References v8::ExecArgs::arg0(), v8::ExecArgs::arg_array(), kReadFD, and kWriteFD.

Referenced by v8::Shell::System().

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

◆ ExternalValue()

static void* v8::ExternalValue ( i::Object obj)
static

Definition at line 5037 of file api.cc.

5037  {
5038  // Obscure semantics for undefined, but somehow checked in our unit tests...
5039  if (obj->IsUndefined()) return NULL;
5040  i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0);
5041  return i::Foreign::cast(foreign)->foreign_address();
5042 }

References NULL.

Referenced by v8::External::Value().

+ Here is the caller graph for this function:

◆ False()

Handle< Boolean > v8::False ( Isolate isolate)
inline

Definition at line 6863 of file v8.h.

6863  {
6864  typedef internal::Object* S;
6865  typedef internal::Internals I;
6866  I::CheckInitialized(isolate);
6867  S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
6868  return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
6869 }
kSerializedDataOffset Object
Definition: objects-inl.h:5322
#define I(name, number_of_args, result_size)
Definition: runtime.cc:9248
#define S(x)
Definition: version.cc:55

Referenced by v8::Boolean::New().

+ Here is the caller graph for this function:

◆ FOpen()

static FILE* v8::FOpen ( const char *  path,
const char *  mode 
)
static

Definition at line 1056 of file d8.cc.

1056  {
1057 #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))
1058  FILE* result;
1059  if (fopen_s(&result, path, mode) == 0) {
1060  return result;
1061  } else {
1062  return NULL;
1063  }
1064 #else
1065  FILE* file = fopen(path, mode);
1066  if (file == NULL) return NULL;
1067  struct stat file_stat;
1068  if (fstat(fileno(file), &file_stat) != 0) return NULL;
1069  bool is_regular_file = ((file_stat.st_mode & S_IFREG) != 0);
1070  if (is_regular_file) return file;
1071  fclose(file);
1072  return NULL;
1073 #endif
1074 }
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
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 only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes A file to write the raw context snapshot bytes Write V8 startup blob file(mksnapshot only)") DEFINE_BOOL(profile_hydrogen_code_stub_compilation

References file(), mode(), and NULL.

Referenced by ReadChars().

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

◆ FromCData()

template<typename T >
v8::internal::Handle<v8::internal::Object> v8::FromCData ( v8::internal::Isolate isolate,
T  obj 
)
inline

Definition at line 104 of file api.h.

105  {
106  STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
107  return isolate->factory()->NewForeign(
108  reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj)));
109 }
Factory * factory()
Definition: isolate.h:982
#define STATIC_ASSERT(test)
Definition: macros.h:311
byte * Address
Definition: globals.h:101
#define T(name, string, precedence)
Definition: token.cc:25

References v8::internal::Isolate::factory(), STATIC_ASSERT, and T.

Referenced by v8::internal::Accessors::MakeAccessor(), and v8::internal::Accessors::MakeModuleExport().

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

◆ FunctionTemplateNew()

static Local<FunctionTemplate> v8::FunctionTemplateNew ( i::Isolate isolate,
FunctionCallback  callback,
v8::Handle< Value data,
v8::Handle< Signature signature,
int  length,
bool  do_not_cache 
)
static

Definition at line 871 of file api.cc.

877  {
878  i::Handle<i::Struct> struct_obj =
879  isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE);
883  obj->set_do_not_cache(do_not_cache);
884  int next_serial_number = 0;
885  if (!do_not_cache) {
886  next_serial_number = isolate->next_serial_number() + 1;
887  isolate->set_next_serial_number(next_serial_number);
888  }
889  obj->set_serial_number(i::Smi::FromInt(next_serial_number));
890  if (callback != 0) {
891  if (data.IsEmpty()) {
892  data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
893  }
894  Utils::ToLocal(obj)->SetCallHandler(callback, data);
895  }
896  obj->set_length(length);
897  obj->set_undetectable(false);
898  obj->set_needs_access_check(false);
899  if (!signature.IsEmpty())
900  obj->set_signature(*Utils::OpenHandle(*signature));
901  return Utils::ToLocal(obj);
902 }
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
@ FUNCTION_TEMPLATE_INFO_TYPE
Definition: objects.h:703
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit do_not_cache
Definition: objects-inl.h:5427
static void InitializeFunctionTemplate(i::Handle< i::FunctionTemplateInfo > info)
Definition: api.cc:843
Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6836

References v8::internal::Handle< T >::cast(), v8::internal::do_not_cache, v8::internal::Isolate::factory(), v8::internal::Smi::FromInt(), v8::internal::FUNCTION_TEMPLATE_INFO_TYPE, InitializeFunctionTemplate(), v8::Handle< T >::IsEmpty(), v8::Utils::OpenHandle(), v8::Utils::ToLocal(), and Undefined().

Referenced by v8::Function::New(), and v8::FunctionTemplate::New().

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

◆ getBoolProperty()

static bool v8::getBoolProperty ( const StackFrame f,
const char *  propertyName 
)
static

Definition at line 2345 of file api.cc.

2345  {
2346  i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
2347  ENTER_V8(isolate);
2348  i::HandleScope scope(isolate);
2349  i::Handle<i::JSObject> self = Utils::OpenHandle(f);
2350  i::Handle<i::Object> obj =
2351  i::Object::GetProperty(isolate, self, propertyName).ToHandleChecked();
2352  return obj->IsTrue();
2353 }

References ENTER_V8, v8::internal::Object::GetProperty(), and v8::Utils::OpenHandle().

Referenced by v8::StackFrame::IsConstructor(), and v8::StackFrame::IsEval().

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

◆ getIntProperty()

static int v8::getIntProperty ( const StackFrame f,
const char *  propertyName,
int  defaultValue 
)
static

Definition at line 2289 of file api.cc.

2290  {
2291  i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
2292  ENTER_V8(isolate);
2293  i::HandleScope scope(isolate);
2294  i::Handle<i::JSObject> self = Utils::OpenHandle(f);
2295  i::Handle<i::Object> obj =
2296  i::Object::GetProperty(isolate, self, propertyName).ToHandleChecked();
2297  return obj->IsSmi() ? i::Smi::cast(*obj)->value() : defaultValue;
2298 }

References ENTER_V8, v8::internal::Object::GetProperty(), and v8::Utils::OpenHandle().

Referenced by v8::StackFrame::GetColumn(), v8::StackFrame::GetLineNumber(), and v8::StackFrame::GetScriptId().

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

◆ GetPropertyByLookup()

static Local<Value> v8::GetPropertyByLookup ( i::LookupIterator *  it)
static

Definition at line 3665 of file api.cc.

3665  {
3666  // If the property being looked up is a callback, it can throw an exception.
3667  EXCEPTION_PREAMBLE(it->isolate());
3668  i::Handle<i::Object> result;
3669  has_pending_exception = !i::Object::GetProperty(it).ToHandle(&result);
3670  EXCEPTION_BAILOUT_CHECK(it->isolate(), Local<Value>());
3671 
3672  if (it->IsFound()) return Utils::ToLocal(result);
3673  return Local<Value>();
3674 }
#define EXCEPTION_BAILOUT_CHECK(isolate, value)
Definition: api.cc:93
#define EXCEPTION_PREAMBLE(isolate)
Definition: api.cc:67

References EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Object::GetProperty(), and v8::Utils::ToLocal().

Referenced by v8::Object::GetRealNamedProperty(), and v8::Object::GetRealNamedPropertyInPrototypeChain().

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

◆ GetStdout()

static Handle<Value> v8::GetStdout ( Isolate isolate,
int  child_fd,
const struct timeval &  start_time,
int  read_timeout,
int  total_timeout 
)
static

Definition at line 293 of file d8-posix.cc.

297  {
298  Handle<String> accumulator = String::Empty(isolate);
299 
300  int fullness = 0;
301  static const int kStdoutReadBufferSize = 4096;
302  char buffer[kStdoutReadBufferSize];
303 
304  if (fcntl(child_fd, F_SETFL, O_NONBLOCK) != 0) {
305  return isolate->ThrowException(
306  String::NewFromUtf8(isolate, strerror(errno)));
307  }
308 
309  int bytes_read;
310  do {
311  bytes_read = read(child_fd,
312  buffer + fullness,
313  kStdoutReadBufferSize - fullness);
314  if (bytes_read == -1) {
315  if (errno == EAGAIN) {
316  if (!WaitOnFD(child_fd,
317  read_timeout,
318  total_timeout,
319  start_time) ||
320  (TimeIsOut(start_time, total_timeout))) {
321  return isolate->ThrowException(
322  String::NewFromUtf8(isolate, "Timed out waiting for output"));
323  }
324  continue;
325  } else if (errno == EINTR) {
326  continue;
327  } else {
328  break;
329  }
330  }
331  if (bytes_read + fullness > 0) {
332  int length = bytes_read == 0 ?
333  bytes_read + fullness :
334  LengthWithoutIncompleteUtf8(buffer, bytes_read + fullness);
335  Handle<String> addition =
336  String::NewFromUtf8(isolate, buffer, String::kNormalString, length);
337  accumulator = String::Concat(accumulator, addition);
338  fullness = bytes_read + fullness - length;
339  memcpy(buffer, buffer + length, fullness);
340  }
341  } while (bytes_read != 0);
342  return accumulator;
343 }
static bool TimeIsOut(const struct timeval &start_time, const int &total_time)
Definition: d8-posix.cc:123
static int LengthWithoutIncompleteUtf8(char *buffer, int len)
Definition: d8-posix.cc:29
static bool WaitOnFD(int fd, int read_timeout, int total_timeout, const struct timeval &start_time)
Definition: d8-posix.cc:82

References v8::String::Concat(), v8::String::Empty(), v8::String::kNormalString, LengthWithoutIncompleteUtf8(), v8::String::NewFromUtf8(), v8::Isolate::ThrowException(), TimeIsOut(), and WaitOnFD().

Referenced by v8::Shell::System().

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

◆ getStringProperty()

static Local<String> v8::getStringProperty ( const StackFrame f,
const char *  propertyName 
)
static

Definition at line 2316 of file api.cc.

2317  {
2318  i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate();
2319  ENTER_V8(isolate);
2320  EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
2321  i::Handle<i::JSObject> self = Utils::OpenHandle(f);
2322  i::Handle<i::Object> obj =
2323  i::Object::GetProperty(isolate, self, propertyName).ToHandleChecked();
2324  return obj->IsString()
2325  ? scope.Escape(Local<String>::Cast(Utils::ToLocal(obj)))
2326  : Local<String>();
2327 }

References ENTER_V8, v8::EscapableHandleScope::Escape(), v8::internal::Object::GetProperty(), v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

Referenced by v8::StackFrame::GetFunctionName(), v8::StackFrame::GetScriptName(), and v8::StackFrame::GetScriptNameOrSourceURL().

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

◆ GetTemplateInfo() [1/2]

static i::Handle<i::TemplateInfo> v8::GetTemplateInfo ( i::Isolate isolate,
ObjectTemplate object_template 
)
inlinestatic

Definition at line 1307 of file api.cc.

1309  {
1310  EnsureConstructor(isolate, object_template);
1311  return Utils::OpenHandle(object_template);
1312 }

References EnsureConstructor(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetTemplateInfo() [2/2]

static i::Handle<i::TemplateInfo> v8::GetTemplateInfo ( i::Isolate isolate,
Template template_obj 
)
inlinestatic

Definition at line 1299 of file api.cc.

1301  {
1302  return Utils::OpenHandle(template_obj);
1303 }

References v8::Utils::OpenHandle().

Referenced by TemplateSetAccessor().

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

◆ GetTimeouts()

static bool v8::GetTimeouts ( const v8::FunctionCallbackInfo< v8::Value > &  args,
int read_timeout,
int total_timeout 
)
static

Definition at line 222 of file d8-posix.cc.

224  {
225  if (args.Length() > 3) {
226  if (args[3]->IsNumber()) {
227  *total_timeout = args[3]->Int32Value();
228  } else {
229  args.GetIsolate()->ThrowException(String::NewFromUtf8(
230  args.GetIsolate(), "system: Argument 4 must be a number"));
231  return false;
232  }
233  }
234  if (args.Length() > 2) {
235  if (args[2]->IsNumber()) {
236  *read_timeout = args[2]->Int32Value();
237  } else {
238  args.GetIsolate()->ThrowException(String::NewFromUtf8(
239  args.GetIsolate(), "system: Argument 3 must be a number"));
240  return false;
241  }
242  }
243  return true;
244 }
Isolate * GetIsolate() const
Definition: v8.h:6342
int Length() const
Definition: v8.h:6360
Local< Value > ThrowException(Local< Value > exception)
Schedules an exception to be thrown when returning to JavaScript.
Definition: api.cc:6411

References v8::FunctionCallbackInfo< T >::GetIsolate(), v8::FunctionCallbackInfo< T >::Length(), v8::String::NewFromUtf8(), and v8::Isolate::ThrowException().

Referenced by v8::Shell::System().

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

◆ GetWellKnownSymbol()

static Local<Symbol> v8::GetWellKnownSymbol ( Isolate isolate,
const char *  name 
)
static

Definition at line 6217 of file api.cc.

6217  {
6218  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6219  i::Handle<i::String> i_name =
6220  Utils::OpenHandle(*String::NewFromUtf8(isolate, name));
6221  i::Handle<i::String> part = i_isolate->factory()->for_intern_string();
6222  return Utils::ToLocal(SymbolFor(i_isolate, i_name, part));
6223 }
static i::Handle< i::Symbol > SymbolFor(i::Isolate *isolate, i::Handle< i::String > name, i::Handle< i::String > part)
Definition: api.cc:6182

References v8::internal::Isolate::factory(), name, v8::String::NewFromUtf8(), v8::Utils::OpenHandle(), SymbolFor(), and v8::Utils::ToLocal().

Referenced by v8::Symbol::GetIterator(), and v8::Symbol::GetUnscopables().

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

◆ HandleDebugEvent()

void v8::HandleDebugEvent ( const Debug::EventDetails event_details)

Definition at line 17 of file d8-debug.cc.

17  {
18  // TODO(svenpanne) There should be a way to retrieve this in the callback.
19  Isolate* isolate = Isolate::GetCurrent();
20  HandleScope scope(isolate);
21 
22  DebugEvent event = event_details.GetEvent();
23  // Check for handled event.
24  if (event != Break && event != Exception && event != AfterCompile) {
25  return;
26  }
27 
28  TryCatch try_catch;
29 
30  // Get the toJSONProtocol function on the event and get the JSON format.
31  Local<String> to_json_fun_name =
32  String::NewFromUtf8(isolate, "toJSONProtocol");
33  Handle<Object> event_data = event_details.GetEventData();
34  Local<Function> to_json_fun =
35  Local<Function>::Cast(event_data->Get(to_json_fun_name));
36  Local<Value> event_json = to_json_fun->Call(event_data, 0, NULL);
37  if (try_catch.HasCaught()) {
38  Shell::ReportException(isolate, &try_catch);
39  return;
40  }
41 
42  // Print the event details.
43  Handle<Object> details =
44  Shell::DebugMessageDetails(isolate, Handle<String>::Cast(event_json));
45  if (try_catch.HasCaught()) {
46  Shell::ReportException(isolate, &try_catch);
47  return;
48  }
49  String::Utf8Value str(details->Get(String::NewFromUtf8(isolate, "text")));
50  if (str.length() == 0) {
51  // Empty string is used to signal not to process this event.
52  return;
53  }
54  printf("%s\n", *str);
55 
56  // Get the debug command processor.
57  Local<String> fun_name =
58  String::NewFromUtf8(isolate, "debugCommandProcessor");
59  Handle<Object> exec_state = event_details.GetExecutionState();
60  Local<Function> fun = Local<Function>::Cast(exec_state->Get(fun_name));
61  Local<Object> cmd_processor =
62  Local<Object>::Cast(fun->Call(exec_state, 0, NULL));
63  if (try_catch.HasCaught()) {
64  Shell::ReportException(isolate, &try_catch);
65  return;
66  }
67 
68  static const int kBufferSize = 256;
69  bool running = false;
70  while (!running) {
71  char command[kBufferSize];
72  PrintPrompt(running);
73  char* str = fgets(command, kBufferSize, stdin);
74  if (str == NULL) break;
75 
76  // Ignore empty commands.
77  if (strlen(command) == 0) continue;
78 
79  TryCatch try_catch;
80 
81  // Convert the debugger command to a JSON debugger request.
82  Handle<Value> request = Shell::DebugCommandToJSONRequest(
83  isolate, String::NewFromUtf8(isolate, command));
84  if (try_catch.HasCaught()) {
85  Shell::ReportException(isolate, &try_catch);
86  continue;
87  }
88 
89  // If undefined is returned the command was handled internally and there is
90  // no JSON to send.
91  if (request->IsUndefined()) {
92  continue;
93  }
94 
95  Handle<String> fun_name;
96  Handle<Function> fun;
97  // All the functions used below take one argument.
98  static const int kArgc = 1;
99  Handle<Value> args[kArgc];
100 
101  // Invoke the JavaScript to convert the debug command line to a JSON
102  // request, invoke the JSON request and convert the JSON respose to a text
103  // representation.
104  fun_name = String::NewFromUtf8(isolate, "processDebugRequest");
105  fun = Handle<Function>::Cast(cmd_processor->Get(fun_name));
106  args[0] = request;
107  Handle<Value> response_val = fun->Call(cmd_processor, kArgc, args);
108  if (try_catch.HasCaught()) {
109  Shell::ReportException(isolate, &try_catch);
110  continue;
111  }
112  Handle<String> response = Handle<String>::Cast(response_val);
113 
114  // Convert the debugger response into text details and the running state.
115  Handle<Object> response_details =
116  Shell::DebugMessageDetails(isolate, response);
117  if (try_catch.HasCaught()) {
118  Shell::ReportException(isolate, &try_catch);
119  continue;
120  }
121  String::Utf8Value text_str(
122  response_details->Get(String::NewFromUtf8(isolate, "text")));
123  if (text_str.length() > 0) {
124  printf("%s\n", *text_str);
125  }
126  running = response_details->Get(String::NewFromUtf8(isolate, "running"))
127  ->ToBoolean()
128  ->Value();
129  }
130 }
static Local< Object > Cast(Local< S > that)
Definition: v8.h:348
DebugEvent
Definition: v8-debug.h:16
void PrintPrompt(bool is_running)
Definition: d8-debug.cc:10

References AfterCompile, Break, v8::Handle< T >::Cast(), v8::Local< T >::Cast(), v8::Shell::DebugCommandToJSONRequest(), v8::Shell::DebugMessageDetails(), v8::Isolate::GetCurrent(), v8::Debug::EventDetails::GetEvent(), v8::Debug::EventDetails::GetEventData(), v8::Debug::EventDetails::GetExecutionState(), v8::TryCatch::HasCaught(), v8::base::anonymous_namespace{semaphore-unittest.cc}::kBufferSize, v8::String::Utf8Value::length(), v8::String::NewFromUtf8(), NULL, PrintPrompt(), and v8::Shell::ReportException().

Referenced by v8::Shell::InstallUtilityScript().

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

◆ InitializeFunctionTemplate()

static void v8::InitializeFunctionTemplate ( i::Handle< i::FunctionTemplateInfo info)
static

Definition at line 843 of file api.cc.

844  {
845  info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE));
846  info->set_flag(0);
847 }

References v8::internal::Smi::FromInt(), and v8::Consts::FUNCTION_TEMPLATE.

Referenced by FunctionTemplateNew().

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

◆ InitializeTemplate()

static void v8::InitializeTemplate ( i::Handle< i::TemplateInfo that,
int  type 
)
static

Definition at line 777 of file api.cc.

777  {
778  that->set_tag(i::Smi::FromInt(type));
779 }

References v8::internal::Smi::FromInt().

Referenced by v8::ObjectTemplate::New().

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

◆ InternalFieldOK()

static bool v8::InternalFieldOK ( i::Handle< i::JSObject obj,
int  index,
const char *  location 
)
static

Definition at line 4992 of file api.cc.

4994  {
4995  return Utils::ApiCheck(index < obj->GetInternalFieldCount(),
4996  location,
4997  "Internal field out of bounds");
4998 }

References v8::Utils::ApiCheck().

Referenced by v8::Object::SetAlignedPointerInInternalField(), v8::Object::SetInternalField(), v8::Object::SlowGetAlignedPointerFromInternalField(), and v8::Object::SlowGetInternalField().

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

◆ IsExecutionTerminatingCheck()

static bool v8::IsExecutionTerminatingCheck ( i::Isolate isolate)
inlinestatic

Definition at line 195 of file api.cc.

195  {
196  if (!isolate->IsInitialized()) return false;
197  if (isolate->has_scheduled_exception()) {
198  return isolate->scheduled_exception() ==
199  isolate->heap()->termination_exception();
200  }
201  return false;
202 }
bool has_scheduled_exception()
Definition: isolate.h:627
Object * scheduled_exception()
Definition: isolate.h:622

References v8::internal::Isolate::has_scheduled_exception(), v8::internal::Isolate::heap(), v8::internal::Isolate::IsInitialized(), and v8::internal::Isolate::scheduled_exception().

Referenced by v8::V8::IsExecutionTerminating().

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

◆ LengthWithoutIncompleteUtf8()

static int v8::LengthWithoutIncompleteUtf8 ( char *  buffer,
int  len 
)
static

Definition at line 29 of file d8-posix.cc.

29  {
30  int answer = len;
31  // 1-byte encoding.
32  static const int kUtf8SingleByteMask = 0x80;
33  static const int kUtf8SingleByteValue = 0x00;
34  // 2-byte encoding.
35  static const int kUtf8TwoByteMask = 0xe0;
36  static const int kUtf8TwoByteValue = 0xc0;
37  // 3-byte encoding.
38  static const int kUtf8ThreeByteMask = 0xf0;
39  static const int kUtf8ThreeByteValue = 0xe0;
40  // 4-byte encoding.
41  static const int kUtf8FourByteMask = 0xf8;
42  static const int kUtf8FourByteValue = 0xf0;
43  // Subsequent bytes of a multi-byte encoding.
44  static const int kMultiByteMask = 0xc0;
45  static const int kMultiByteValue = 0x80;
46  int multi_byte_bytes_seen = 0;
47  while (answer > 0) {
48  int c = buffer[answer - 1];
49  // Ends in valid single-byte sequence?
50  if ((c & kUtf8SingleByteMask) == kUtf8SingleByteValue) return answer;
51  // Ends in one or more subsequent bytes of a multi-byte value?
52  if ((c & kMultiByteMask) == kMultiByteValue) {
53  multi_byte_bytes_seen++;
54  answer--;
55  } else {
56  if ((c & kUtf8TwoByteMask) == kUtf8TwoByteValue) {
57  if (multi_byte_bytes_seen >= 1) {
58  return answer + 2;
59  }
60  return answer - 1;
61  } else if ((c & kUtf8ThreeByteMask) == kUtf8ThreeByteValue) {
62  if (multi_byte_bytes_seen >= 2) {
63  return answer + 3;
64  }
65  return answer - 1;
66  } else if ((c & kUtf8FourByteMask) == kUtf8FourByteValue) {
67  if (multi_byte_bytes_seen >= 3) {
68  return answer + 4;
69  }
70  return answer - 1;
71  } else {
72  return answer; // Malformed UTF-8.
73  }
74  }
75  }
76  return 0;
77 }

Referenced by GetStdout().

+ Here is the caller graph for this function:

◆ MakeAccessorInfo() [1/2]

template<typename Getter , typename Setter >
static i::Handle<i::AccessorInfo> v8::MakeAccessorInfo ( v8::Handle< Name name,
Getter  getter,
Setter  setter,
v8::Handle< Value data,
v8::AccessControl  settings,
v8::PropertyAttribute  attributes,
v8::Handle< AccessorSignature signature 
)
static

Definition at line 1143 of file api.cc.

1150  {
1151  i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate();
1153  isolate->factory()->NewExecutableAccessorInfo();
1154  SET_FIELD_WRAPPED(obj, set_getter, getter);
1155  SET_FIELD_WRAPPED(obj, set_setter, setter);
1156  if (data.IsEmpty()) {
1157  data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1158  }
1159  obj->set_data(*Utils::OpenHandle(*data));
1160  return SetAccessorInfoProperties(obj, name, settings, attributes, signature);
1161 }
#define SET_FIELD_WRAPPED(obj, setter, cdata)
Definition: api.cc:1101
static i::Handle< i::AccessorInfo > SetAccessorInfoProperties(i::Handle< i::AccessorInfo > obj, v8::Handle< Name > name, v8::AccessControl settings, v8::PropertyAttribute attributes, v8::Handle< AccessorSignature > signature)
Definition: api.cc:1125

References v8::internal::Isolate::factory(), v8::Handle< T >::IsEmpty(), name, v8::Utils::OpenHandle(), SET_FIELD_WRAPPED, SetAccessorInfoProperties(), and Undefined().

Referenced by ObjectSetAccessor(), and TemplateSetAccessor().

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

◆ MakeAccessorInfo() [2/2]

static i::Handle<i::AccessorInfo> v8::MakeAccessorInfo ( v8::Handle< Name name,
v8::Handle< v8::DeclaredAccessorDescriptor descriptor,
void *  setter_ignored,
void *  data_ignored,
v8::AccessControl  settings,
v8::PropertyAttribute  attributes,
v8::Handle< AccessorSignature signature 
)
static

Definition at line 1164 of file api.cc.

1171  {
1172  i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate();
1173  if (descriptor.IsEmpty()) return i::Handle<i::DeclaredAccessorInfo>();
1175  isolate->factory()->NewDeclaredAccessorInfo();
1176  obj->set_descriptor(*Utils::OpenHandle(*descriptor));
1177  return SetAccessorInfoProperties(obj, name, settings, attributes, signature);
1178 }

References v8::internal::Isolate::factory(), v8::Handle< T >::IsEmpty(), name, v8::Utils::OpenHandle(), and SetAccessorInfoProperties().

+ Here is the call graph for this function:

◆ maybe()

template<class T >
Maybe<T> v8::maybe ( T  t)
inline

Definition at line 902 of file v8.h.

902  {
903  return Maybe<T>(t);
904 }

Referenced by v8::internal::JSObject::AddProperty(), v8::internal::DeclareGlobals(), v8::internal::JSObject::DefineAccessor(), v8::internal::JSObject::DeleteElement(), v8::internal::MemoryChunk::FromAnyPointerAddress(), v8::internal::JSObject::GetElementAttributeWithInterceptor(), v8::internal::JSObject::GetElementAttributeWithoutInterceptor(), v8::internal::JSObject::GetElementAttributeWithReceiver(), v8::internal::GetOldValue(), v8::internal::GetOwnProperty(), v8::internal::JSReceiver::GetPropertyAttributes(), v8::internal::JSObject::GetPropertyAttributesWithFailedAccessCheck(), v8::internal::JSProxy::GetPropertyAttributesWithHandler(), v8::internal::JSObject::GetPropertyAttributesWithInterceptor(), v8::Object::Has(), v8::internal::JSReceiver::HasElement(), v8::internal::JSObject::HasHiddenProperties(), v8::internal::Runtime::HasObjectProperty(), v8::internal::JSReceiver::HasOwnElement(), v8::internal::JSReceiver::HasOwnProperty(), v8::Object::HasOwnProperty(), v8::internal::HasOwnPropertyImplementation(), v8::internal::JSReceiver::HasProperty(), v8::internal::JSProxy::HasPropertyWithHandler(), v8::internal::JSObject::HasRealElementProperty(), v8::Object::HasRealIndexedProperty(), v8::internal::JSObject::HasRealNamedCallbackProperty(), v8::Object::HasRealNamedCallbackProperty(), v8::internal::JSObject::HasRealNamedProperty(), v8::Object::HasRealNamedProperty(), v8::internal::IterateElements(), v8::internal::LoadLookupSlotHelper(), v8::internal::Context::Lookup(), v8::internal::MaterializeArgumentsObject(), v8::internal::ModuleGetExport(), v8::internal::ModuleSetExport(), v8::internal::RUNTIME_FUNCTION(), v8::internal::SetClosureVariableValue(), v8::internal::JSObject::SetElement(), v8::internal::SetLocalVariableValue(), v8::internal::anonymous_namespace{i18n.cc}::SetResolvedNumberSettings(), v8::TryCatch::StackTrace(), v8::internal::JSObjectWalkVisitor< ContextObject >::StructureWalk(), v8::internal::BreakIterator::UnpackBreakIterator(), v8::internal::Collator::UnpackCollator(), v8::internal::DateFormat::UnpackDateFormat(), v8::internal::NumberFormat::UnpackNumberFormat(), and v8::internal::UnscopableLookup().

+ Here is the caller graph for this function:

◆ mkdirp()

static bool v8::mkdirp ( Isolate isolate,
char *  directory,
mode_t  mask 
)
static

Definition at line 589 of file d8-posix.cc.

589  {
590  int result = mkdir(directory, mask);
591  if (result == 0) return true;
592  if (errno == EEXIST) {
593  return CheckItsADirectory(isolate, directory);
594  } else if (errno == ENOENT) { // Intermediate path element is missing.
595  char* last_slash = strrchr(directory, '/');
596  if (last_slash == NULL) {
597  isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
598  return false;
599  }
600  *last_slash = 0;
601  if (!mkdirp(isolate, directory, mask)) return false;
602  *last_slash = '/';
603  result = mkdir(directory, mask);
604  if (result == 0) return true;
605  if (errno == EEXIST) {
606  return CheckItsADirectory(isolate, directory);
607  }
608  isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
609  return false;
610  } else {
611  isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
612  return false;
613  }
614 }
static bool CheckItsADirectory(Isolate *isolate, char *directory)
Definition: d8-posix.cc:574
static bool mkdirp(Isolate *isolate, char *directory, mode_t mask)
Definition: d8-posix.cc:589

References CheckItsADirectory(), v8::String::NewFromUtf8(), NULL, and v8::Isolate::ThrowException().

Referenced by v8::Shell::MakeDirectory().

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

◆ NewBitmaskCompare()

template<typename T >
static Local<DeclaredAccessorDescriptor> v8::NewBitmaskCompare ( Isolate isolate,
T  bitmask,
T  compare_value,
RawOperationDescriptor operation 
)
static

Definition at line 1026 of file api.cc.

1030  {
1033  data.bitmask_compare_descriptor.bitmask = bitmask;
1034  data.bitmask_compare_descriptor.compare_value = compare_value;
1035  data.bitmask_compare_descriptor.size = sizeof(T);
1036  return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data, operation);
1037 }
@ kDescriptorBitmaskCompare
Definition: objects.h:10155
struct BitmaskCompareDescriptor bitmask_compare_descriptor
Definition: objects.h:10196

References v8::internal::BitmaskCompareDescriptor::bitmask, v8::internal::DeclaredAccessorDescriptorData::bitmask_compare_descriptor, v8::internal::BitmaskCompareDescriptor::compare_value, v8::internal::kDescriptorBitmaskCompare, v8::internal::BitmaskCompareDescriptor::size, T, and v8::internal::DeclaredAccessorDescriptorData::type.

Referenced by v8::RawOperationDescriptor::NewBitmaskCompare16(), v8::RawOperationDescriptor::NewBitmaskCompare32(), and v8::RawOperationDescriptor::NewBitmaskCompare8().

+ Here is the caller graph for this function:

◆ NewDescriptor()

template<typename Operation >
static Local<Operation> v8::NewDescriptor ( Isolate isolate,
const i::DeclaredAccessorDescriptorData data,
Data previous_descriptor 
)
static

Definition at line 949 of file api.cc.

952  {
953  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
956  if (previous_descriptor != NULL) {
957  previous = Utils::OpenHandle(
958  static_cast<DeclaredAccessorDescriptor*>(previous_descriptor));
959  }
961  i::DeclaredAccessorDescriptor::Create(internal_isolate, data, previous);
962  return Utils::Convert<i::DeclaredAccessorDescriptor, Operation>(descriptor);
963 }
static Handle< DeclaredAccessorDescriptor > Create(Isolate *isolate, const DeclaredAccessorDescriptorData &data, Handle< DeclaredAccessorDescriptor > previous)
Definition: objects.cc:15836

References v8::internal::DeclaredAccessorDescriptor::Create(), NULL, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ NewExternalOneByteStringHandle()

static i::MaybeHandle<i::String> v8::NewExternalOneByteStringHandle ( i::Isolate isolate,
v8::String::ExternalOneByteStringResource resource 
)
static

Definition at line 5505 of file api.cc.

5506  {
5507  return isolate->factory()->NewExternalStringFromOneByte(resource);
5508 }

References v8::internal::Isolate::factory().

Referenced by v8::String::NewExternal().

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

◆ NewExternalStringHandle()

static i::MaybeHandle<i::String> v8::NewExternalStringHandle ( i::Isolate isolate,
v8::String::ExternalStringResource resource 
)
static

Definition at line 5499 of file api.cc.

5500  {
5501  return isolate->factory()->NewExternalStringFromTwoByte(resource);
5502 }

References v8::internal::Isolate::factory().

Referenced by v8::String::NewExternal().

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

◆ NewTypedArray()

template<typename ElementType , ExternalArrayType array_type, i::ElementsKind elements_kind>
i::Handle<i::JSTypedArray> v8::NewTypedArray ( i::Isolate isolate,
Handle< ArrayBuffer array_buffer,
size_t  byte_offset,
size_t  length 
)

Definition at line 6106 of file api.cc.

6108  {
6110  isolate->factory()->NewJSTypedArray(array_type);
6111  i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer);
6112 
6113  DCHECK(byte_offset % sizeof(ElementType) == 0);
6114 
6115  CHECK(length <= (std::numeric_limits<size_t>::max() / sizeof(ElementType)));
6116  CHECK(length <= static_cast<size_t>(i::Smi::kMaxValue));
6117  size_t byte_length = length * sizeof(ElementType);
6119  isolate, obj, buffer, byte_offset, byte_length);
6120 
6121  i::Handle<i::Object> length_object =
6122  isolate->factory()->NewNumberFromSize(length);
6123  obj->set_length(*length_object);
6124 
6125  i::Handle<i::ExternalArray> elements =
6126  isolate->factory()->NewExternalArray(
6127  static_cast<int>(length), array_type,
6128  static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
6130  i::JSObject::GetElementsTransitionMap(obj, elements_kind);
6131  i::JSObject::SetMapAndElements(obj, map, elements);
6132  return obj;
6133 }
static void SetMapAndElements(Handle< JSObject > object, Handle< Map > map, Handle< FixedArrayBase > elements)
Definition: objects-inl.h:1814
static Handle< Map > GetElementsTransitionMap(Handle< JSObject > object, ElementsKind to_kind)
Definition: objects.cc:3385
static const int kMaxValue
Definition: objects.h:1272
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 map
#define CHECK(condition)
Definition: logging.h:36
static void SetupArrayBufferView(i::Isolate *isolate, i::Handle< i::JSArrayBufferView > obj, i::Handle< i::JSArrayBuffer > buffer, size_t byte_offset, size_t byte_length)
Definition: api.cc:6080

References CHECK, DCHECK, v8::internal::Isolate::factory(), v8::internal::JSObject::GetElementsTransitionMap(), v8::internal::Smi::kMaxValue, map, v8::Utils::OpenHandle(), v8::internal::JSObject::SetMapAndElements(), and SetupArrayBufferView().

+ Here is the call graph for this function:

◆ Null()

Handle< Primitive > v8::Null ( Isolate isolate)
inline

Definition at line 6845 of file v8.h.

6845  {
6846  typedef internal::Object* S;
6847  typedef internal::Internals I;
6848  I::CheckInitialized(isolate);
6849  S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
6850  return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
6851 }

Referenced by v8::internal::HGraphBuilder::BuildCompareNil(), v8::internal::CompareNilICStub::GetInputType(), and v8::internal::CompareNilICStub::GetType().

+ Here is the caller graph for this function:

◆ ObjectSetAccessor()

template<typename Getter , typename Setter , typename Data >
static bool v8::ObjectSetAccessor ( Object obj,
Handle< Name name,
Getter  getter,
Setter  setter,
Data  data,
AccessControl  settings,
PropertyAttribute  attributes 
)
inlinestatic

Definition at line 3514 of file api.cc.

3520  {
3521  i::Isolate* isolate = Utils::OpenHandle(obj)->GetIsolate();
3522  ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false);
3523  ENTER_V8(isolate);
3524  i::HandleScope scope(isolate);
3527  name, getter, setter, data, settings, attributes, signature);
3528  if (info.is_null()) return false;
3529  bool fast = Utils::OpenHandle(obj)->HasFastProperties();
3530  i::Handle<i::Object> result;
3532  isolate, result,
3533  i::JSObject::SetAccessor(Utils::OpenHandle(obj), info),
3534  false);
3535  if (result->IsUndefined()) return false;
3536  if (fast) i::JSObject::MigrateSlowToFast(Utils::OpenHandle(obj), 0);
3537  return true;
3538 }
#define ON_BAILOUT(isolate, location, code)
Definition: api.cc:60
static void MigrateSlowToFast(Handle< JSObject > object, int unused_property_fields)
Definition: objects.cc:4279
static MUST_USE_RESULT MaybeHandle< Object > SetAccessor(Handle< JSObject > object, Handle< AccessorInfo > info)
Definition: objects.cc:6188
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
Definition: isolate.h:123
static i::Handle< i::AccessorInfo > MakeAccessorInfo(v8::Handle< Name > name, v8::Handle< v8::DeclaredAccessorDescriptor > descriptor, void *setter_ignored, void *data_ignored, v8::AccessControl settings, v8::PropertyAttribute attributes, v8::Handle< AccessorSignature > signature)
Definition: api.cc:1164

References ASSIGN_RETURN_ON_EXCEPTION_VALUE, ENTER_V8, v8::internal::Handle< T >::is_null(), MakeAccessorInfo(), v8::internal::JSObject::MigrateSlowToFast(), name, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::internal::JSObject::SetAccessor().

Referenced by v8::Object::SetAccessor(), and v8::Object::SetDeclaredAccessor().

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

◆ operator<()

bool v8::operator< ( const CounterAndKey lhs,
const CounterAndKey rhs 
)
inline

Definition at line 1007 of file d8.cc.

1007  {
1008  return strcmp(lhs.key, rhs.key) < 0;
1009 }

References v8::CounterAndKey::key.

◆ PrintPrompt()

void v8::PrintPrompt ( bool  is_running)

Definition at line 10 of file d8-debug.cc.

10  {
11  const char* prompt = is_running? "> " : "dbg> ";
12  printf("%s", prompt);
13  fflush(stdout);
14 }

Referenced by HandleDebugEvent().

+ Here is the caller graph for this function:

◆ ReadBufferWeakCallback()

static void v8::ReadBufferWeakCallback ( const v8::WeakCallbackData< ArrayBuffer, DataAndPersistent > &  data)
static

Definition at line 1103 of file d8.cc.

1104  {
1105  size_t byte_length = data.GetValue()->ByteLength();
1107  -static_cast<intptr_t>(byte_length));
1108 
1109  delete[] data.GetParameter()->data;
1110  data.GetParameter()->handle.Reset();
1111  delete data.GetParameter();
1112 }
int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
Adjusts the amount of registered external memory.
Definition: v8.h:6890
Isolate * GetIsolate() const
Definition: v8.h:421
P * GetParameter() const
Definition: v8.h:423
Local< T > GetValue() const
Definition: v8.h:422

References v8::Isolate::AdjustAmountOfExternalAllocatedMemory(), v8::WeakCallbackData< T, P >::GetIsolate(), v8::WeakCallbackData< T, P >::GetParameter(), and v8::WeakCallbackData< T, P >::GetValue().

Referenced by v8::Shell::ReadBuffer().

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

◆ ReadChars()

static char* v8::ReadChars ( Isolate isolate,
const char *  name,
int size_out 
)
static

Definition at line 1077 of file d8.cc.

1077  {
1078  FILE* file = FOpen(name, "rb");
1079  if (file == NULL) return NULL;
1080 
1081  fseek(file, 0, SEEK_END);
1082  int size = ftell(file);
1083  rewind(file);
1084 
1085  char* chars = new char[size + 1];
1086  chars[size] = '\0';
1087  for (int i = 0; i < size;) {
1088  int read = static_cast<int>(fread(&chars[i], 1, size - i, file));
1089  i += read;
1090  }
1091  fclose(file);
1092  *size_out = size;
1093  return chars;
1094 }
enable harmony numeric enable harmony object literal extensions Optimize object size
static FILE * FOpen(const char *path, const char *mode)
Definition: d8.cc:1056

References file(), FOpen(), name, NULL, and size.

Referenced by v8::Shell::ReadBuffer(), v8::SourceGroup::ReadFile(), and v8::Shell::ReadFile().

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

◆ RecursivelySerializeToUtf8()

static bool v8::RecursivelySerializeToUtf8 ( i::String current,
Utf8WriterVisitor writer,
int  recursion_budget 
)
static

Definition at line 4752 of file api.cc.

4754  {
4755  while (!writer->IsDone()) {
4756  i::ConsString* cons_string = i::String::VisitFlat(writer, current);
4757  if (cons_string == NULL) return true; // Leaf node.
4758  if (recursion_budget <= 0) return false;
4759  // Must write the left branch first.
4760  i::String* first = cons_string->first();
4761  bool success = RecursivelySerializeToUtf8(first,
4762  writer,
4763  recursion_budget - 1);
4764  if (!success) return false;
4765  // Inline tail recurse for right branch.
4766  current = cons_string->second();
4767  }
4768  return true;
4769 }
static ConsString * VisitFlat(Visitor *visitor, String *string, int offset=0)
Definition: objects-inl.h:3416
static bool RecursivelySerializeToUtf8(i::String *current, Utf8WriterVisitor *writer, int recursion_budget)
Definition: api.cc:4752

References v8::internal::ConsString::first(), v8::Utf8WriterVisitor::IsDone(), NULL, v8::internal::ConsString::second(), and v8::internal::String::VisitFlat().

Referenced by v8::String::WriteUtf8().

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

◆ REGEXP_FLAG_ASSERT_EQ() [1/4]

v8::REGEXP_FLAG_ASSERT_EQ ( kGlobal  ,
GLOBAL   
)

◆ REGEXP_FLAG_ASSERT_EQ() [2/4]

v8::REGEXP_FLAG_ASSERT_EQ ( kIgnoreCase  ,
IGNORE_CASE   
)

◆ REGEXP_FLAG_ASSERT_EQ() [3/4]

v8::REGEXP_FLAG_ASSERT_EQ ( kMultiline  ,
MULTILINE   
)

◆ REGEXP_FLAG_ASSERT_EQ() [4/4]

v8::REGEXP_FLAG_ASSERT_EQ ( kNone  ,
NONE   
)

◆ RegExpFlagsToString()

static i::Handle<i::String> v8::RegExpFlagsToString ( RegExp::Flags  flags)
static

Definition at line 5755 of file api.cc.

5755  {
5756  i::Isolate* isolate = i::Isolate::Current();
5757  uint8_t flags_buf[3];
5758  int num_flags = 0;
5759  if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g';
5760  if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm';
5761  if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
5762  DCHECK(num_flags <= static_cast<int>(arraysize(flags_buf)));
5763  return isolate->factory()->InternalizeOneByteString(
5764  i::Vector<const uint8_t>(flags_buf, num_flags));
5765 }

References arraysize, DCHECK, v8::internal::Isolate::factory(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::RegExp::kGlobal, v8::RegExp::kIgnoreCase, v8::RegExp::kMultiline, and v8::internal::anonymous_namespace{flags.cc}::num_flags.

Referenced by v8::RegExp::New().

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

◆ RegisterExtension()

void v8::RegisterExtension ( Extension that)

Definition at line 398 of file api.cc.

398  {
399  RegisteredExtension* extension = new RegisteredExtension(that);
400  RegisteredExtension::Register(extension);
401 }

References v8::RegisteredExtension::Register().

+ Here is the call graph for this function:

◆ SetAccessorInfoProperties()

static i::Handle<i::AccessorInfo> v8::SetAccessorInfoProperties ( i::Handle< i::AccessorInfo obj,
v8::Handle< Name name,
v8::AccessControl  settings,
v8::PropertyAttribute  attributes,
v8::Handle< AccessorSignature signature 
)
static

Definition at line 1125 of file api.cc.

1130  {
1131  obj->set_name(*Utils::OpenHandle(*name));
1132  if (settings & ALL_CAN_READ) obj->set_all_can_read(true);
1133  if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true);
1134  obj->set_property_attributes(static_cast<PropertyAttributes>(attributes));
1135  if (!signature.IsEmpty()) {
1136  obj->set_expected_receiver_type(*Utils::OpenHandle(*signature));
1137  }
1138  return obj;
1139 }
PropertyAttributes

References ALL_CAN_READ, ALL_CAN_WRITE, v8::Handle< T >::IsEmpty(), name, and v8::Utils::OpenHandle().

Referenced by MakeAccessorInfo().

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

◆ SetFlagsFromString()

void v8::SetFlagsFromString ( const char *  flags)
static

Definition at line 7473 of file api.cc.

7473  {
7475 }
int StrLength(const char *string)
Definition: vector.h:147
static void SetFlagsFromString(const char *flags)
Definition: api.cc:7473

References v8::internal::anonymous_namespace{flags.cc}::flags, v8::V8::SetFlagsFromString(), and v8::internal::StrLength().

Referenced by v8::Shell::Main(), v8::Testing::PrepareStressRun(), and v8::Shell::SetOptions().

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

◆ SetResourceConstraints()

void v8::SetResourceConstraints ( i::Isolate isolate,
const ResourceConstraints constraints 
)

Definition at line 474 of file api.cc.

475  {
476  int semi_space_size = constraints.max_semi_space_size();
477  int old_space_size = constraints.max_old_space_size();
478  int max_executable_size = constraints.max_executable_size();
479  size_t code_range_size = constraints.code_range_size();
480  if (semi_space_size != 0 || old_space_size != 0 ||
481  max_executable_size != 0 || code_range_size != 0) {
482  isolate->heap()->ConfigureHeap(semi_space_size, old_space_size,
483  max_executable_size, code_range_size);
484  }
485  if (constraints.stack_limit() != NULL) {
486  uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit());
487  isolate->stack_guard()->SetStackLimit(limit);
488  }
489 
490  isolate->set_max_available_threads(constraints.max_available_threads());
491 }
bool ConfigureHeap(int max_semi_space_size, int max_old_space_size, int max_executable_size, size_t code_range_size)
Definition: heap.cc:4827
StackGuard * stack_guard()
Definition: isolate.h:872

References v8::ResourceConstraints::code_range_size(), v8::internal::Heap::ConfigureHeap(), v8::internal::Isolate::heap(), v8::ResourceConstraints::max_available_threads(), v8::ResourceConstraints::max_executable_size(), v8::ResourceConstraints::max_old_space_size(), v8::ResourceConstraints::max_semi_space_size(), NULL, v8::internal::Isolate::stack_guard(), and v8::ResourceConstraints::stack_limit().

Referenced by v8::Isolate::New().

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

◆ SetupArrayBufferView()

static void v8::SetupArrayBufferView ( i::Isolate isolate,
i::Handle< i::JSArrayBufferView obj,
i::Handle< i::JSArrayBuffer buffer,
size_t  byte_offset,
size_t  byte_length 
)
inlinestatic

Definition at line 6080 of file api.cc.

6085  {
6086  DCHECK(byte_offset + byte_length <=
6087  static_cast<size_t>(buffer->byte_length()->Number()));
6088 
6089  obj->set_buffer(*buffer);
6090 
6091  obj->set_weak_next(buffer->weak_first_view());
6092  buffer->set_weak_first_view(*obj);
6093 
6094  i::Handle<i::Object> byte_offset_object =
6095  isolate->factory()->NewNumberFromSize(byte_offset);
6096  obj->set_byte_offset(*byte_offset_object);
6097 
6098  i::Handle<i::Object> byte_length_object =
6099  isolate->factory()->NewNumberFromSize(byte_length);
6100  obj->set_byte_length(*byte_length_object);
6101 }

References DCHECK, and v8::internal::Isolate::factory().

Referenced by v8::DataView::New(), and NewTypedArray().

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

◆ SymbolFor()

static i::Handle<i::Symbol> v8::SymbolFor ( i::Isolate isolate,
i::Handle< i::String name,
i::Handle< i::String part 
)
static

Definition at line 6182 of file api.cc.

6184  {
6185  i::Handle<i::JSObject> registry = isolate->GetSymbolRegistry();
6186  i::Handle<i::JSObject> symbols =
6188  i::Object::GetPropertyOrElement(registry, part).ToHandleChecked());
6189  i::Handle<i::Object> symbol =
6190  i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked();
6191  if (!symbol->IsSymbol()) {
6192  DCHECK(symbol->IsUndefined());
6193  symbol = isolate->factory()->NewSymbol();
6194  i::Handle<i::Symbol>::cast(symbol)->set_name(*name);
6195  i::JSObject::SetProperty(symbols, name, symbol, i::STRICT).Assert();
6196  }
6197  return i::Handle<i::Symbol>::cast(symbol);
6198 }
Handle< JSObject > GetSymbolRegistry()
Definition: isolate.cc:2228
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyOrElement(Handle< Object > object, Handle< Name > key)
Definition: objects-inl.h:1124
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
Definition: objects.cc:2798

References v8::internal::Handle< T >::cast(), DCHECK, v8::internal::Isolate::factory(), v8::internal::Object::GetPropertyOrElement(), v8::internal::Isolate::GetSymbolRegistry(), name, v8::internal::Object::SetProperty(), and v8::internal::STRICT.

Referenced by v8::Symbol::For(), v8::Symbol::ForApi(), and GetWellKnownSymbol().

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

◆ TemplateSet()

static void v8::TemplateSet ( i::Isolate isolate,
v8::Template templ,
int  length,
v8::Handle< v8::Data > *  data 
)
static

Definition at line 782 of file api.cc.

785  {
786  i::Handle<i::Object> list(Utils::OpenHandle(templ)->property_list(), isolate);
787  if (list->IsUndefined()) {
788  list = NeanderArray(isolate).value();
789  Utils::OpenHandle(templ)->set_property_list(*list);
790  }
791  NeanderArray array(list);
792  array.add(isolate->factory()->NewNumberFromInt(length));
793  for (int i = 0; i < length; i++) {
794  i::Handle<i::Object> value = data[i].IsEmpty() ?
795  i::Handle<i::Object>(isolate->factory()->undefined_value()) :
796  Utils::OpenHandle(*data[i]);
797  array.add(value);
798  }
799 }

References v8::NeanderArray::add(), v8::internal::Isolate::factory(), v8::Handle< T >::IsEmpty(), v8::Utils::OpenHandle(), and v8::NeanderArray::value().

Referenced by v8::Template::Set(), and v8::Template::SetAccessorProperty().

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

◆ TemplateSetAccessor()

template<typename Getter , typename Setter , typename Data , typename Template >
static bool v8::TemplateSetAccessor ( Template template_obj,
v8::Local< Name name,
Getter  getter,
Setter  setter,
Data  data,
AccessControl  settings,
PropertyAttribute  attribute,
v8::Local< AccessorSignature signature 
)
static

Definition at line 1316 of file api.cc.

1324  {
1325  i::Isolate* isolate = Utils::OpenHandle(template_obj)->GetIsolate();
1326  ENTER_V8(isolate);
1327  i::HandleScope scope(isolate);
1329  name, getter, setter, data, settings, attribute, signature);
1330  if (obj.is_null()) return false;
1331  i::Handle<i::TemplateInfo> info = GetTemplateInfo(isolate, template_obj);
1332  AddPropertyToTemplate(info, obj);
1333  return true;
1334 }
static i::Handle< i::TemplateInfo > GetTemplateInfo(i::Isolate *isolate, ObjectTemplate *object_template)
Definition: api.cc:1307
static void AddPropertyToTemplate(i::Handle< i::TemplateInfo > info, i::Handle< i::AccessorInfo > obj)
Definition: api.cc:1285

References AddPropertyToTemplate(), ENTER_V8, GetTemplateInfo(), v8::internal::Handle< T >::is_null(), MakeAccessorInfo(), name, and v8::Utils::OpenHandle().

Referenced by v8::ObjectTemplate::SetAccessor(), v8::Template::SetDeclaredAccessor(), and v8::Template::SetNativeDataProperty().

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

◆ Throw()

static Handle<Value> v8::Throw ( Isolate isolate,
const char *  message 
)
static

Definition at line 72 of file d8.cc.

72  {
73  return isolate->ThrowException(String::NewFromUtf8(isolate, message));
74 }

References v8::String::NewFromUtf8(), and v8::Isolate::ThrowException().

Referenced by v8::Shell::Load(), v8::internal::BASE_EMBEDDED< Visitor >::NewThrow(), v8::Shell::Read(), v8::Shell::ReadBuffer(), v8::Shell::RealmDispose(), v8::Shell::RealmEval(), v8::PerIsolateData::RealmIndexOrThrow(), and v8::Shell::RealmOwner().

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

◆ TimeIsOut()

static bool v8::TimeIsOut ( const struct timeval &  start_time,
const int total_time 
)
static

Definition at line 123 of file d8-posix.cc.

123  {
124  if (total_time == -1) return false;
125  struct timeval time_now;
126  gettimeofday(&time_now, NULL);
127  // Careful about overflow.
128  int seconds = time_now.tv_sec - start_time.tv_sec;
129  if (seconds > 100) {
130  if (seconds * 1000 > total_time) return true;
131  return false;
132  }
133  int useconds = time_now.tv_usec - start_time.tv_usec;
134  if (seconds * 1000000 + useconds > total_time * 1000) {
135  return true;
136  }
137  return false;
138 }

References NULL.

Referenced by GetStdout(), and WaitForChild().

+ Here is the caller graph for this function:

◆ ToApi()

template<class T >
T* v8::ToApi ( v8::internal::Handle< v8::internal::Object obj)
inline

Definition at line 309 of file api.h.

309  {
310  return reinterpret_cast<T*>(obj.location());
311 }

References T.

◆ ToApiHandle()

template<class T >
v8::Local<T> v8::ToApiHandle ( v8::internal::Handle< v8::internal::Object obj)
inline

Definition at line 314 of file api.h.

315  {
316  return Utils::Convert<v8::internal::Object, T>(obj);
317 }

◆ ToCData()

template<typename T >
T v8::ToCData ( v8::internal::Object obj)
inline

Definition at line 95 of file api.h.

95  {
96  STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
97  return reinterpret_cast<T>(
98  reinterpret_cast<intptr_t>(
99  v8::internal::Foreign::cast(obj)->foreign_address()));
100 }

References STATIC_ASSERT, and T.

◆ ToInternal() [1/3]

static i::HeapGraphEdge* v8::ToInternal ( const HeapGraphEdge edge)
static

◆ ToInternal() [2/3]

static i::HeapEntry* v8::ToInternal ( const HeapGraphNode entry)
static

Definition at line 7257 of file api.cc.

7257  {
7258  return const_cast<i::HeapEntry*>(
7259  reinterpret_cast<const i::HeapEntry*>(entry));
7260 }

◆ ToInternal() [3/3]

static i::HeapSnapshot* v8::ToInternal ( const HeapSnapshot snapshot)
static

Definition at line 7303 of file api.cc.

7303  {
7304  return const_cast<i::HeapSnapshot*>(
7305  reinterpret_cast<const i::HeapSnapshot*>(snapshot));
7306 }
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 only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the snapshot(mksnapshot only)") DEFINE_STRING(raw_file

References snapshot().

+ Here is the call graph for this function:

◆ True()

Handle< Boolean > v8::True ( Isolate isolate)
inline

Definition at line 6854 of file v8.h.

6854  {
6855  typedef internal::Object* S;
6856  typedef internal::Internals I;
6857  I::CheckInitialized(isolate);
6858  S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
6859  return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
6860 }

Referenced by v8::ScriptCompiler::Compile(), v8::ScriptCompiler::CompileUnbound(), and v8::Boolean::New().

+ Here is the caller graph for this function:

◆ Unaligned()

static bool v8::Unaligned ( const uint16_t *  chars)
inlinestatic

Definition at line 4261 of file api.cc.

4261  {
4262  return reinterpret_cast<const uintptr_t>(chars) & kAlignmentMask;
4263 }

References kAlignmentMask.

Referenced by v8::ContainsOnlyOneByteHelper::VisitTwoByteString().

+ Here is the caller graph for this function:

◆ Undefined()

Handle< Primitive > v8::Undefined ( Isolate isolate)
inline

◆ Utf8Length()

static int v8::Utf8Length ( i::String str,
i::Isolate isolate 
)
static

Definition at line 4549 of file api.cc.

4549  {
4550  int length = str->length();
4551  if (length == 0) return 0;
4552  uint8_t state;
4553  i::ConsString* cons_string =
4554  Utf8LengthHelper::Visitor::VisitFlat(str, &length, &state);
4555  if (cons_string == NULL) return length;
4556  return Utf8LengthHelper::Calculate(cons_string);
4557 }

References v8::Utf8LengthHelper::Calculate(), v8::internal::String::length(), NULL, and v8::Utf8LengthHelper::Visitor::VisitFlat().

Referenced by v8::String::Utf8Length(), v8::String::Utf8Value::Utf8Value(), and v8::String::WriteUtf8().

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

◆ WaitForChild()

static bool v8::WaitForChild ( Isolate isolate,
int  pid,
ZombieProtector child_waiter,
const struct timeval &  start_time,
int  read_timeout,
int  total_timeout 
)
static

Definition at line 365 of file d8-posix.cc.

370  {
371 #ifdef HAS_WAITID
372 
373  siginfo_t child_info;
374  child_info.si_pid = 0;
375  int useconds = 1;
376  // Wait for child to exit.
377  while (child_info.si_pid == 0) {
378  waitid(P_PID, pid, &child_info, WEXITED | WNOHANG | WNOWAIT);
379  usleep(useconds);
380  if (useconds < 1000000) useconds <<= 1;
381  if ((read_timeout != -1 && useconds / 1000 > read_timeout) ||
382  (TimeIsOut(start_time, total_timeout))) {
383  isolate->ThrowException(String::NewFromUtf8(
384  isolate, "Timed out waiting for process to terminate"));
385  kill(pid, SIGINT);
386  return false;
387  }
388  }
389  if (child_info.si_code == CLD_KILLED) {
390  char message[999];
391  snprintf(message,
392  sizeof(message),
393  "Child killed by signal %d",
394  child_info.si_status);
395  isolate->ThrowException(String::NewFromUtf8(isolate, message));
396  return false;
397  }
398  if (child_info.si_code == CLD_EXITED && child_info.si_status != 0) {
399  char message[999];
400  snprintf(message,
401  sizeof(message),
402  "Child exited with status %d",
403  child_info.si_status);
404  isolate->ThrowException(String::NewFromUtf8(isolate, message));
405  return false;
406  }
407 
408 #else // No waitid call.
409 
410  int child_status;
411  waitpid(pid, &child_status, 0); // We hang here if the child doesn't exit.
412  child_waiter.ChildIsDeadNow();
413  if (WIFSIGNALED(child_status)) {
414  char message[999];
415  snprintf(message,
416  sizeof(message),
417  "Child killed by signal %d",
418  WTERMSIG(child_status));
419  isolate->ThrowException(String::NewFromUtf8(isolate, message));
420  return false;
421  }
422  if (WEXITSTATUS(child_status) != 0) {
423  char message[999];
424  int exit_status = WEXITSTATUS(child_status);
425  snprintf(message,
426  sizeof(message),
427  "Child exited with status %d",
428  exit_status);
429  isolate->ThrowException(String::NewFromUtf8(isolate, message));
430  return false;
431  }
432 
433 #endif // No waitid call.
434 
435  return true;
436 }

References v8::ZombieProtector::ChildIsDeadNow(), v8::String::NewFromUtf8(), v8::Isolate::ThrowException(), and TimeIsOut().

Referenced by v8::Shell::System().

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

◆ WaitOnFD()

static bool v8::WaitOnFD ( int  fd,
int  read_timeout,
int  total_timeout,
const struct timeval &  start_time 
)
static

Definition at line 82 of file d8-posix.cc.

85  {
86  fd_set readfds, writefds, exceptfds;
87  struct timeval timeout;
88  int gone = 0;
89  if (total_timeout != -1) {
90  struct timeval time_now;
91  gettimeofday(&time_now, NULL);
92  int seconds = time_now.tv_sec - start_time.tv_sec;
93  gone = seconds * 1000 + (time_now.tv_usec - start_time.tv_usec) / 1000;
94  if (gone >= total_timeout) return false;
95  }
96  FD_ZERO(&readfds);
97  FD_ZERO(&writefds);
98  FD_ZERO(&exceptfds);
99  FD_SET(fd, &readfds);
100  FD_SET(fd, &exceptfds);
101  if (read_timeout == -1 ||
102  (total_timeout != -1 && total_timeout - gone < read_timeout)) {
103  read_timeout = total_timeout - gone;
104  }
105  timeout.tv_usec = (read_timeout % 1000) * 1000;
106  timeout.tv_sec = read_timeout / 1000;
107 #if V8_OS_NACL
108  // PNaCL has no support for select.
109  int number_of_fds_ready = -1;
110 #else
111  int number_of_fds_ready = select(fd + 1,
112  &readfds,
113  &writefds,
114  &exceptfds,
115  read_timeout != -1 ? &timeout : NULL);
116 #endif
117  return number_of_fds_ready == 1;
118 }

References NULL.

Referenced by GetStdout().

+ Here is the caller graph for this function:

◆ WriteHelper()

template<typename CharType >
static int v8::WriteHelper ( const String string,
CharType *  buffer,
int  start,
int  length,
int  options 
)
inlinestatic

Definition at line 4824 of file api.cc.

4828  {
4829  i::Isolate* isolate = Utils::OpenHandle(string)->GetIsolate();
4830  LOG_API(isolate, "String::Write");
4831  ENTER_V8(isolate);
4832  DCHECK(start >= 0 && length >= -1);
4833  i::Handle<i::String> str = Utils::OpenHandle(string);
4834  isolate->string_tracker()->RecordWrite(str);
4835  if (options & String::HINT_MANY_WRITES_EXPECTED) {
4836  // Flatten the string for efficiency. This applies whether we are
4837  // using StringCharacterStream or Get(i) to access the characters.
4838  str = i::String::Flatten(str);
4839  }
4840  int end = start + length;
4841  if ((length == -1) || (length > str->length() - start) )
4842  end = str->length();
4843  if (end < 0) return 0;
4844  i::String::WriteToFlat(*str, buffer, start, end);
4845  if (!(options & String::NO_NULL_TERMINATION) &&
4846  (length == -1 || end - start < length)) {
4847  buffer[end - start] = '\0';
4848  }
4849  return end - start;
4850 }
#define LOG_API(isolate, expr)
Definition: api.cc:52
StringTracker * string_tracker()
Definition: isolate.h:923
void RecordWrite(Handle< String > string)
Definition: api.h:400
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
Definition: objects.cc:8370
static Handle< String > Flatten(Handle< String > string, PretenureFlag pretenure=NOT_TENURED)
Definition: objects-inl.h:3354

References DCHECK, ENTER_V8, v8::internal::String::Flatten(), v8::String::HINT_MANY_WRITES_EXPECTED, LOG_API, v8::String::NO_NULL_TERMINATION, v8::Utils::OpenHandle(), v8::internal::StringTracker::RecordWrite(), v8::internal::Isolate::string_tracker(), and v8::internal::String::WriteToFlat().

Referenced by v8::String::Write(), and v8::String::WriteOneByte().

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

Variable Documentation

◆ kAlignmentMask

const uintptr_t v8::kAlignmentMask = sizeof(uintptr_t) - 1
static

Definition at line 4260 of file api.cc.

Referenced by Align(), and Unaligned().

◆ kOneByteMask

const uintptr_t v8::kOneByteMask = OneByteMask<sizeof(uintptr_t)>::value
static

Definition at line 4259 of file api.cc.

Referenced by v8::ContainsOnlyOneByteHelper::VisitTwoByteString().

◆ kPersistentContainerNotFound

◆ kReadFD

const int v8::kReadFD = 0
static

Definition at line 247 of file d8-posix.cc.

Referenced by ChildLaunchedOK(), ExecSubprocess(), and v8::Shell::System().

◆ kWriteFD

const int v8::kWriteFD = 1
static

Definition at line 248 of file d8-posix.cc.

Referenced by ExecSubprocess(), and v8::Shell::System().

◆ MB

const int v8::MB = 1024 * 1024

◆ read_line_editor

ReadLineEditor v8::read_line_editor
static

Definition at line 47 of file d8-readline.cc.

Referenced by v8::ReadLineEditor::CompletionGenerator().