Gnash  0.8.11dev
Public Types | Public Member Functions | Friends | List of all members
gnash::CallFrame Class Reference

A CallFrame is an element of a CallStack. More...

#include <CallStack.h>

Public Types

typedef std::vector< as_valueRegisters
 

Public Member Functions

 CallFrame (UserFunction *func)
 Construct a CallFrame for a specific UserFunction. More...
 
 CallFrame (const CallFrame &other)
 Copy constructor for containers. More...
 
CallFrameoperator= (const CallFrame &other)
 Assignment operator for containers. More...
 
as_objectlocals ()
 Access the local variables for this function call. More...
 
UserFunctionfunction ()
 Get the function for which this CallFrame provides a scope. More...
 
const as_valuegetLocalRegister (size_t i) const
 Get a specific register in this CallFrame. More...
 
void setLocalRegister (size_t i, const as_value &val)
 Set a specific register in this CallFrame. More...
 
bool hasRegisters () const
 Set the number of registers for this CallFrame. More...
 
void markReachableResources () const
 Mark all reachable resources. More...
 

Friends

std::ostream & operator<< (std::ostream &, const CallFrame &)
 

Detailed Description

A CallFrame is an element of a CallStack.

A CallFrame exists for the duration of a UserFunction call. NativeFunctions have no call frame. The CallFrame provides space for local registers and local variables. These values are discarded when the CallFrame is destroyed at the end of a function call. It provides a scope for the function's execution.

Member Typedef Documentation

§ Registers

typedef std::vector<as_value> gnash::CallFrame::Registers

Constructor & Destructor Documentation

§ CallFrame() [1/2]

gnash::CallFrame::CallFrame ( UserFunction func)

Construct a CallFrame for a specific UserFunction.

Parameters
funcThe UserFunction to create the CallFrame for. This must provide information about the amount of registers to allocate.

§ CallFrame() [2/2]

gnash::CallFrame::CallFrame ( const CallFrame other)
inline

Copy constructor for containers.

Member Function Documentation

§ function()

UserFunction& gnash::CallFrame::function ( )
inline

Get the function for which this CallFrame provides a scope.

Referenced by gnash::ActionExec::ActionExec(), gnash::Function2::call(), and gnash::Function::call().

§ getLocalRegister()

const as_value* gnash::CallFrame::getLocalRegister ( size_t  i) const
inline

Get a specific register in this CallFrame.

Parameters
iThe index of the register to return.
Returns
A pointer to the value in the register or 0 if no such register exists.

References gnash::key::i, and setLocalRegister().

Referenced by gnash::VM::getRegister().

§ hasRegisters()

bool gnash::CallFrame::hasRegisters ( ) const
inline

Set the number of registers for this CallFrame.

The number of registers may only be set once! This is to ensure that pointers to the register values are always valid.

References gnash::key::c, gnash::declareLocal(), markReachableResources(), name, operator<<, and gnash::setLocal().

Referenced by gnash::VM::getRegister(), and gnash::VM::setRegister().

§ locals()

as_object& gnash::CallFrame::locals ( )
inline

Access the local variables for this function call.

Referenced by gnash::ActionExec::ActionExec(), gnash::declareLocal(), gnash::parsePath(), and gnash::setLocal().

§ markReachableResources()

void gnash::CallFrame::markReachableResources ( ) const

Mark all reachable resources.

Reachable resources would be registers and locals (expected to be empty?) and function.

References gnash::renderer::opengl::for_each(), gnash::GcResource::setReachable(), and gnash::as_value::setReachable().

Referenced by hasRegisters().

§ operator=()

CallFrame& gnash::CallFrame::operator= ( const CallFrame other)
inline

Assignment operator for containers.

§ setLocalRegister()

void gnash::CallFrame::setLocalRegister ( size_t  i,
const as_value val 
)

Set a specific register in this CallFrame.

If the register doesn't exist, nothing happens.

Parameters
iThe index of the register to set.
valThe value to set the register to.

References _, gnash::key::i, IF_VERBOSE_ACTION, and gnash::log_action().

Referenced by gnash::Function2::call(), getLocalRegister(), and gnash::VM::setRegister().

Friends And Related Function Documentation

§ operator<<

std::ostream& operator<< ( std::ostream &  ,
const CallFrame  
)
friend

Referenced by hasRegisters().


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