V8 Project
|
A JavaScript function object (ECMA-262, 15.3). More...
#include <v8.h>
Public Member Functions | |
Local< Object > | NewInstance () const |
Local< Object > | NewInstance (int argc, Handle< Value > argv[]) const |
Local< Value > | Call (Handle< Value > recv, int argc, Handle< Value > argv[]) |
void | SetName (Handle< String > name) |
Handle< Value > | GetName () const |
Handle< Value > | GetInferredName () const |
Name inferred from variable or property assignment of this function. More... | |
Handle< Value > | GetDisplayName () const |
User-defined name assigned to the "displayName" property of this function. More... | |
int | GetScriptLineNumber () const |
Returns zero based line number of function body and kLineOffsetNotFound if no information available. More... | |
int | GetScriptColumnNumber () const |
Returns zero based column number of function body and kLineOffsetNotFound if no information available. More... | |
bool | IsBuiltin () const |
Tells whether this function is builtin. More... | |
int | ScriptId () const |
Returns scriptId. More... | |
Local< Value > | GetBoundFunction () const |
Returns the original function if this function is bound, else returns v8::Undefined. More... | |
ScriptOrigin | GetScriptOrigin () const |
![]() | |
bool | Set (Handle< Value > key, Handle< Value > value) |
bool | Set (uint32_t index, Handle< Value > value) |
bool | ForceSet (Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None) |
Local< Value > | Get (Handle< Value > key) |
Local< Value > | Get (uint32_t index) |
PropertyAttribute | GetPropertyAttributes (Handle< Value > key) |
Gets the property attributes of a property which can be None or any combination of ReadOnly, DontEnum and DontDelete. More... | |
Local< Value > | GetOwnPropertyDescriptor (Local< String > key) |
Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. More... | |
bool | Has (Handle< Value > key) |
bool | Delete (Handle< Value > key) |
bool | ForceDelete (Handle< Value > key) |
bool | Has (uint32_t index) |
bool | Delete (uint32_t index) |
bool | SetAccessor (Handle< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None) |
bool | SetAccessor (Handle< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None) |
bool | SetDeclaredAccessor (Local< Name > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, AccessControl settings=DEFAULT) |
void | SetAccessorProperty (Local< Name > name, Local< Function > getter, Handle< Function > setter=Handle< Function >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT) |
bool | HasPrivate (Handle< Private > key) |
Functionality for private properties. More... | |
bool | SetPrivate (Handle< Private > key, Handle< Value > value) |
bool | DeletePrivate (Handle< Private > key) |
Local< Value > | GetPrivate (Handle< Private > key) |
Local< Array > | GetPropertyNames () |
Returns an array containing the names of the enumerable properties of this object, including properties from prototype objects. More... | |
Local< Array > | GetOwnPropertyNames () |
This function has the same functionality as GetPropertyNames but the returned array doesn't contain the names of properties from prototype objects. More... | |
Local< Value > | GetPrototype () |
Get the prototype object. More... | |
bool | SetPrototype (Handle< Value > prototype) |
Set the prototype object. More... | |
Local< Object > | FindInstanceInPrototypeChain (Handle< FunctionTemplate > tmpl) |
Finds an instance of the given function template in the prototype chain. More... | |
Local< String > | ObjectProtoToString () |
Call builtin Object.prototype.toString on this object. More... | |
Local< String > | GetConstructorName () |
Returns the name of the function invoked as a constructor for this object. More... | |
int | InternalFieldCount () |
Gets the number of internal fields for this Object. More... | |
Local< Value > | GetInternalField (int index) |
Gets the value from an internal field. More... | |
void | SetInternalField (int index, Handle< Value > value) |
Sets the value in an internal field. More... | |
void * | GetAlignedPointerFromInternalField (int index) |
Gets a 2-byte-aligned native pointer from an internal field. More... | |
void | SetAlignedPointerInInternalField (int index, void *value) |
Sets a 2-byte-aligned native pointer in an internal field. More... | |
bool | HasOwnProperty (Handle< String > key) |
bool | HasRealNamedProperty (Handle< String > key) |
bool | HasRealIndexedProperty (uint32_t index) |
bool | HasRealNamedCallbackProperty (Handle< String > key) |
Local< Value > | GetRealNamedPropertyInPrototypeChain (Handle< String > key) |
If result.IsEmpty() no real property was located in the prototype chain. More... | |
Local< Value > | GetRealNamedProperty (Handle< String > key) |
If result.IsEmpty() no real property was located on the object or in the prototype chain. More... | |
bool | HasNamedLookupInterceptor () |
Tests for a named lookup interceptor. More... | |
bool | HasIndexedLookupInterceptor () |
Tests for an index lookup interceptor. More... | |
void | TurnOnAccessCheck () |
Turns on access check on the object if the object is an instance of a template that has access check callbacks. More... | |
int | GetIdentityHash () |
Returns the identity hash for this object. More... | |
bool | SetHiddenValue (Handle< String > key, Handle< Value > value) |
Access hidden properties on JavaScript objects. More... | |
Local< Value > | GetHiddenValue (Handle< String > key) |
bool | DeleteHiddenValue (Handle< String > key) |
bool | IsDirty () |
Returns true if this is an instance of an api function (one created from a function created from a function template) and has been modified since it was created. More... | |
Local< Object > | Clone () |
Clone this object with a fast but shallow copy. More... | |
Local< Context > | CreationContext () |
Returns the context in which the object was created. More... | |
void | SetIndexedPropertiesToPixelData (uint8_t *data, int length) |
Set the backing store of the indexed properties to be managed by the embedding layer. More... | |
bool | HasIndexedPropertiesInPixelData () |
uint8_t * | GetIndexedPropertiesPixelData () |
int | GetIndexedPropertiesPixelDataLength () |
void | SetIndexedPropertiesToExternalArrayData (void *data, ExternalArrayType array_type, int number_of_elements) |
Set the backing store of the indexed properties to be managed by the embedding layer. More... | |
bool | HasIndexedPropertiesInExternalArrayData () |
void * | GetIndexedPropertiesExternalArrayData () |
ExternalArrayType | GetIndexedPropertiesExternalArrayDataType () |
int | GetIndexedPropertiesExternalArrayDataLength () |
bool | IsCallable () |
Checks whether a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method. More... | |
Local< Value > | CallAsFunction (Handle< Value > recv, int argc, Handle< Value > argv[]) |
Call an Object as a function if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method. More... | |
Local< Value > | CallAsConstructor (int argc, Handle< Value > argv[]) |
Call an Object as a constructor if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method. More... | |
![]() | |
bool | IsUndefined () const |
Returns true if this value is the undefined value. More... | |
bool | IsNull () const |
Returns true if this value is the null value. More... | |
bool | IsTrue () const |
Returns true if this value is true. More... | |
bool | IsFalse () const |
Returns true if this value is false. More... | |
bool | IsName () const |
Returns true if this value is a symbol or a string. More... | |
bool | IsString () const |
Returns true if this value is an instance of the String type. More... | |
bool | IsSymbol () const |
Returns true if this value is a symbol. More... | |
bool | IsFunction () const |
Returns true if this value is a function. More... | |
bool | IsArray () const |
Returns true if this value is an array. More... | |
bool | IsObject () const |
Returns true if this value is an object. More... | |
bool | IsBoolean () const |
Returns true if this value is boolean. More... | |
bool | IsNumber () const |
Returns true if this value is a number. More... | |
bool | IsExternal () const |
Returns true if this value is external. More... | |
bool | IsInt32 () const |
Returns true if this value is a 32-bit signed integer. More... | |
bool | IsUint32 () const |
Returns true if this value is a 32-bit unsigned integer. More... | |
bool | IsDate () const |
Returns true if this value is a Date. More... | |
bool | IsArgumentsObject () const |
Returns true if this value is an Arguments object. More... | |
bool | IsBooleanObject () const |
Returns true if this value is a Boolean object. More... | |
bool | IsNumberObject () const |
Returns true if this value is a Number object. More... | |
bool | IsStringObject () const |
Returns true if this value is a String object. More... | |
bool | IsSymbolObject () const |
Returns true if this value is a Symbol object. More... | |
bool | IsNativeError () const |
Returns true if this value is a NativeError. More... | |
bool | IsRegExp () const |
Returns true if this value is a RegExp. More... | |
bool | IsGeneratorFunction () const |
Returns true if this value is a Generator function. More... | |
bool | IsGeneratorObject () const |
Returns true if this value is a Generator object (iterator). More... | |
bool | IsPromise () const |
Returns true if this value is a Promise. More... | |
bool | IsMap () const |
Returns true if this value is a Map. More... | |
bool | IsSet () const |
Returns true if this value is a Set. More... | |
bool | IsWeakMap () const |
Returns true if this value is a WeakMap. More... | |
bool | IsWeakSet () const |
Returns true if this value is a WeakSet. More... | |
bool | IsArrayBuffer () const |
Returns true if this value is an ArrayBuffer. More... | |
bool | IsArrayBufferView () const |
Returns true if this value is an ArrayBufferView. More... | |
bool | IsTypedArray () const |
Returns true if this value is one of TypedArrays. More... | |
bool | IsUint8Array () const |
Returns true if this value is an Uint8Array. More... | |
bool | IsUint8ClampedArray () const |
Returns true if this value is an Uint8ClampedArray. More... | |
bool | IsInt8Array () const |
Returns true if this value is an Int8Array. More... | |
bool | IsUint16Array () const |
Returns true if this value is an Uint16Array. More... | |
bool | IsInt16Array () const |
Returns true if this value is an Int16Array. More... | |
bool | IsUint32Array () const |
Returns true if this value is an Uint32Array. More... | |
bool | IsInt32Array () const |
Returns true if this value is an Int32Array. More... | |
bool | IsFloat32Array () const |
Returns true if this value is a Float32Array. More... | |
bool | IsFloat64Array () const |
Returns true if this value is a Float64Array. More... | |
bool | IsDataView () const |
Returns true if this value is a DataView. More... | |
Local< Boolean > | ToBoolean () const |
Local< Number > | ToNumber () const |
Local< String > | ToString () const |
Local< String > | ToDetailString () const |
Local< Object > | ToObject () const |
Local< Integer > | ToInteger () const |
Local< Uint32 > | ToUint32 () const |
Local< Int32 > | ToInt32 () const |
Local< Uint32 > | ToArrayIndex () const |
Attempts to convert a string to an array index. More... | |
bool | BooleanValue () const |
double | NumberValue () const |
int64_t | IntegerValue () const |
uint32_t | Uint32Value () const |
int32_t | Int32Value () const |
bool | Equals (Handle< Value > that) const |
JS ==. More... | |
bool | StrictEquals (Handle< Value > that) const |
bool | SameValue (Handle< Value > that) const |
Static Public Member Functions | |
static Local< Function > | New (Isolate *isolate, FunctionCallback callback, Local< Value > data=Local< Value >(), int length=0) |
Create a function in the current execution context for a given FunctionCallback. More... | |
static Function * | Cast (Value *obj) |
![]() | |
static int | InternalFieldCount (const PersistentBase< Object > &object) |
Same as above, but works for Persistents. More... | |
static void * | GetAlignedPointerFromInternalField (const PersistentBase< Object > &object, int index) |
Same as above, but works for Persistents. More... | |
static Local< Object > | New (Isolate *isolate) |
static Object * | Cast (Value *obj) |
![]() | |
template<class T > | |
static Value * | Cast (T *value) |
Static Public Attributes | |
static const int | kLineOffsetNotFound = -1 |
Private Member Functions | |
Function () | |
Static Private Member Functions | |
static void | CheckCast (Value *obj) |
|
private |
Definition at line 4104 of file api.cc.
References v8::internal::HandleScope::CloseAndEscape(), ENTER_V8, EXCEPTION_BAILOUT_CHECK_DO_CALLBACK, EXCEPTION_PREAMBLE, LOG_API, ON_BAILOUT, v8::Utils::OpenHandle(), STATIC_ASSERT, and v8::Utils::ToLocal().
|
staticprivate |
Definition at line 2714 of file api.cc.
References v8::Utils::ApiCheck(), and v8::Utils::OpenHandle().
Returns the original function if this function is bound, else returns v8::Undefined.
Definition at line 4225 of file api.cc.
References v8::internal::JSFunction::kBoundFunctionIndex, v8::Utils::OpenHandle(), v8::Utils::ToLocal(), and v8::Undefined().
User-defined name assigned to the "displayName" property of this function.
Used to facilitate debugging and profiling of JavaScript code.
Definition at line 4148 of file api.cc.
References v8::internal::Handle< T >::cast(), ENTER_V8, v8::internal::Isolate::factory(), v8::internal::JSObject::GetDataProperty(), name, ON_BAILOUT, v8::Utils::OpenHandle(), STATIC_CHAR_VECTOR, and v8::Utils::ToLocal().
Name inferred from variable or property assignment of this function.
Used to facilitate debugging and profiling of JavaScript code written in an OO style, where many functions are anonymous but are assigned to object properties.
Definition at line 4141 of file api.cc.
References v8::Utils::OpenHandle(), and v8::Utils::ToLocal().
Definition at line 4134 of file api.cc.
References v8::Utils::OpenHandle(), and v8::Utils::ToLocal().
int v8::Function::GetScriptColumnNumber | ( | ) | const |
Returns zero based column number of function body and kLineOffsetNotFound if no information available.
Definition at line 4199 of file api.cc.
References v8::internal::Script::GetColumnNumber(), kLineOffsetNotFound, and v8::Utils::OpenHandle().
int v8::Function::GetScriptLineNumber | ( | ) | const |
Returns zero based line number of function body and kLineOffsetNotFound if no information available.
Definition at line 4189 of file api.cc.
References v8::internal::Script::GetLineNumber(), kLineOffsetNotFound, and v8::Utils::OpenHandle().
ScriptOrigin v8::Function::GetScriptOrigin | ( | ) | const |
Definition at line 4170 of file api.cc.
References v8::internal::Script::GetNameOrSourceURL(), v8::Integer::New(), v8::Utils::OpenHandle(), and v8::Utils::ToLocal().
bool v8::Function::IsBuiltin | ( | ) | const |
Tells whether this function is builtin.
Definition at line 4209 of file api.cc.
References v8::Utils::OpenHandle().
|
static |
Create a function in the current execution context for a given FunctionCallback.
Definition at line 4065 of file api.cc.
References ENTER_V8, v8::FunctionTemplateNew(), and LOG_API.
Local< v8::Object > v8::Function::NewInstance | ( | ) | const |
Definition at line 4078 of file api.cc.
References NULL.
Local< v8::Object > v8::Function::NewInstance | ( | int | argc, |
Handle< Value > | argv[] | ||
) | const |
Definition at line 4083 of file api.cc.
References ENTER_V8, v8::EscapableHandleScope::Escape(), EXCEPTION_BAILOUT_CHECK_DO_CALLBACK, EXCEPTION_PREAMBLE, LOG_API, ON_BAILOUT, v8::Utils::OpenHandle(), STATIC_ASSERT, and v8::Utils::ToLocal().
int v8::Function::ScriptId | ( | ) | const |
Returns scriptId.
Definition at line 4215 of file api.cc.
References v8::UnboundScript::kNoScriptId, and v8::Utils::OpenHandle().
|
static |
Definition at line 2783 of file v8.h.
Referenced by GetScriptColumnNumber(), and GetScriptLineNumber().