V8 Project
v8::UnboundScript Class Reference

A compiled JavaScript script, not yet tied to a Context. More...

#include <v8.h>

+ Collaboration diagram for v8::UnboundScript:

Public Member Functions

Local< ScriptBindToCurrentContext ()
 Binds the script to the currently entered context. More...
 
int GetId ()
 
Handle< ValueGetScriptName ()
 
Handle< ValueGetSourceURL ()
 Data read from magic sourceURL comments. More...
 
Handle< ValueGetSourceMappingURL ()
 Data read from magic sourceMappingURL comments. More...
 
int GetLineNumber (int code_pos)
 Returns zero based line number of the code_pos location in the script. More...
 

Static Public Attributes

static const int kNoScriptId = 0
 

Detailed Description

A compiled JavaScript script, not yet tied to a Context.

Definition at line 952 of file v8.h.

Member Function Documentation

◆ BindToCurrentContext()

Local< Script > v8::UnboundScript::BindToCurrentContext ( )

Binds the script to the currently entered context.

Definition at line 1583 of file api.cc.

1583  {
1587  function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate());
1588  i::Handle<i::JSFunction> function =
1589  obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo(
1590  function_info, obj->GetIsolate()->global_context());
1591  return ToApiHandle<Script>(function);
1592 }
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
Definition: api.h:288
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116

References v8::internal::Handle< T >::cast(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetId()

int v8::UnboundScript::GetId ( )

Definition at line 1595 of file api.cc.

1595  {
1598  i::Isolate* isolate = obj->GetIsolate();
1599  ON_BAILOUT(isolate, "v8::UnboundScript::GetId()", return -1);
1600  LOG_API(isolate, "v8::UnboundScript::GetId");
1601  {
1602  i::HandleScope scope(isolate);
1603  i::Handle<i::SharedFunctionInfo> function_info(
1604  i::SharedFunctionInfo::cast(*obj));
1605  i::Handle<i::Script> script(i::Script::cast(function_info->script()));
1606  return script->id()->value();
1607  }
1608 }
#define ON_BAILOUT(isolate, location, code)
Definition: api.cc:60
#define LOG_API(isolate, expr)
Definition: api.cc:52

References v8::internal::Handle< T >::cast(), LOG_API, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetLineNumber()

int v8::UnboundScript::GetLineNumber ( int  code_pos)

Returns zero based line number of the code_pos location in the script.

-1 will be returned if no information available.

Definition at line 1611 of file api.cc.

1611  {
1614  i::Isolate* isolate = obj->GetIsolate();
1615  ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1);
1616  LOG_API(isolate, "UnboundScript::GetLineNumber");
1617  if (obj->script()->IsScript()) {
1618  i::Handle<i::Script> script(i::Script::cast(obj->script()));
1619  return i::Script::GetLineNumber(script, code_pos);
1620  } else {
1621  return -1;
1622  }
1623 }
static int GetLineNumber(Handle< Script > script, int code_pos)
Definition: objects.cc:9673

References v8::internal::Handle< T >::cast(), v8::internal::Script::GetLineNumber(), LOG_API, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetScriptName()

Handle< Value > v8::UnboundScript::GetScriptName ( )

Definition at line 1626 of file api.cc.

1626  {
1629  i::Isolate* isolate = obj->GetIsolate();
1630  ON_BAILOUT(isolate, "v8::UnboundScript::GetName()",
1631  return Handle<String>());
1632  LOG_API(isolate, "UnboundScript::GetName");
1633  if (obj->script()->IsScript()) {
1634  i::Object* name = i::Script::cast(obj->script())->name();
1635  return Utils::ToLocal(i::Handle<i::Object>(name, isolate));
1636  } else {
1637  return Handle<String>();
1638  }
1639 }
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
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

References v8::internal::Handle< T >::cast(), LOG_API, name, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetSourceMappingURL()

Handle< Value > v8::UnboundScript::GetSourceMappingURL ( )

Data read from magic sourceMappingURL comments.

Definition at line 1658 of file api.cc.

1658  {
1661  i::Isolate* isolate = obj->GetIsolate();
1662  ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceMappingURL()",
1663  return Handle<String>());
1664  LOG_API(isolate, "UnboundScript::GetSourceMappingURL");
1665  if (obj->script()->IsScript()) {
1666  i::Object* url = i::Script::cast(obj->script())->source_mapping_url();
1667  return Utils::ToLocal(i::Handle<i::Object>(url, isolate));
1668  } else {
1669  return Handle<String>();
1670  }
1671 }

References v8::internal::Handle< T >::cast(), LOG_API, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetSourceURL()

Handle< Value > v8::UnboundScript::GetSourceURL ( )

Data read from magic sourceURL comments.

Definition at line 1642 of file api.cc.

1642  {
1645  i::Isolate* isolate = obj->GetIsolate();
1646  ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceURL()",
1647  return Handle<String>());
1648  LOG_API(isolate, "UnboundScript::GetSourceURL");
1649  if (obj->script()->IsScript()) {
1650  i::Object* url = i::Script::cast(obj->script())->source_url();
1651  return Utils::ToLocal(i::Handle<i::Object>(url, isolate));
1652  } else {
1653  return Handle<String>();
1654  }
1655 }

References v8::internal::Handle< T >::cast(), LOG_API, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

Member Data Documentation

◆ kNoScriptId

const int v8::UnboundScript::kNoScriptId = 0
static

Definition at line 977 of file v8.h.

Referenced by v8::internal::Heap::CreateInitialObjects(), and v8::Function::ScriptId().


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