V8 Project
v8::internal::JavaScriptFrame Class Reference

#include <frames.h>

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

Public Member Functions

virtual Type type () const
 
JSFunctionfunction () const
 
Objectreceiver () const
 
void set_receiver (Object *value)
 
Address GetParameterSlot (int index) const
 
ObjectGetParameter (int index) const
 
int ComputeParametersCount () const
 
Address GetOperandSlot (int index) const
 
ObjectGetOperand (int index) const
 
int ComputeOperandsCount () const
 
void SaveOperandStack (FixedArray *store, int *stack_handler_index) const
 
void RestoreOperandStack (FixedArray *store, int stack_handler_index)
 
void SetParameterValue (int index, Object *value) const
 
bool IsConstructor () const
 
bool has_adapted_arguments () const
 
int GetArgumentsLength () const
 
virtual void Iterate (ObjectVisitor *v) const
 
virtual void Print (StringStream *accumulator, PrintMode mode, int index) const
 
virtual Codeunchecked_code () const
 
virtual int GetInlineCount ()
 
virtual void GetFunctions (List< JSFunction * > *functions)
 
virtual void Summarize (List< FrameSummary > *frames)
 
- Public Member Functions inherited from v8::internal::StandardFrame
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 Register fp_register ()
 
static Register context_register ()
 
static Register constant_pool_pointer_register ()
 
static JavaScriptFramecast (StackFrame *frame)
 
static void PrintFunctionAndOffset (JSFunction *function, Code *code, Address pc, FILE *file, bool print_line_number)
 
static void PrintTop (Isolate *isolate, FILE *file, bool print_args, bool print_line_number)
 
- Static Public Member Functions inherited from v8::internal::StandardFrame
static ObjectGetExpression (Address fp, int index)
 
static StandardFramecast (StackFrame *frame)
 

Protected Member Functions

 JavaScriptFrame (StackFrameIteratorBase *iterator)
 
virtual Address GetCallerStackPointer () const
 
virtual int GetNumberOfIncomingArguments () const
 
void IterateArguments (ObjectVisitor *v) const
 
- Protected Member Functions inherited from v8::internal::StandardFrame
 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
 

Private Member Functions

Objectfunction_slot_object () const
 

Friends

class StackFrameIteratorBase
 

Additional Inherited Members

- Static Protected Member Functions inherited from v8::internal::StandardFrame
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)
 

Detailed Description

Definition at line 550 of file frames.h.

Constructor & Destructor Documentation

◆ JavaScriptFrame()

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

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

205  : StandardFrame(iterator) {
206 }
StandardFrame(StackFrameIteratorBase *iterator)
Definition: frames-inl.h:149

Member Function Documentation

◆ cast()

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

Definition at line 612 of file frames.h.

612  {
613  DCHECK(frame->is_java_script());
614  return static_cast<JavaScriptFrame*>(frame);
615  }
JavaScriptFrame(StackFrameIteratorBase *iterator)
Definition: frames-inl.h:204
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK.

Referenced by v8::internal::CheckActivation(), v8::internal::DropActivationsInActiveThreadImpl(), and v8::internal::IC::GetSharedFunctionInfo().

+ Here is the caller graph for this function:

◆ ComputeOperandsCount()

int v8::internal::JavaScriptFrame::ComputeOperandsCount ( ) const
inline

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

238  {
240  // Base points to low address of first operand and stack grows down, so add
241  // kPointerSize to get the actual stack size.
242  intptr_t stack_size_in_bytes = (base + kPointerSize) - sp();
243  DCHECK(IsAligned(stack_size_in_bytes, kPointerSize));
244  DCHECK(type() == JAVA_SCRIPT);
245  DCHECK(stack_size_in_bytes >= 0);
246  return static_cast<int>(stack_size_in_bytes >> kPointerSizeLog2);
247 }
virtual Type type() const
Definition: frames.h:552
const int kPointerSize
Definition: globals.h:129
const Register fp
const Register sp
const int kPointerSizeLog2
Definition: globals.h:147
byte * Address
Definition: globals.h:101
bool IsAligned(T value, U alignment)
Definition: utils.h:123

References DCHECK, v8::internal::fp, v8::internal::IsAligned(), v8::internal::JavaScriptFrameConstants::kLocal0Offset, v8::internal::kPointerSize, v8::internal::kPointerSizeLog2, v8::internal::sp, and type().

Referenced by GetOperandSlot(), RestoreOperandStack(), v8::internal::RUNTIME_FUNCTION(), and SaveOperandStack().

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

◆ ComputeParametersCount()

int v8::internal::JavaScriptFrame::ComputeParametersCount ( ) const
inline

Definition at line 562 of file frames.h.

562  {
564  }
virtual int GetNumberOfIncomingArguments() const
Definition: frames.cc:749

Referenced by v8::internal::GetCallerArguments(), v8::internal::GetFunctionArguments(), v8::internal::FrameInspector::GetParametersCount(), GetParameterSlot(), Print(), v8::internal::ArgumentsAdaptorFrame::Print(), PrintTop(), v8::internal::RUNTIME_FUNCTION(), and v8::internal::OptimizedFrame::Summarize().

+ Here is the caller graph for this function:

◆ constant_pool_pointer_register()

static Register v8::internal::JavaScriptFrame::constant_pool_pointer_register ( )
static

Referenced by v8::internal::Deoptimizer::DoComputeJSFrame().

+ Here is the caller graph for this function:

◆ context_register()

static Register v8::internal::JavaScriptFrame::context_register ( )
static

Referenced by v8::internal::Deoptimizer::DoComputeJSFrame().

+ Here is the caller graph for this function:

◆ fp_register()

static Register v8::internal::JavaScriptFrame::fp_register ( )
static

Referenced by v8::internal::Deoptimizer::DoComputeJSFrame(), and v8::internal::Deoptimizer::DoComputeOutputFrames().

+ Here is the caller graph for this function:

◆ function()

JSFunction * v8::internal::JavaScriptFrame::function ( ) const
inline

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

265  {
266  return JSFunction::cast(function_slot_object());
267 }
Object * function_slot_object() const
Definition: frames-arm.h:149

References function_slot_object().

Referenced by v8::internal::AllocationTracker::AllocationEvent(), v8::internal::Debug::Break(), v8::internal::CheckActivation(), v8::internal::CollectActiveFunctionsFromThread(), v8::internal::Isolate::ComputeLocation(), v8::internal::Deoptimizer::DebuggerInspectableFrame(), v8::internal::DropActivationsInActiveThreadImpl(), v8::internal::Debug::FloodHandlerWithOneShot(), v8::internal::FrameInspector::GetFunction(), v8::internal::IC::GetSharedFunctionInfo(), v8::internal::Debug::IsBreakAtReturn(), v8::internal::IsSuitableForOnStackReplacement(), v8::internal::Deoptimizer::MaterializeHeapObjects(), v8::internal::AstTyper::ObserveTypesAtOsrEntry(), v8::internal::RuntimeProfiler::OptimizeNow(), v8::internal::Debug::PrepareStep(), v8::internal::Isolate::PrintCurrentStackTrace(), PrintFunctionAndOffset(), PrintTop(), v8::internal::RedirectActivationsToRecompiledCodeOnThread(), v8::internal::RUNTIME_FUNCTION(), v8::internal::Debug::SetAfterBreakTarget(), v8::internal::SetLocalVariableValue(), and v8::internal::OptimizedFrame::Summarize().

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

◆ function_slot_object()

Object * v8::internal::JavaScriptFrame::function_slot_object ( ) const
inlineprivate

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

149  {
151  return Memory::Object_at(fp() + offset);
152 }
static Object *& Object_at(Address addr)
Definition: v8memory.h:60

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

Referenced by function().

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

◆ GetArgumentsLength()

int v8::internal::JavaScriptFrame::GetArgumentsLength ( ) const

Definition at line 734 of file frames.cc.

734  {
735  // If there is an arguments adaptor frame get the arguments length from it.
736  if (has_adapted_arguments()) {
737  return Smi::cast(GetExpression(caller_fp(), 0))->value();
738  } else {
740  }
741 }
bool has_adapted_arguments() const
Definition: frames-inl.h:260
Address caller_fp() const
Definition: frames-inl.h:170
Object * GetExpression(int index) const
Definition: frames-inl.h:154

References v8::internal::StandardFrame::caller_fp(), v8::internal::StandardFrame::GetExpression(), GetNumberOfIncomingArguments(), and has_adapted_arguments().

Referenced by v8::internal::RUNTIME_FUNCTION().

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

◆ GetCallerStackPointer()

Address v8::internal::JavaScriptFrame::GetCallerStackPointer ( ) const
protectedvirtual

Reimplemented in v8::internal::ArgumentsAdaptorFrame.

Definition at line 757 of file frames.cc.

757  {
759 }
static const int kCallerSPOffset
Definition: frames.h:167

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

◆ GetFunctions()

void v8::internal::JavaScriptFrame::GetFunctions ( List< JSFunction * > *  functions)
virtual

Reimplemented in v8::internal::OptimizedFrame.

Definition at line 762 of file frames.cc.

762  {
763  DCHECK(functions->length() == 0);
764  functions->Add(function());
765 }

References v8::internal::List< T, AllocationPolicy >::Add(), and DCHECK.

Referenced by v8::internal::CollectActiveFunctionsFromThread(), v8::internal::FindFunctionInFrame(), v8::internal::GetCallerArguments(), v8::internal::FrameFunctionIterator::GetFunctions(), v8::internal::OptimizedFrame::GetFunctions(), and v8::internal::RuntimeProfiler::OptimizeNow().

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

◆ GetInlineCount()

virtual int v8::internal::JavaScriptFrame::GetInlineCount ( )
inlinevirtual

Reimplemented in v8::internal::OptimizedFrame.

Definition at line 599 of file frames.h.

599 { return 1; }

Referenced by v8::internal::OptimizedFrame::GetInlineCount().

+ Here is the caller graph for this function:

◆ GetNumberOfIncomingArguments()

int v8::internal::JavaScriptFrame::GetNumberOfIncomingArguments ( ) const
protectedvirtual

Reimplemented in v8::internal::ArgumentsAdaptorFrame.

Definition at line 749 of file frames.cc.

749  {
750  DCHECK(can_access_heap_objects() &&
751  isolate()->heap()->gc_state() == Heap::NOT_IN_GC);
752 
753  return function()->shared()->formal_parameter_count();
754 }

References DCHECK, and v8::internal::Heap::NOT_IN_GC.

Referenced by GetArgumentsLength().

+ Here is the caller graph for this function:

◆ GetOperand()

Object * v8::internal::JavaScriptFrame::GetOperand ( int  index) const
inline

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

233  {
234  return Memory::Object_at(GetOperandSlot(index));
235 }
Address GetOperandSlot(int index) const
Definition: frames-inl.h:222

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

Referenced by RestoreOperandStack(), and SaveOperandStack().

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

◆ GetOperandSlot()

Address v8::internal::JavaScriptFrame::GetOperandSlot ( int  index) const
inline

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

222  {
225  DCHECK_EQ(type(), JAVA_SCRIPT);
227  DCHECK_LE(0, index);
228  // Operand stack grows down.
229  return base - index * kPointerSize;
230 }
#define DCHECK_LE(v1, v2)
Definition: logging.h:210
#define DCHECK_LT(v1, v2)
Definition: logging.h:209
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
bool IsAddressAligned(Address addr, intptr_t alignment, int offset=0)
Definition: utils.h:129

References ComputeOperandsCount(), DCHECK, DCHECK_EQ, DCHECK_LE, DCHECK_LT, v8::internal::fp, v8::internal::IsAddressAligned(), v8::internal::JavaScriptFrameConstants::kLocal0Offset, v8::internal::kPointerSize, and type().

Referenced by GetOperand(), RestoreOperandStack(), and SaveOperandStack().

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

◆ GetParameter()

Object * v8::internal::JavaScriptFrame::GetParameter ( int  index) const
inline

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

217  {
218  return Memory::Object_at(GetParameterSlot(index));
219 }
Address GetParameterSlot(int index) const
Definition: frames-inl.h:209

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

Referenced by v8::internal::GetCallerArguments(), v8::internal::GetFunctionArguments(), v8::internal::FrameInspector::GetParameter(), v8::internal::AstTyper::ObserveTypesAtOsrEntry(), Print(), v8::internal::ArgumentsAdaptorFrame::Print(), PrintTop(), receiver(), v8::internal::RUNTIME_FUNCTION(), v8::internal::OptimizedFrame::Summarize(), and v8::internal::UpdateStackLocalsFromMaterializedObject().

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

◆ GetParameterSlot()

Address v8::internal::JavaScriptFrame::GetParameterSlot ( int  index) const
inline

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

209  {
210  int param_count = ComputeParametersCount();
211  DCHECK(-1 <= index && index < param_count);
212  int parameter_offset = (param_count - index - 1) * kPointerSize;
213  return caller_sp() + parameter_offset;
214 }
int ComputeParametersCount() const
Definition: frames.h:562

References ComputeParametersCount(), DCHECK, and v8::internal::kPointerSize.

Referenced by GetParameter(), v8::internal::RUNTIME_FUNCTION(), set_receiver(), and SetParameterValue().

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

◆ has_adapted_arguments()

bool v8::internal::JavaScriptFrame::has_adapted_arguments ( ) const
inline

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

260  {
262 }
static bool IsArgumentsAdaptorFrame(Address fp)
Definition: frames-inl.h:190

References v8::internal::StandardFrame::caller_fp(), and v8::internal::StandardFrame::IsArgumentsAdaptorFrame().

Referenced by v8::internal::FrameInspector::FrameInspector(), GetArgumentsLength(), IsConstructor(), and v8::internal::Deoptimizer::MaterializeHeapObjects().

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

◆ IsConstructor()

bool v8::internal::JavaScriptFrame::IsConstructor ( ) const

Definition at line 724 of file frames.cc.

724  {
725  Address fp = caller_fp();
726  if (has_adapted_arguments()) {
727  // Skip the arguments adaptor frame and look at the real caller.
729  }
730  return IsConstructFrame(fp);
731 }
static Address & Address_at(Address addr)
Definition: v8memory.h:56
static const int kCallerFPOffset
Definition: frames.h:165
static bool IsConstructFrame(Address fp)
Definition: frames-inl.h:197

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

Referenced by v8::internal::FrameInspector::IsConstructor(), Print(), PrintTop(), v8::internal::RUNTIME_FUNCTION(), Summarize(), and v8::internal::OptimizedFrame::Summarize().

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

◆ Iterate()

void v8::internal::JavaScriptFrame::Iterate ( ObjectVisitor v) const
virtual

Reimplemented in v8::internal::OptimizedFrame.

Definition at line 1368 of file frames.cc.

1368  {
1369  IterateExpressions(v);
1370  IteratePc(v, pc_address(), LookupCode());
1371 }
void IterateExpressions(ObjectVisitor *v) const
Definition: frames.cc:1349

References v8::internal::StandardFrame::IterateExpressions().

+ Here is the call graph for this function:

◆ IterateArguments()

void v8::internal::JavaScriptFrame::IterateArguments ( ObjectVisitor v) const
protected

◆ Print()

void v8::internal::JavaScriptFrame::Print ( StringStream *  accumulator,
PrintMode  mode,
int  index 
) const
virtual

Reimplemented in v8::internal::ArgumentsAdaptorFrame.

Definition at line 1159 of file frames.cc.

1161  {
1162  DisallowHeapAllocation no_gc;
1163  Object* receiver = this->receiver();
1164  JSFunction* function = this->function();
1165 
1166  accumulator->PrintSecurityTokenIfChanged(function);
1167  PrintIndex(accumulator, mode, index);
1168  Code* code = NULL;
1169  if (IsConstructor()) accumulator->Add("new ");
1170  accumulator->PrintFunction(function, receiver, &code);
1171 
1172  // Get scope information for nicer output, if possible. If code is NULL, or
1173  // doesn't contain scope info, scope_info will return 0 for the number of
1174  // parameters, stack local variables, context local variables, stack slots,
1175  // or context slots.
1176  SharedFunctionInfo* shared = function->shared();
1177  ScopeInfo* scope_info = shared->scope_info();
1178  Object* script_obj = shared->script();
1179  if (script_obj->IsScript()) {
1180  Script* script = Script::cast(script_obj);
1181  accumulator->Add(" [");
1182  accumulator->PrintName(script->name());
1183 
1184  Address pc = this->pc();
1185  if (code != NULL && code->kind() == Code::FUNCTION &&
1186  pc >= code->instruction_start() && pc < code->instruction_end()) {
1187  int source_pos = code->SourcePosition(pc);
1188  int line = script->GetLineNumber(source_pos) + 1;
1189  accumulator->Add(":%d", line);
1190  } else {
1191  int function_start_pos = shared->start_position();
1192  int line = script->GetLineNumber(function_start_pos) + 1;
1193  accumulator->Add(":~%d", line);
1194  }
1195 
1196  accumulator->Add("] ");
1197  }
1198 
1199  accumulator->Add("(this=%o", receiver);
1200 
1201  // Print the parameters.
1202  int parameters_count = ComputeParametersCount();
1203  for (int i = 0; i < parameters_count; i++) {
1204  accumulator->Add(",");
1205  // If we have a name for the parameter we print it. Nameless
1206  // parameters are either because we have more actual parameters
1207  // than formal parameters or because we have no scope information.
1208  if (i < scope_info->ParameterCount()) {
1209  accumulator->PrintName(scope_info->ParameterName(i));
1210  accumulator->Add("=");
1211  }
1212  accumulator->Add("%o", GetParameter(i));
1213  }
1214 
1215  accumulator->Add(")");
1216  if (mode == OVERVIEW) {
1217  accumulator->Add("\n");
1218  return;
1219  }
1220  if (is_optimized()) {
1221  accumulator->Add(" {\n// optimized frame\n}\n");
1222  return;
1223  }
1224  accumulator->Add(" {\n");
1225 
1226  // Compute the number of locals and expression stack elements.
1227  int stack_locals_count = scope_info->StackLocalCount();
1228  int heap_locals_count = scope_info->ContextLocalCount();
1229  int expressions_count = ComputeExpressionsCount();
1230 
1231  // Print stack-allocated local variables.
1232  if (stack_locals_count > 0) {
1233  accumulator->Add(" // stack-allocated locals\n");
1234  }
1235  for (int i = 0; i < stack_locals_count; i++) {
1236  accumulator->Add(" var ");
1237  accumulator->PrintName(scope_info->StackLocalName(i));
1238  accumulator->Add(" = ");
1239  if (i < expressions_count) {
1240  accumulator->Add("%o", GetExpression(i));
1241  } else {
1242  accumulator->Add("// no expression found - inconsistent frame?");
1243  }
1244  accumulator->Add("\n");
1245  }
1246 
1247  // Try to get hold of the context of this frame.
1248  Context* context = NULL;
1249  if (this->context() != NULL && this->context()->IsContext()) {
1250  context = Context::cast(this->context());
1251  }
1252  while (context->IsWithContext()) {
1253  context = context->previous();
1254  DCHECK(context != NULL);
1255  }
1256 
1257  // Print heap-allocated local variables.
1258  if (heap_locals_count > 0) {
1259  accumulator->Add(" // heap-allocated locals\n");
1260  }
1261  for (int i = 0; i < heap_locals_count; i++) {
1262  accumulator->Add(" var ");
1263  accumulator->PrintName(scope_info->ContextLocalName(i));
1264  accumulator->Add(" = ");
1265  if (context != NULL) {
1266  int index = Context::MIN_CONTEXT_SLOTS + i;
1267  if (index < context->length()) {
1268  accumulator->Add("%o", context->get(index));
1269  } else {
1270  accumulator->Add(
1271  "// warning: missing context slot - inconsistent frame?");
1272  }
1273  } else {
1274  accumulator->Add("// warning: no context found - inconsistent frame?");
1275  }
1276  accumulator->Add("\n");
1277  }
1278 
1279  // Print the expression stack.
1280  int expressions_start = stack_locals_count;
1281  if (expressions_start < expressions_count) {
1282  accumulator->Add(" // expression stack (top to bottom)\n");
1283  }
1284  for (int i = expressions_count - 1; i >= expressions_start; i--) {
1285  if (IsExpressionInsideHandler(i)) continue;
1286  accumulator->Add(" [%02d] : %o\n", i, GetExpression(i));
1287  }
1288 
1289  // Print details about the function.
1290  if (FLAG_max_stack_trace_source_length != 0 && code != NULL) {
1291  OStringStream os;
1292  SharedFunctionInfo* shared = function->shared();
1293  os << "--------- s o u r c e c o d e ---------\n"
1294  << SourceCodeOf(shared, FLAG_max_stack_trace_source_length)
1295  << "\n-----------------------------------------\n";
1296  accumulator->Add(os.c_str());
1297  }
1298 
1299  accumulator->Add("}\n\n");
1300 }
static Context * cast(Object *context)
Definition: contexts.h:255
Object * receiver() const
Definition: frames-inl.h:250
bool IsConstructor() const
Definition: frames.cc:724
Object * GetParameter(int index) const
Definition: frames-inl.h:217
Object * context() const
Definition: frames-inl.h:164
bool IsExpressionInsideHandler(int n) const
Definition: frames.cc:607
int ComputeExpressionsCount() const
Definition: frames.cc:580
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
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 NULL
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110
kSerializedDataOffset Object
Definition: objects-inl.h:5322
const Register pc

References v8::internal::OStringStream::c_str(), v8::internal::Context::cast(), v8::internal::StandardFrame::ComputeExpressionsCount(), ComputeParametersCount(), v8::internal::StandardFrame::context(), v8::internal::ScopeInfo::ContextLocalName(), DCHECK, v8::internal::StandardFrame::GetExpression(), v8::internal::Script::GetLineNumber(), GetParameter(), v8::internal::Code::instruction_start(), IsConstructor(), v8::internal::StandardFrame::IsExpressionInsideHandler(), v8::internal::Context::IsWithContext(), v8::internal::Code::kind(), v8::internal::Context::MIN_CONTEXT_SLOTS, mode(), NULL, v8::internal::ScopeInfo::ParameterName(), v8::internal::pc, receiver(), v8::internal::Code::SourcePosition(), v8::internal::ScopeInfo::StackLocalName(), and v8::internal::SharedFunctionInfo::start_position().

+ Here is the call graph for this function:

◆ PrintFunctionAndOffset()

void v8::internal::JavaScriptFrame::PrintFunctionAndOffset ( JSFunction function,
Code code,
Address  pc,
FILE *  file,
bool  print_line_number 
)
static

Definition at line 781 of file frames.cc.

783  {
784  PrintF(file, "%s", function->IsOptimized() ? "*" : "~");
785  function->PrintName(file);
786  int code_offset = static_cast<int>(pc - code->instruction_start());
787  PrintF(file, "+%d", code_offset);
788  if (print_line_number) {
789  SharedFunctionInfo* shared = function->shared();
790  int source_pos = code->SourcePosition(pc);
791  Object* maybe_script = shared->script();
792  if (maybe_script->IsScript()) {
793  Script* script = Script::cast(maybe_script);
794  int line = script->GetLineNumber(source_pos) + 1;
795  Object* script_name_raw = script->name();
796  if (script_name_raw->IsString()) {
797  String* script_name = String::cast(script->name());
798  SmartArrayPointer<char> c_script_name =
799  script_name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
800  PrintF(file, " at %s:%d", c_script_name.get(), line);
801  } else {
802  PrintF(file, " at <unknown>:%d", line);
803  }
804  } else {
805  PrintF(file, " at <unknown>:<unknown>");
806  }
807  }
808 }
JSFunction * function() const
Definition: frames-inl.h:265
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 only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes A file to write the raw context snapshot bytes Write V8 startup blob file(mksnapshot only)") DEFINE_BOOL(profile_hydrogen_code_stub_compilation
@ DISALLOW_NULLS
Definition: objects.h:8337
@ ROBUST_STRING_TRAVERSAL
Definition: objects.h:8338
void PrintF(const char *format,...)
Definition: utils.cc:80

References v8::internal::DISALLOW_NULLS, file(), function(), v8::internal::SmartPointerBase< Deallocator, T >::get(), v8::internal::Script::GetLineNumber(), v8::internal::Code::instruction_start(), v8::internal::JSFunction::IsOptimized(), v8::internal::pc, v8::internal::PrintF(), v8::internal::ROBUST_STRING_TRAVERSAL, v8::internal::Code::SourcePosition(), and v8::internal::String::ToCString().

Referenced by PrintTop(), and v8::internal::IC::TraceIC().

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

◆ PrintTop()

void v8::internal::JavaScriptFrame::PrintTop ( Isolate isolate,
FILE *  file,
bool  print_args,
bool  print_line_number 
)
static

Definition at line 811 of file frames.cc.

812  {
813  // constructor calls
814  DisallowHeapAllocation no_allocation;
815  JavaScriptFrameIterator it(isolate);
816  while (!it.done()) {
817  if (it.frame()->is_java_script()) {
818  JavaScriptFrame* frame = it.frame();
819  if (frame->IsConstructor()) PrintF(file, "new ");
820  PrintFunctionAndOffset(frame->function(), frame->unchecked_code(),
821  frame->pc(), file, print_line_number);
822  if (print_args) {
823  // function arguments
824  // (we are intentionally only printing the actually
825  // supplied parameters, not all parameters required)
826  PrintF(file, "(this=");
827  frame->receiver()->ShortPrint(file);
828  const int length = frame->ComputeParametersCount();
829  for (int i = 0; i < length; i++) {
830  PrintF(file, ", ");
831  frame->GetParameter(i)->ShortPrint(file);
832  }
833  PrintF(file, ")");
834  }
835  break;
836  }
837  it.Advance();
838  }
839 }
static void PrintFunctionAndOffset(JSFunction *function, Code *code, Address pc, FILE *file, bool print_line_number)
Definition: frames.cc:781

References ComputeParametersCount(), file(), function(), GetParameter(), IsConstructor(), v8::internal::PrintF(), PrintFunctionAndOffset(), receiver(), v8::internal::Object::ShortPrint(), and unchecked_code().

Referenced by v8::internal::JSObject::PrintElementsTransition(), v8::internal::Map::PrintGeneralization(), v8::internal::PrintTransition(), v8::internal::TraceTopFrame(), v8::internal::BinaryOpIC::Transition(), and v8::internal::CompareIC::UpdateCaches().

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

◆ receiver()

Object * v8::internal::JavaScriptFrame::receiver ( ) const
inline

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

250  {
251  return GetParameter(-1);
252 }

References GetParameter().

Referenced by v8::internal::AstTyper::ObserveTypesAtOsrEntry(), Print(), v8::internal::Isolate::PrintCurrentStackTrace(), PrintTop(), v8::internal::RUNTIME_FUNCTION(), Summarize(), and v8::internal::OptimizedFrame::Summarize().

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

◆ RestoreOperandStack()

void v8::internal::JavaScriptFrame::RestoreOperandStack ( FixedArray store,
int  stack_handler_index 
)

Definition at line 875 of file frames.cc.

876  {
877  int operands_count = store->length();
878  DCHECK_LE(operands_count, ComputeOperandsCount());
879  int i = 0;
880  while (i <= stack_handler_index) {
881  if (i < stack_handler_index) {
882  // An operand.
883  DCHECK_EQ(GetOperand(i), isolate()->heap()->the_hole_value());
884  Memory::Object_at(GetOperandSlot(i)) = store->get(i);
885  i++;
886  } else {
887  // A stack handler.
888  DCHECK_EQ(i, stack_handler_index);
889  // The FixedArray store grows up. The stack grows down. So the operand
890  // slot for i actually points to the bottom of the top word in the
891  // handler. The base of the StackHandler* is the address of the bottom
892  // word, which will be the last slot that is in the handler.
893  int handler_slot_index = i + StackHandlerConstants::kSlotCount - 1;
894  StackHandler *handler =
895  StackHandler::FromAddress(GetOperandSlot(handler_slot_index));
896  stack_handler_index = handler->Rewind(isolate(), store, i, fp());
898  }
899  }
900 
901  for (; i < operands_count; i++) {
902  DCHECK_EQ(GetOperand(i), isolate()->heap()->the_hole_value());
903  Memory::Object_at(GetOperandSlot(i)) = store->get(i);
904  }
905 }
Object * GetOperand(int index) const
Definition: frames-inl.h:233
static const int kSlotCount
Definition: frames.h:78

References ComputeOperandsCount(), DCHECK_EQ, DCHECK_LE, v8::internal::fp, v8::internal::FixedArray::get(), GetOperand(), GetOperandSlot(), v8::internal::StackHandlerConstants::kSlotCount, v8::internal::FixedArrayBase::length(), and v8::internal::Memory::Object_at().

Referenced by v8::internal::RUNTIME_FUNCTION().

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

◆ SaveOperandStack()

void v8::internal::JavaScriptFrame::SaveOperandStack ( FixedArray store,
int stack_handler_index 
) const

Definition at line 842 of file frames.cc.

843  {
844  int operands_count = store->length();
845  DCHECK_LE(operands_count, ComputeOperandsCount());
846 
847  // Visit the stack in LIFO order, saving operands and stack handlers into the
848  // array. The saved stack handlers store a link to the next stack handler,
849  // which will allow RestoreOperandStack to rewind the handlers.
850  StackHandlerIterator it(this, top_handler());
851  int i = operands_count - 1;
852  *stack_handler_index = -1;
853  for (; !it.done(); it.Advance()) {
854  StackHandler* handler = it.handler();
855  // Save operands pushed after the handler was pushed.
856  for (; GetOperandSlot(i) < handler->address(); i--) {
857  store->set(i, GetOperand(i));
858  }
860  DCHECK_EQ(handler->address(), GetOperandSlot(i));
861  int next_stack_handler_index = i + 1 - StackHandlerConstants::kSlotCount;
862  handler->Unwind(isolate(), store, next_stack_handler_index,
863  *stack_handler_index);
864  *stack_handler_index = next_stack_handler_index;
866  }
867 
868  // Save any remaining operands.
869  for (; i >= 0; i--) {
870  store->set(i, GetOperand(i));
871  }
872 }
#define DCHECK_GE(v1, v2)
Definition: logging.h:208

References ComputeOperandsCount(), DCHECK_EQ, DCHECK_GE, DCHECK_LE, GetOperand(), GetOperandSlot(), v8::internal::StackHandlerConstants::kSlotCount, v8::internal::FixedArrayBase::length(), and v8::internal::FixedArray::set().

Referenced by v8::internal::RUNTIME_FUNCTION().

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

◆ set_receiver()

void v8::internal::JavaScriptFrame::set_receiver ( Object value)
inline

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

255  {
256  Memory::Object_at(GetParameterSlot(-1)) = value;
257 }

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

+ Here is the call graph for this function:

◆ SetParameterValue()

void v8::internal::JavaScriptFrame::SetParameterValue ( int  index,
Object value 
) const

Definition at line 719 of file frames.cc.

719  {
720  Memory::Object_at(GetParameterSlot(index)) = value;
721 }

References GetParameterSlot(), 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:

◆ Summarize()

void v8::internal::JavaScriptFrame::Summarize ( List< FrameSummary > *  frames)
virtual

Reimplemented in v8::internal::OptimizedFrame.

Definition at line 768 of file frames.cc.

768  {
769  DCHECK(functions->length() == 0);
770  Code* code_pointer = LookupCode();
771  int offset = static_cast<int>(pc() - code_pointer->address());
772  FrameSummary summary(receiver(),
773  function(),
774  code_pointer,
775  offset,
776  IsConstructor());
777  functions->Add(summary);
778 }

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::HeapObject::address(), DCHECK, IsConstructor(), v8::internal::pc, and receiver().

Referenced by v8::internal::Isolate::CaptureCurrentStackTrace(), v8::internal::Isolate::CaptureSimpleStackTrace(), and v8::internal::OptimizedFrame::Summarize().

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

◆ type()

virtual Type v8::internal::JavaScriptFrame::type ( ) const
inlinevirtual

Reimplemented in v8::internal::ArgumentsAdaptorFrame, and v8::internal::OptimizedFrame.

Definition at line 552 of file frames.h.

552 { return JAVA_SCRIPT; }

Referenced by ComputeOperandsCount(), and GetOperandSlot().

+ Here is the caller graph for this function:

◆ unchecked_code()

Code * v8::internal::JavaScriptFrame::unchecked_code ( ) const
virtual

Reimplemented in v8::internal::ArgumentsAdaptorFrame.

Definition at line 744 of file frames.cc.

744  {
745  return function()->code();
746 }

Referenced by PrintTop().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ StackFrameIteratorBase

friend class StackFrameIteratorBase
friend

Definition at line 638 of file frames.h.


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