Search for usage in LXR

#include <ExecState.h>

Inherits WTFNoncopyable::Noncopyable.

Inherited by KJS::EvalExecState, KJS::FunctionExecState, KJS::GlobalExecState, and KJS::InterpreterExecState.

Public Types

enum  HandlerType { JumpToCatch, PopScope, RemoveDeferred, Silent }

Public Member Functions

Completion abruptCompletion () const
JSObject * activationObject ()
ExecStatecallingContext ()
ExecStatecallingExecState ()
void clearException ()
CodeType codeType ()
ExecStatecontext ()
FunctionBodyNodecurrentBody ()
void deferCompletion ()
InterpreterdynamicInterpreter () const
JSValueexception () const
FunctionImpfunction () const
bool hadException () const
void initLocalStorage (LocalStorageEntry *store, size_t size)
InterpreterlexicalInterpreter () const
LocalStorageEntry * localStorage ()
void mark ()
void popExceptionHandler ()
void popScope ()
const CommonIdentifiers & propertyNames () const
void pushExceptionHandler (HandlerType type, Addr addr=0)
void pushScope (JSObject *s)
void pushVariableObjectScope (JSVariableObject *s)
void quietUnwind (int depth)
JSValuereactivateCompletion (bool insideTryFinally)
ExecStatesavedExecState ()
const ScopeChain & scopeChain () const
void setAbruptCompletion (Completion comp)
void setException (JSValue *e)
void setMachineRegisters (const unsigned char *pcBase, const unsigned char **pcLoc, LocalStorageEntry **machineLocalStoreLoc)
void setVariableObject (JSObject *v)
JSObject * thisValue () const
void updateLocalStorage (LocalStorageEntry *newStore)
JSObject * variableObject () const

Protected Member Functions

 ExecState (Interpreter *intp, ExecState *save)
void markSelf ()

Protected Attributes

CodeType m_codeType
Completion m_completion
WTF::Vector< Completion, 4 > m_deferredCompletions
WTF::Vector< ExceptionHandler, 4 > m_exceptionHandlers
LocalStorageEntry * m_localStore
size_t m_localStoreSize
LocalStorageEntry ** m_machineLocalStore
const unsigned char ** m_pc
const unsigned char * m_pcBase
CommonIdentifiers * m_propertyNames
JSObject * m_thisVal
JSObject * m_variable
ScopeChain scope

Detailed Description

Represents the current state of script execution.

This object allows you obtain a handle the interpreter that is currently executing the script, and also the current execution context.

Definition at line 53 of file ExecState.h.

Member Enumeration Documentation

◆ HandlerType

This describes how an exception should be handled.


jump to the specified address


remove a scope chain entry, and run the next handler


remove any deferred exception object, and run the next entry


just update the exception object. For debugger-type use only

Definition at line 80 of file ExecState.h.

Constructor & Destructor Documentation

◆ ExecState()

KJS::ExecState::ExecState ( Interpreter intp,
ExecState save 

The reason we need m_savedExec and can't just be content with m_callingExec is two-fold. First of all, in many cases KHTML (and ktranscript) invoke functions such as event handlers on globalExec. When that happens, we still need to be able to mark the previous call-chain. Also, it is possible for the client to call Interpreter::evaluate again; and we still need to mark things from the outside when that happens

Definition at line 97 of file ExecState.cpp.

Member Function Documentation

◆ callingExecState()

ExecState* KJS::ExecState::callingExecState ( )

Returns the context from which the current context was invoked.

For global code this will be a null context (i.e. one for which isNull() returns true). You should check isNull() on the returned value before calling any of its methods.

The calling execution context

Definition at line 228 of file ExecState.h.

◆ clearException()

void KJS::ExecState::clearException ( )

Clears the exception or other abnormal completion set on this execution state.

Definition at line 143 of file ExecState.h.

◆ deferCompletion()

void KJS::ExecState::deferCompletion ( )

The below methods deal with deferring of completions inside finally clauses.

Essentially, we clear any set exceptions and memorize any non-normal completion (including the target addresses for the continue/break statements) on the m_deferredCompletions stack. If the 'finally' finishes normally, we will resume the previous completion. If not, finally's abnormal termination is handled as usually; a RemoveDeferred cleanup stack entry is added to unwind m_deferredCompletions if that happens.

Definition at line 111 of file ExecState.h.

◆ dynamicInterpreter()

Interpreter* KJS::ExecState::dynamicInterpreter ( ) const

Returns the interpreter associated with this execution state.

The interpreter executing the script

Definition at line 64 of file ExecState.h.

◆ exception()

JSValue* KJS::ExecState::exception ( ) const

Returns the exception associated with this execution state.

The current execution state exception

Definition at line 152 of file ExecState.h.

◆ hadException()

bool KJS::ExecState::hadException ( ) const

Use this to check if an exception was thrown in the current execution state.

Whether an exception was thrown

Definition at line 163 of file ExecState.h.

◆ lexicalInterpreter()

Interpreter * KJS::ExecState::lexicalInterpreter ( ) const

Returns the interpreter associated with the current scope's global object.

The interpreter currently in scope

Definition at line 35 of file ExecState.cpp.

◆ reactivateCompletion()

JSValue * KJS::ExecState::reactivateCompletion ( bool  insideTryFinally)

This resumes dispatch of a completion that was deferred due to a try ...

finally, handling it as appropriate for whether it's inside an another try-finally. This will handle all the cases itself except for one: return, for which it will return the value to return (otherwise returning 0)

Definition at line 138 of file ExecState.cpp.

◆ savedExecState()

ExecState* KJS::ExecState::savedExecState ( )

Returns the execState of a previous nested evaluation session, if any.

Definition at line 236 of file ExecState.h.

◆ scopeChain()

const ScopeChain& KJS::ExecState::scopeChain ( ) const

Returns the scope chain for this execution context.

This is used for variable lookup, with the list being searched from start to end until a variable is found.

The execution context's scope chain

Definition at line 180 of file ExecState.h.

◆ setAbruptCompletion()

void KJS::ExecState::setAbruptCompletion ( Completion  comp)

Records an abrupt completion of code, and jumps to the closest catch or finally.

This always happens for exceptions, but can also happen for continue/break/return when they're inside try ... finally, since that case gets routed through the EH machinery.

Definition at line 178 of file ExecState.cpp.

◆ setException()

void KJS::ExecState::setException ( JSValue e)

Set the exception associated with this execution state, updating the program counter appropriately, and executing any relevant EH cleanups.

eThe JSValue of the exception being set

Definition at line 169 of file ExecState.cpp.

◆ thisValue()

JSObject* KJS::ExecState::thisValue ( ) const

Returns the "this" value for the execution context.

This is the value returned when a script references the special variable "this". It should always be an Object, unless application-specific code has passed in a different type.

The object that is used as the "this" value depends on the type of execution context - for global contexts, the global object is used. For function objewcts, the value is given by the caller (e.g. in the case of obj.func(), obj would be the "this" value). For code executed by the built-in "eval" function, the this value is the same as the calling context.

The execution context's "this" value

Definition at line 215 of file ExecState.h.

◆ variableObject()

JSObject* KJS::ExecState::variableObject ( ) const

Returns the variable object for the execution context.

This contains a property for each variable declared in the execution context.

The execution context's variable object

Definition at line 191 of file ExecState.h.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Dec 1 2023 03:59:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.