V8 Project
v8::Function Class Reference

A JavaScript function object (ECMA-262, 15.3). More...

#include <v8.h>

+ Inheritance diagram for v8::Function:
+ Collaboration diagram for v8::Function:

Public Member Functions

Local< ObjectNewInstance () const
 
Local< ObjectNewInstance (int argc, Handle< Value > argv[]) const
 
Local< ValueCall (Handle< Value > recv, int argc, Handle< Value > argv[])
 
void SetName (Handle< String > name)
 
Handle< ValueGetName () const
 
Handle< ValueGetInferredName () const
 Name inferred from variable or property assignment of this function. More...
 
Handle< ValueGetDisplayName () 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< ValueGetBoundFunction () const
 Returns the original function if this function is bound, else returns v8::Undefined. More...
 
ScriptOrigin GetScriptOrigin () const
 
- Public Member Functions inherited from v8::Object
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< ValueGet (Handle< Value > key)
 
Local< ValueGet (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< ValueGetOwnPropertyDescriptor (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< ValueGetPrivate (Handle< Private > key)
 
Local< ArrayGetPropertyNames ()
 Returns an array containing the names of the enumerable properties of this object, including properties from prototype objects. More...
 
Local< ArrayGetOwnPropertyNames ()
 This function has the same functionality as GetPropertyNames but the returned array doesn't contain the names of properties from prototype objects. More...
 
Local< ValueGetPrototype ()
 Get the prototype object. More...
 
bool SetPrototype (Handle< Value > prototype)
 Set the prototype object. More...
 
Local< ObjectFindInstanceInPrototypeChain (Handle< FunctionTemplate > tmpl)
 Finds an instance of the given function template in the prototype chain. More...
 
Local< StringObjectProtoToString ()
 Call builtin Object.prototype.toString on this object. More...
 
Local< StringGetConstructorName ()
 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< ValueGetInternalField (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< ValueGetRealNamedPropertyInPrototypeChain (Handle< String > key)
 If result.IsEmpty() no real property was located in the prototype chain. More...
 
Local< ValueGetRealNamedProperty (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< ValueGetHiddenValue (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< ObjectClone ()
 Clone this object with a fast but shallow copy. More...
 
Local< ContextCreationContext ()
 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< ValueCallAsFunction (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< ValueCallAsConstructor (int argc, Handle< Value > argv[])
 Call an Object as a constructor if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method. More...
 
- Public Member Functions inherited from v8::Value
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< BooleanToBoolean () const
 
Local< NumberToNumber () const
 
Local< StringToString () const
 
Local< StringToDetailString () const
 
Local< ObjectToObject () const
 
Local< IntegerToInteger () const
 
Local< Uint32ToUint32 () const
 
Local< Int32ToInt32 () const
 
Local< Uint32ToArrayIndex () 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< FunctionNew (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 FunctionCast (Value *obj)
 
- Static Public Member Functions inherited from v8::Object
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< ObjectNew (Isolate *isolate)
 
static ObjectCast (Value *obj)
 
- Static Public Member Functions inherited from v8::Value
template<class T >
static ValueCast (T *value)
 

Static Public Attributes

static const int kLineOffsetNotFound = -1
 

Private Member Functions

 Function ()
 

Static Private Member Functions

static void CheckCast (Value *obj)
 

Detailed Description

A JavaScript function object (ECMA-262, 15.3).

Definition at line 2723 of file v8.h.

Constructor & Destructor Documentation

◆ Function()

v8::Function::Function ( )
private

Member Function Documentation

◆ Call()

Local< v8::Value > v8::Function::Call ( Handle< Value recv,
int  argc,
Handle< Value argv[] 
)

Definition at line 4104 of file api.cc.

4105  {
4106  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4107  ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>());
4108  LOG_API(isolate, "Function::Call");
4109  ENTER_V8(isolate);
4110  i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4111  i::HandleScope scope(isolate);
4113  i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
4114  STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
4115  i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4116  EXCEPTION_PREAMBLE(isolate);
4117  i::Handle<i::Object> returned;
4118  has_pending_exception = !i::Execution::Call(
4119  isolate, fun, recv_obj, argc, args, true).ToHandle(&returned);
4120  EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>());
4121  return Utils::ToLocal(scope.CloseAndEscape(returned));
4122 }
#define ON_BAILOUT(isolate, location, code)
Definition: api.cc:60
#define LOG_API(isolate, expr)
Definition: api.cc:52
#define ENTER_V8(isolate)
Definition: api.cc:54
#define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value)
Definition: api.cc:88
#define EXCEPTION_PREAMBLE(isolate)
Definition: api.cc:67
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
Definition: api.h:288
#define STATIC_ASSERT(test)
Definition: macros.h:311

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().

+ Here is the call graph for this function:

◆ Cast()

Function * v8::Function::Cast ( v8::Value value)
inlinestatic

Definition at line 6790 of file v8.h.

6790  {
6791 #ifdef V8_ENABLE_CHECKS
6792  CheckCast(value);
6793 #endif
6794  return static_cast<Function*>(value);
6795 }
static void CheckCast(Value *obj)
Definition: api.cc:2714

◆ CheckCast()

void v8::Function::CheckCast ( Value obj)
staticprivate

Definition at line 2714 of file api.cc.

2714  {
2716  Utils::ApiCheck(obj->IsJSFunction(),
2717  "v8::Function::Cast()",
2718  "Could not convert to function");
2719 }
static bool ApiCheck(bool condition, const char *location, const char *message)
Definition: api.h:177

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

+ Here is the call graph for this function:

◆ GetBoundFunction()

Local< v8::Value > v8::Function::GetBoundFunction ( ) const

Returns the original function if this function is bound, else returns v8::Undefined.

Definition at line 4225 of file api.cc.

4225  {
4227  if (!func->shared()->bound()) {
4228  return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate()));
4229  }
4231  i::FixedArray::cast(func->function_bindings()));
4232  i::Handle<i::Object> original(
4233  bound_args->get(i::JSFunction::kBoundFunctionIndex),
4234  func->GetIsolate());
4236 }
Isolate represents an isolated instance of the V8 engine.
Definition: v8.h:4356
static const int kBoundFunctionIndex
Definition: objects.h:7392
Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6836

References v8::internal::JSFunction::kBoundFunctionIndex, v8::Utils::OpenHandle(), v8::Utils::ToLocal(), and v8::Undefined().

+ Here is the call graph for this function:

◆ GetDisplayName()

Handle< Value > v8::Function::GetDisplayName ( ) const

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.

4148  {
4149  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4150  ON_BAILOUT(isolate, "v8::Function::GetDisplayName()",
4151  return ToApiHandle<Primitive>(
4152  isolate->factory()->undefined_value()));
4153  ENTER_V8(isolate);
4155  i::Handle<i::String> property_name =
4156  isolate->factory()->InternalizeOneByteString(
4157  STATIC_CHAR_VECTOR("displayName"));
4158 
4159  i::Handle<i::Object> value =
4160  i::JSObject::GetDataProperty(func, property_name);
4161  if (value->IsString()) {
4163  if (name->length() > 0) return Utils::ToLocal(name);
4164  }
4165 
4166  return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
4167 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
Factory * factory()
Definition: isolate.h:982
static Handle< Object > GetDataProperty(Handle< JSObject > object, Handle< Name > key)
Definition: objects.cc:140
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 STATIC_CHAR_VECTOR(x)
Definition: vector.h:154

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().

+ Here is the call graph for this function:

◆ GetInferredName()

Handle< Value > v8::Function::GetInferredName ( ) const

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.

4141  {
4143  return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(),
4144  func->GetIsolate()));
4145 }

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

+ Here is the call graph for this function:

◆ GetName()

Handle< Value > v8::Function::GetName ( ) const

Definition at line 4134 of file api.cc.

4134  {
4136  return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name(),
4137  func->GetIsolate()));
4138 }

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

+ Here is the call graph for this function:

◆ GetScriptColumnNumber()

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.

4199  {
4201  if (func->shared()->script()->IsScript()) {
4202  i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
4203  return i::Script::GetColumnNumber(script, func->shared()->start_position());
4204  }
4205  return kLineOffsetNotFound;
4206 }
static const int kLineOffsetNotFound
Definition: v8.h:2783
static int GetColumnNumber(Handle< Script > script, int code_pos)
Definition: objects.cc:9635

References v8::internal::Script::GetColumnNumber(), kLineOffsetNotFound, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetScriptLineNumber()

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.

4189  {
4191  if (func->shared()->script()->IsScript()) {
4192  i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
4193  return i::Script::GetLineNumber(script, func->shared()->start_position());
4194  }
4195  return kLineOffsetNotFound;
4196 }
static int GetLineNumber(Handle< Script > script, int code_pos)
Definition: objects.cc:9673

References v8::internal::Script::GetLineNumber(), kLineOffsetNotFound, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetScriptOrigin()

ScriptOrigin v8::Function::GetScriptOrigin ( ) const

Definition at line 4170 of file api.cc.

4170  {
4172  if (func->shared()->script()->IsScript()) {
4173  i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
4175  v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate());
4176  v8::ScriptOrigin origin(
4177  Utils::ToLocal(scriptName),
4178  v8::Integer::New(isolate, script->line_offset()->value()),
4179  v8::Integer::New(isolate, script->column_offset()->value()));
4180  return origin;
4181  }
4182  return v8::ScriptOrigin(Handle<Value>());
4183 }
static Local< Integer > New(Isolate *isolate, int32_t value)
Definition: api.cc:6281
The origin, within a file, of a script.
Definition: v8.h:922
static Handle< Object > GetNameOrSourceURL(Handle< Script > script)
Definition: objects.cc:9697

References v8::internal::Script::GetNameOrSourceURL(), v8::Integer::New(), v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ IsBuiltin()

bool v8::Function::IsBuiltin ( ) const

Tells whether this function is builtin.

Definition at line 4209 of file api.cc.

4209  {
4211  return func->IsBuiltin();
4212 }

References v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ New()

Local< Function > v8::Function::New ( Isolate isolate,
FunctionCallback  callback,
Local< Value data = Local<Value>(),
int  length = 0 
)
static

Create a function in the current execution context for a given FunctionCallback.

Definition at line 4065 of file api.cc.

4068  {
4069  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
4070  LOG_API(isolate, "Function::New");
4071  ENTER_V8(isolate);
4072  return FunctionTemplateNew(
4073  isolate, callback, data, Local<Signature>(), length, true)->
4074  GetFunction();
4075 }
static Local< FunctionTemplate > FunctionTemplateNew(i::Isolate *isolate, FunctionCallback callback, v8::Handle< Value > data, v8::Handle< Signature > signature, int length, bool do_not_cache)
Definition: api.cc:871

References ENTER_V8, v8::FunctionTemplateNew(), and LOG_API.

+ Here is the call graph for this function:

◆ NewInstance() [1/2]

Local< v8::Object > v8::Function::NewInstance ( ) const

Definition at line 4078 of file api.cc.

4078  {
4079  return NewInstance(0, NULL);
4080 }
Local< Object > NewInstance() const
Definition: api.cc:4078
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

References NULL.

◆ NewInstance() [2/2]

Local< v8::Object > v8::Function::NewInstance ( int  argc,
Handle< Value argv[] 
) const

Definition at line 4083 of file api.cc.

4084  {
4085  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4086  ON_BAILOUT(isolate, "v8::Function::NewInstance()",
4087  return Local<v8::Object>());
4088  LOG_API(isolate, "Function::NewInstance");
4089  ENTER_V8(isolate);
4090  i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4091  EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
4093  STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
4094  i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4095  EXCEPTION_PREAMBLE(isolate);
4096  i::Handle<i::Object> returned;
4097  has_pending_exception = !i::Execution::New(
4098  function, argc, args).ToHandle(&returned);
4099  EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
4100  return scope.Escape(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
4101 }

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().

+ Here is the call graph for this function:

◆ ScriptId()

int v8::Function::ScriptId ( ) const

Returns scriptId.

Definition at line 4215 of file api.cc.

4215  {
4217  if (!func->shared()->script()->IsScript()) {
4219  }
4220  i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
4221  return script->id()->value();
4222 }
static const int kNoScriptId
Definition: v8.h:977

References v8::UnboundScript::kNoScriptId, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ SetName()

void v8::Function::SetName ( Handle< String name)

Definition at line 4125 of file api.cc.

4125  {
4126  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4127  ENTER_V8(isolate);
4128  USE(isolate);
4130  func->shared()->set_name(*Utils::OpenHandle(*name));
4131 }
void USE(T)
Definition: macros.h:322

References ENTER_V8, name, v8::Utils::OpenHandle(), and USE().

+ Here is the call graph for this function:

Member Data Documentation

◆ kLineOffsetNotFound

const int v8::Function::kLineOffsetNotFound = -1
static

Definition at line 2783 of file v8.h.

Referenced by GetScriptColumnNumber(), and GetScriptLineNumber().


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