KJS::ExecState

#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

ExecStatem_callingExec
 
CodeType m_codeType
 
Completion m_completion
 
FunctionBodyNodem_currentBody
 
WTF::Vector< Completion, 4 > m_deferredCompletions
 
WTF::Vector< ExceptionHandler, 4 > m_exceptionHandlers
 
FunctionImpm_function
 
Interpreterm_interpreter
 
LocalStorageEntry * m_localStore
 
size_t m_localStoreSize
 
LocalStorageEntry ** m_machineLocalStore
 
const unsigned char ** m_pc
 
const unsigned char * m_pcBase
 
CommonIdentifiers * m_propertyNames
 
ExecStatem_savedExec
 
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

This describes how an exception should be handled.

Enumerator
JumpToCatch 

jump to the specified address

PopScope 

remove a scope chain entry, and run the next handler

RemoveDeferred 

remove any deferred exception object, and run the next entry

Silent 

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

Definition at line 80 of file ExecState.h.

Constructor & Destructor Documentation

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

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

ExecState* KJS::ExecState::callingExecState ( )
inline

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.

Returns
The calling execution context

Definition at line 228 of file ExecState.h.

void KJS::ExecState::clearException ( )
inline

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

Definition at line 143 of file ExecState.h.

void KJS::ExecState::deferCompletion ( )
inline

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.

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

Returns the interpreter associated with this execution state.

Returns
The interpreter executing the script

Definition at line 64 of file ExecState.h.

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

Returns the exception associated with this execution state.

Returns
The current execution state exception

Definition at line 152 of file ExecState.h.

bool KJS::ExecState::hadException ( ) const
inline

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

Returns
Whether an exception was thrown

Definition at line 163 of file ExecState.h.

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

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

Returns
The interpreter currently in scope

Definition at line 35 of file ExecState.cpp.

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.

ExecState* KJS::ExecState::savedExecState ( )
inline

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

Definition at line 236 of file ExecState.h.

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

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.

Returns
The execution context's scope chain

Definition at line 180 of file ExecState.h.

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.

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.

Parameters
eThe JSValue of the exception being set

Definition at line 169 of file ExecState.cpp.

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

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.

Returns
The execution context's "this" value

Definition at line 215 of file ExecState.h.

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

Returns the variable object for the execution context.

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

Returns
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-2020 The KDE developers.
Generated on Wed Sep 23 2020 23:00:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.