V8 Project
v8::internal::StandardFrame Class Reference

#include <frames.h>

+ Inheritance diagram for v8::internal::StandardFrame:
+ Collaboration diagram for v8::internal::StandardFrame:

Public Member Functions

virtual bool is_standard () const
 
Objectcontext () const
 
ObjectGetExpression (int index) const
 
void SetExpression (int index, Object *value)
 
int ComputeExpressionsCount () const
 
virtual void SetCallerFp (Address caller_fp)
 
- Public Member Functions inherited from v8::StackFrame
int GetLineNumber () const
 Returns the number, 1-based, of the line for the associate function call. More...
 
int GetColumn () const
 Returns the 1-based column offset on the line for the associated function call. More...
 
int GetScriptId () const
 Returns the id of the script for the function for this StackFrame. More...
 
Local< StringGetScriptName () const
 Returns the name of the resource that contains the script for the function for this StackFrame. More...
 
Local< StringGetScriptNameOrSourceURL () const
 Returns the name of the resource that contains the script for the function for this StackFrame or sourceURL value if the script name is undefined and its source ends with //# sourceURL=... More...
 
Local< StringGetFunctionName () const
 Returns the name of the function associated with this stack frame. More...
 
bool IsEval () const
 Returns whether or not the associated function is compiled via a call to eval(). More...
 
bool IsConstructor () const
 Returns whether or not the associated function is called as a constructor via "new". More...
 

Static Public Member Functions

static ObjectGetExpression (Address fp, int index)
 
static StandardFramecast (StackFrame *frame)
 

Protected Member Functions

 StandardFrame (StackFrameIteratorBase *iterator)
 
virtual void ComputeCallerState (State *state) const
 
Address caller_fp () const
 
Address caller_pc () const
 
void IterateExpressions (ObjectVisitor *v) const
 
Address GetExpressionAddress (int n) const
 
bool IsExpressionInsideHandler (int n) const
 
void IterateCompiledFrame (ObjectVisitor *v) const
 

Static Protected Member Functions

static Address ComputePCAddress (Address fp)
 
static Address ComputeConstantPoolAddress (Address fp)
 
static Address GetExpressionAddress (Address fp, int n)
 
static bool IsArgumentsAdaptorFrame (Address fp)
 
static bool IsConstructFrame (Address fp)
 

Friends

class StackFrame
 
class SafeStackFrameIterator
 

Detailed Description

Definition at line 453 of file frames.h.

Constructor & Destructor Documentation

◆ StandardFrame()

v8::internal::StandardFrame::StandardFrame ( StackFrameIteratorBase iterator)
inlineexplicitprotected

Definition at line 149 of file frames-inl.h.

150  : StackFrame(iterator) {
151 }
friend class StackFrame
Definition: frames.h:515

Member Function Documentation

◆ caller_fp()

Address v8::internal::StandardFrame::caller_fp ( ) const
inlineprotected

Definition at line 170 of file frames-inl.h.

170  {
172 }
static Address & Address_at(Address addr)
Definition: v8memory.h:56
static const int kCallerFPOffset
Definition: frames.h:165
const Register fp

References v8::internal::Memory::Address_at(), v8::internal::fp, and v8::internal::StandardFrameConstants::kCallerFPOffset.

Referenced by ComputeCallerState(), v8::internal::JavaScriptFrame::GetArgumentsLength(), v8::internal::JavaScriptFrame::has_adapted_arguments(), v8::internal::JavaScriptFrame::IsConstructor(), and SetCallerFp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ caller_pc()

Address v8::internal::StandardFrame::caller_pc ( ) const
inlineprotected

Definition at line 175 of file frames-inl.h.

175  {
177 }
static Address ComputePCAddress(Address fp)
Definition: frames-inl.h:180

References v8::internal::Memory::Address_at(), ComputePCAddress(), and v8::internal::fp.

+ Here is the call graph for this function:

◆ cast()

static StandardFrame* v8::internal::StandardFrame::cast ( StackFrame frame)
inlinestatic

Definition at line 469 of file frames.h.

469  {
470  DCHECK(frame->is_standard());
471  return static_cast<StandardFrame*>(frame);
472  }
StandardFrame(StackFrameIteratorBase *iterator)
Definition: frames-inl.h:149
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK.

◆ ComputeCallerState()

void v8::internal::StandardFrame::ComputeCallerState ( State state) const
protectedvirtual

Definition at line 591 of file frames.cc.

591  {
592  state->sp = caller_sp();
593  state->fp = caller_fp();
594  state->pc_address = ResolveReturnAddressLocation(
595  reinterpret_cast<Address*>(ComputePCAddress(fp())));
596  state->constant_pool_address =
597  reinterpret_cast<Address*>(ComputeConstantPoolAddress(fp()));
598 }
static Address ComputeConstantPoolAddress(Address fp)
Definition: frames-inl.h:185
Address caller_fp() const
Definition: frames-inl.h:170
byte * Address
Definition: globals.h:101

References caller_fp(), ComputeConstantPoolAddress(), ComputePCAddress(), and v8::internal::fp.

+ Here is the call graph for this function:

◆ ComputeConstantPoolAddress()

Address v8::internal::StandardFrame::ComputeConstantPoolAddress ( Address  fp)
inlinestaticprotected

Definition at line 185 of file frames-inl.h.

185  {
187 }
static const int kConstantPoolOffset
Definition: frames.h:163

References v8::internal::fp, and v8::internal::StandardFrameConstants::kConstantPoolOffset.

Referenced by ComputeCallerState().

+ Here is the caller graph for this function:

◆ ComputeExpressionsCount()

int v8::internal::StandardFrame::ComputeExpressionsCount ( ) const

Definition at line 580 of file frames.cc.

580  {
581  const int offset =
583  Address base = fp() + offset;
584  Address limit = sp();
585  DCHECK(base >= limit); // stack grows downwards
586  // Include register-allocated locals in number of expressions.
587  return static_cast<int>((base - limit) / kPointerSize);
588 }
static const int kExpressionsOffset
Definition: frames.h:160
const int kPointerSize
Definition: globals.h:129
const Register sp

References DCHECK, v8::internal::fp, v8::internal::StandardFrameConstants::kExpressionsOffset, v8::internal::kPointerSize, and v8::internal::sp.

Referenced by v8::internal::Debug::PrepareStep(), and v8::internal::JavaScriptFrame::Print().

+ Here is the caller graph for this function:

◆ ComputePCAddress()

Address v8::internal::StandardFrame::ComputePCAddress ( Address  fp)
inlinestaticprotected

Definition at line 180 of file frames-inl.h.

180  {
182 }
static const int kCallerPCOffset
Definition: frames.h:166

References v8::internal::fp, and v8::internal::StandardFrameConstants::kCallerPCOffset.

Referenced by caller_pc(), ComputeCallerState(), and v8::internal::SafeStackFrameIterator::SafeStackFrameIterator().

+ Here is the caller graph for this function:

◆ context()

Object * v8::internal::StandardFrame::context ( ) const
inline

Definition at line 164 of file frames-inl.h.

164  {
165  const int offset = StandardFrameConstants::kContextOffset;
166  return Memory::Object_at(fp() + offset);
167 }
static Object *& Object_at(Address addr)
Definition: v8memory.h:60
static const int kContextOffset
Definition: frames.h:162

References v8::internal::fp, v8::internal::StandardFrameConstants::kContextOffset, and v8::internal::Memory::Object_at().

Referenced by v8::internal::Isolate::GetCallingNativeContext(), v8::internal::FrameInspector::GetContext(), v8::internal::MaterializeLocalContext(), v8::internal::JavaScriptFrame::Print(), v8::internal::RUNTIME_FUNCTION(), and v8::internal::SetLocalVariableValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetExpression() [1/2]

Object * v8::internal::StandardFrame::GetExpression ( Address  fp,
int  index 
)
static

Definition at line 569 of file frames.cc.

569  {
570  return Memory::Object_at(GetExpressionAddress(fp, index));
571 }
Address GetExpressionAddress(int n) const
Definition: frames.cc:563

References v8::internal::fp, GetExpressionAddress(), and v8::internal::Memory::Object_at().

+ Here is the call graph for this function:

◆ GetExpression() [2/2]

Object * v8::internal::StandardFrame::GetExpression ( int  index) const
inline

Definition at line 154 of file frames-inl.h.

154  {
156 }

References GetExpressionAddress(), and v8::internal::Memory::Object_at().

Referenced by v8::internal::JavaScriptFrame::GetArgumentsLength(), v8::internal::FrameInspector::GetExpression(), v8::internal::GetFunctionArguments(), v8::internal::ArgumentsAdaptorFrame::GetNumberOfIncomingArguments(), v8::internal::AstTyper::ObserveTypesAtOsrEntry(), v8::internal::Debug::PrepareStep(), v8::internal::JavaScriptFrame::Print(), v8::internal::OptimizedFrame::Summarize(), and v8::internal::UpdateStackLocalsFromMaterializedObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetExpressionAddress() [1/2]

Address v8::internal::StandardFrame::GetExpressionAddress ( Address  fp,
int  n 
)
staticprotected

Definition at line 574 of file frames.cc.

574  {
576  return fp + offset - n * kPointerSize;
577 }

References v8::internal::fp, v8::internal::StandardFrameConstants::kExpressionsOffset, and v8::internal::kPointerSize.

◆ GetExpressionAddress() [2/2]

Address v8::internal::StandardFrame::GetExpressionAddress ( int  n) const
protected

Definition at line 563 of file frames.cc.

563  {
565  return fp() + offset - n * kPointerSize;
566 }

References v8::internal::fp, v8::internal::StandardFrameConstants::kExpressionsOffset, and v8::internal::kPointerSize.

Referenced by GetExpression(), IsExpressionInsideHandler(), and SetExpression().

+ Here is the caller graph for this function:

◆ is_standard()

virtual bool v8::internal::StandardFrame::is_standard ( ) const
inlinevirtual

Definition at line 456 of file frames.h.

456 { return true; }

◆ IsArgumentsAdaptorFrame()

bool v8::internal::StandardFrame::IsArgumentsAdaptorFrame ( Address  fp)
inlinestaticprotected

Definition at line 190 of file frames-inl.h.

190  {
191  Object* marker =
194 }
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References v8::internal::compiler::ARGUMENTS_ADAPTOR, v8::internal::fp, v8::internal::Smi::FromInt(), v8::internal::StandardFrameConstants::kContextOffset, and v8::internal::Memory::Object_at().

Referenced by v8::internal::JavaScriptFrame::has_adapted_arguments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsConstructFrame()

bool v8::internal::StandardFrame::IsConstructFrame ( Address  fp)
inlinestaticprotected

Definition at line 197 of file frames-inl.h.

197  {
198  Object* marker =
200  return marker == Smi::FromInt(StackFrame::CONSTRUCT);
201 }
static const int kMarkerOffset
Definition: frames.h:161

References v8::internal::fp, v8::internal::Smi::FromInt(), v8::internal::StandardFrameConstants::kMarkerOffset, and v8::internal::Memory::Object_at().

Referenced by v8::internal::JavaScriptFrame::IsConstructor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsExpressionInsideHandler()

bool v8::internal::StandardFrame::IsExpressionInsideHandler ( int  n) const
protected

Definition at line 607 of file frames.cc.

607  {
608  Address address = GetExpressionAddress(n);
609  for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) {
610  if (it.handler()->includes(address)) return true;
611  }
612  return false;
613 }

References GetExpressionAddress().

Referenced by v8::internal::JavaScriptFrame::Print().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IterateCompiledFrame()

void v8::internal::StandardFrame::IterateCompiledFrame ( ObjectVisitor v) const
protected

Definition at line 616 of file frames.cc.

616  {
617  // Make sure that we're not doing "safe" stack frame iteration. We cannot
618  // possibly find pointers in optimized frames in that state.
619  DCHECK(can_access_heap_objects());
620 
621  // Compute the safepoint information.
622  unsigned stack_slots = 0;
623  SafepointEntry safepoint_entry;
624  Code* code = StackFrame::GetSafepointData(
625  isolate(), pc(), &safepoint_entry, &stack_slots);
626  unsigned slot_space = stack_slots * kPointerSize;
627 
628  // Visit the outgoing parameters.
629  Object** parameters_base = &Memory::Object_at(sp());
630  Object** parameters_limit = &Memory::Object_at(
632 
633  // Visit the parameters that may be on top of the saved registers.
634  if (safepoint_entry.argument_count() > 0) {
635  v->VisitPointers(parameters_base,
636  parameters_base + safepoint_entry.argument_count());
637  parameters_base += safepoint_entry.argument_count();
638  }
639 
640  // Skip saved double registers.
641  if (safepoint_entry.has_doubles()) {
642  // Number of doubles not known at snapshot time.
643  DCHECK(!isolate()->serializer_enabled());
644  parameters_base += DoubleRegister::NumAllocatableRegisters() *
646  }
647 
648  // Visit the registers that contain pointers if any.
649  if (safepoint_entry.HasRegisters()) {
650  for (int i = kNumSafepointRegisters - 1; i >=0; i--) {
651  if (safepoint_entry.HasRegisterAt(i)) {
652  int reg_stack_index = MacroAssembler::SafepointRegisterStackIndex(i);
653  v->VisitPointer(parameters_base + reg_stack_index);
654  }
655  }
656  // Skip the words containing the register values.
657  parameters_base += kNumSafepointRegisters;
658  }
659 
660  // We're done dealing with the register bits.
661  uint8_t* safepoint_bits = safepoint_entry.bits();
662  safepoint_bits += kNumSafepointRegisters >> kBitsPerByteLog2;
663 
664  // Visit the rest of the parameters.
665  v->VisitPointers(parameters_base, parameters_limit);
666 
667  // Visit pointer spill slots and locals.
668  for (unsigned index = 0; index < stack_slots; index++) {
669  int byte_index = index >> kBitsPerByteLog2;
670  int bit_index = index & (kBitsPerByte - 1);
671  if ((safepoint_bits[byte_index] & (1U << bit_index)) != 0) {
672  v->VisitPointer(parameters_limit + index);
673  }
674  }
675 
676  // Visit the return address in the callee and incoming arguments.
677  IteratePc(v, pc_address(), code);
678 
679  // Visit the context in stub frame and JavaScript frame.
680  // Visit the function in JavaScript frame.
681  Object** fixed_base = &Memory::Object_at(
683  Object** fixed_limit = &Memory::Object_at(fp());
684  v->VisitPointers(fixed_base, fixed_limit);
685 }
static int SafepointRegisterStackIndex(int reg_code)
const int kNumSafepointRegisters
Definition: frames-arm.h:67
const int kDoubleSize
Definition: globals.h:127
const Register pc
const int kBitsPerByteLog2
Definition: globals.h:163
const int kBitsPerByte
Definition: globals.h:162

References DCHECK, v8::internal::fp, v8::internal::kBitsPerByte, v8::internal::kBitsPerByteLog2, v8::internal::kDoubleSize, v8::internal::JavaScriptFrameConstants::kFunctionOffset, v8::internal::StandardFrameConstants::kMarkerOffset, v8::internal::kNumSafepointRegisters, v8::internal::kPointerSize, v8::internal::DwVfpRegister::NumAllocatableRegisters(), v8::internal::Memory::Object_at(), v8::internal::pc, v8::internal::MacroAssembler::SafepointRegisterStackIndex(), and v8::internal::sp.

Referenced by v8::internal::StubFrame::Iterate(), and v8::internal::OptimizedFrame::Iterate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IterateExpressions()

void v8::internal::StandardFrame::IterateExpressions ( ObjectVisitor v) const
protected

Definition at line 1349 of file frames.cc.

1349  {
1350  const int offset = StandardFrameConstants::kLastObjectOffset;
1351  Object** base = &Memory::Object_at(sp());
1352  Object** limit = &Memory::Object_at(fp() + offset) + 1;
1353  for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) {
1354  StackHandler* handler = it.handler();
1355  // Traverse pointers down to - but not including - the next
1356  // handler in the handler chain. Update the base to skip the
1357  // handler and allow the handler to traverse its own pointers.
1358  const Address address = handler->address();
1359  v->VisitPointers(base, reinterpret_cast<Object**>(address));
1360  base = reinterpret_cast<Object**>(address + StackHandlerConstants::kSize);
1361  // Traverse the pointers in the handler itself.
1362  handler->Iterate(v, LookupCode());
1363  }
1364  v->VisitPointers(base, limit);
1365 }
static const int kLastObjectOffset
Definition: frames.h:169

References v8::internal::fp, v8::internal::StandardFrameConstants::kLastObjectOffset, v8::internal::StackHandlerConstants::kSize, v8::internal::Memory::Object_at(), and v8::internal::sp.

Referenced by v8::internal::JavaScriptFrame::Iterate(), and v8::internal::InternalFrame::Iterate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCallerFp()

void v8::internal::StandardFrame::SetCallerFp ( Address  caller_fp)
virtual

Definition at line 601 of file frames.cc.

References v8::internal::Memory::Address_at(), caller_fp(), v8::internal::fp, and v8::internal::StandardFrameConstants::kCallerFPOffset.

+ Here is the call graph for this function:

◆ SetExpression()

void v8::internal::StandardFrame::SetExpression ( int  index,
Object value 
)
inline

Definition at line 159 of file frames-inl.h.

159  {
160  Memory::Object_at(GetExpressionAddress(index)) = value;
161 }

References GetExpressionAddress(), and v8::internal::Memory::Object_at().

Referenced by v8::internal::SetLocalVariableValue(), and v8::internal::UpdateStackLocalsFromMaterializedObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ SafeStackFrameIterator

friend class SafeStackFrameIterator
friend

Definition at line 516 of file frames.h.

◆ StackFrame

friend class StackFrame
friend

Definition at line 515 of file frames.h.


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