V8 Project
v8::internal::compiler::Linkage Class Reference

#include <linkage.h>

+ Inheritance diagram for v8::internal::compiler::Linkage:
+ Collaboration diagram for v8::internal::compiler::Linkage:

Public Member Functions

 Linkage (CompilationInfo *info)
 
 Linkage (CompilationInfo *info, CallDescriptor *incoming)
 
CallDescriptor * GetIncomingDescriptor ()
 
CallDescriptor * GetJSCallDescriptor (int parameter_count)
 
CallDescriptor * GetRuntimeCallDescriptor (Runtime::FunctionId function, int parameter_count, Operator::Properties properties)
 
CallDescriptor * GetStubCallDescriptor (CallInterfaceDescriptor descriptor, int stack_parameter_count=0, CallDescriptor::Flags flags=CallDescriptor::kNoFlags)
 
LinkageLocation GetParameterLocation (int index)
 
MachineType GetParameterType (int index)
 
LinkageLocation GetReturnLocation ()
 
MachineType GetReturnType ()
 
FrameOffset GetFrameOffset (int spill_slot, Frame *frame, int extra=0)
 
CompilationInfoinfo () const
 
- Public Member Functions inherited from v8::internal::ZoneObject
 INLINE (void *operator new(size_t size, Zone *zone))
 
void operator delete (void *, size_t)
 
void operator delete (void *pointer, Zone *zone)
 

Static Public Member Functions

static CallDescriptor * GetJSCallDescriptor (int parameter_count, Zone *zone)
 
static CallDescriptor * GetRuntimeCallDescriptor (Runtime::FunctionId function, int parameter_count, Operator::Properties properties, Zone *zone)
 
static CallDescriptor * GetStubCallDescriptor (CallInterfaceDescriptor descriptor, int stack_parameter_count, CallDescriptor::Flags flags, Zone *zone)
 
static CallDescriptor * GetSimplifiedCDescriptor (Zone *zone, MachineSignature *sig)
 
static bool NeedsFrameState (Runtime::FunctionId function)
 

Private Attributes

CompilationInfoinfo_
 
CallDescriptor * incoming_
 

Detailed Description

Definition at line 162 of file linkage.h.

Constructor & Destructor Documentation

◆ Linkage() [1/2]

v8::internal::compiler::Linkage::Linkage ( CompilationInfo info)
explicit

Definition at line 42 of file linkage.cc.

42  : info_(info) {
43  if (info->function() != NULL) {
44  // If we already have the function literal, use the number of parameters
45  // plus the receiver.
46  incoming_ = GetJSCallDescriptor(1 + info->function()->parameter_count());
47  } else if (!info->closure().is_null()) {
48  // If we are compiling a JS function, use a JS call descriptor,
49  // plus the receiver.
50  SharedFunctionInfo* shared = info->closure()->shared();
51  incoming_ = GetJSCallDescriptor(1 + shared->formal_parameter_count());
52  } else if (info->code_stub() != NULL) {
53  // Use the code stub interface descriptor.
54  CallInterfaceDescriptor descriptor =
55  info->code_stub()->GetCallInterfaceDescriptor();
56  incoming_ = GetStubCallDescriptor(descriptor);
57  } else {
58  incoming_ = NULL; // TODO(titzer): ?
59  }
60 }
HydrogenCodeStub * code_stub() const
Definition: compiler.h:115
FunctionLiteral * function() const
Definition: compiler.h:107
Handle< JSFunction > closure() const
Definition: compiler.h:111
CompilationInfo * info() const
Definition: linkage.h:219
CallDescriptor * GetStubCallDescriptor(CallInterfaceDescriptor descriptor, int stack_parameter_count=0, CallDescriptor::Flags flags=CallDescriptor::kNoFlags)
Definition: linkage.cc:103
CallDescriptor * GetJSCallDescriptor(int parameter_count)
Definition: linkage.cc:90
CallDescriptor * incoming_
Definition: linkage.h:225
CompilationInfo * info_
Definition: linkage.h:224
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

References v8::internal::CompilationInfo::closure(), v8::internal::CompilationInfo::code_stub(), v8::internal::SharedFunctionInfo::formal_parameter_count(), v8::internal::CompilationInfo::function(), GetJSCallDescriptor(), GetStubCallDescriptor(), incoming_, info(), and NULL.

+ Here is the call graph for this function:

◆ Linkage() [2/2]

v8::internal::compiler::Linkage::Linkage ( CompilationInfo info,
CallDescriptor *  incoming 
)
inlineexplicit

Definition at line 165 of file linkage.h.

166  : info_(info), incoming_(incoming) {}

Member Function Documentation

◆ GetFrameOffset()

FrameOffset v8::internal::compiler::Linkage::GetFrameOffset ( int  spill_slot,
Frame frame,
int  extra = 0 
)

Definition at line 63 of file linkage.cc.

63  {
64  if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() ||
65  incoming_->kind() == CallDescriptor::kCallAddress) {
66  int offset;
67  int register_save_area_size = frame->GetRegisterSaveAreaSize();
68  if (spill_slot >= 0) {
69  // Local or spill slot. Skip the frame pointer, function, and
70  // context in the fixed part of the frame.
71  offset =
72  -(spill_slot + 1) * kPointerSize - register_save_area_size + extra;
73  } else {
74  // Incoming parameter. Skip the return address.
75  offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize +
76  kPCOnStackSize + extra;
77  }
78  return FrameOffset::FromFramePointer(offset);
79  } else {
80  // No frame. Retrieve all parameters relative to stack pointer.
81  DCHECK(spill_slot < 0); // Must be a parameter.
82  int register_save_area_size = frame->GetRegisterSaveAreaSize();
83  int offset = register_save_area_size - (spill_slot + 1) * kPointerSize +
84  kPCOnStackSize + extra;
85  return FrameOffset::FromStackPointer(offset);
86  }
87 }
static FrameOffset FromFramePointer(int offset)
Definition: frame.h:87
static FrameOffset FromStackPointer(int offset)
Definition: frame.h:82
#define DCHECK(condition)
Definition: logging.h:205
const int kPointerSize
Definition: globals.h:129
const int kPCOnStackSize
Definition: globals.h:135
const int kFPOnStackSize
Definition: globals.h:136

References DCHECK, v8::internal::compiler::FrameOffset::FromFramePointer(), v8::internal::compiler::FrameOffset::FromStackPointer(), v8::internal::compiler::Frame::GetRegisterSaveAreaSize(), v8::internal::compiler::Frame::GetSpillSlotCount(), incoming_, v8::internal::kFPOnStackSize, v8::internal::kPCOnStackSize, and v8::internal::kPointerSize.

Referenced by v8::internal::compiler::IA32OperandConverter::ToOperand(), and v8::internal::compiler::X64OperandConverter::ToRegisterOrOperand().

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

◆ GetIncomingDescriptor()

CallDescriptor* v8::internal::compiler::Linkage::GetIncomingDescriptor ( )
inline

Definition at line 170 of file linkage.h.

170 { return incoming_; }

References incoming_.

◆ GetJSCallDescriptor() [1/2]

CallDescriptor * v8::internal::compiler::Linkage::GetJSCallDescriptor ( int  parameter_count)

Definition at line 90 of file linkage.cc.

90  {
91  return GetJSCallDescriptor(parameter_count, this->info_->zone());
92 }

References info_, and v8::internal::CompilationInfo::zone().

Referenced by v8::internal::compiler::RawMachineAssembler::CallJS0(), and Linkage().

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

◆ GetJSCallDescriptor() [2/2]

CallDescriptor * v8::internal::compiler::Linkage::GetJSCallDescriptor ( int  parameter_count,
Zone zone 
)
static

Definition at line 38 of file linkage-arm.cc.

38  {
39  return LH::GetJSCallDescriptor(zone, parameter_count);
40 }
static CallDescriptor * GetJSCallDescriptor(Zone *zone, int js_parameter_count)
Definition: linkage-impl.h:29

References v8::internal::compiler::LinkageHelper< LinkageTraits >::GetJSCallDescriptor().

+ Here is the call graph for this function:

◆ GetParameterLocation()

LinkageLocation v8::internal::compiler::Linkage::GetParameterLocation ( int  index)
inline

Definition at line 195 of file linkage.h.

195  {
196  return incoming_->GetInputLocation(index + 1); // + 1 to skip target.
197  }

References incoming_.

◆ GetParameterType()

MachineType v8::internal::compiler::Linkage::GetParameterType ( int  index)
inline

Definition at line 200 of file linkage.h.

200  {
201  return incoming_->GetInputType(index + 1); // + 1 to skip target.
202  }

References incoming_.

◆ GetReturnLocation()

LinkageLocation v8::internal::compiler::Linkage::GetReturnLocation ( )
inline

Definition at line 205 of file linkage.h.

205  {
206  return incoming_->GetReturnLocation(0);
207  }

References incoming_.

◆ GetReturnType()

MachineType v8::internal::compiler::Linkage::GetReturnType ( )
inline

Definition at line 210 of file linkage.h.

210 { return incoming_->GetReturnType(0); }

References incoming_.

◆ GetRuntimeCallDescriptor() [1/2]

CallDescriptor * v8::internal::compiler::Linkage::GetRuntimeCallDescriptor ( Runtime::FunctionId  function,
int  parameter_count,
Operator::Properties  properties 
)

Definition at line 95 of file linkage.cc.

97  {
98  return GetRuntimeCallDescriptor(function, parameter_count, properties,
99  this->info_->zone());
100 }
CallDescriptor * GetRuntimeCallDescriptor(Runtime::FunctionId function, int parameter_count, Operator::Properties properties)
Definition: linkage.cc:95

References info_, and v8::internal::CompilationInfo::zone().

Referenced by v8::internal::compiler::RawMachineAssembler::CallRuntime1(), v8::internal::compiler::JSGenericLowering::ReplaceWithRuntimeCall(), and v8::internal::compiler::SimplifiedLowering::StringComparison().

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

◆ GetRuntimeCallDescriptor() [2/2]

CallDescriptor * v8::internal::compiler::Linkage::GetRuntimeCallDescriptor ( Runtime::FunctionId  function,
int  parameter_count,
Operator::Properties  properties,
Zone zone 
)
static

Definition at line 43 of file linkage-arm.cc.

45  {
46  return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
47  properties);
48 }
static CallDescriptor * GetRuntimeCallDescriptor(Zone *zone, Runtime::FunctionId function_id, int js_parameter_count, Operator::Properties properties)
Definition: linkage-impl.h:71

References v8::internal::compiler::LinkageHelper< LinkageTraits >::GetRuntimeCallDescriptor().

+ Here is the call graph for this function:

◆ GetSimplifiedCDescriptor()

CallDescriptor * v8::internal::compiler::Linkage::GetSimplifiedCDescriptor ( Zone zone,
MachineSignature sig 
)
static

Definition at line 59 of file linkage-arm.cc.

60  {
61  return LH::GetSimplifiedCDescriptor(zone, sig);
62 }
static CallDescriptor * GetSimplifiedCDescriptor(Zone *zone, MachineSignature *msig)
Definition: linkage-impl.h:182

References v8::internal::compiler::LinkageHelper< LinkageTraits >::GetSimplifiedCDescriptor().

+ Here is the call graph for this function:

◆ GetStubCallDescriptor() [1/2]

CallDescriptor * v8::internal::compiler::Linkage::GetStubCallDescriptor ( CallInterfaceDescriptor  descriptor,
int  stack_parameter_count,
CallDescriptor::Flags  flags,
Zone zone 
)
static

Definition at line 51 of file linkage-arm.cc.

53  {
54  return LH::GetStubCallDescriptor(zone, descriptor, stack_parameter_count,
55  flags);
56 }
static CallDescriptor * GetStubCallDescriptor(Zone *zone, CallInterfaceDescriptor descriptor, int stack_parameter_count, CallDescriptor::Flags flags)
Definition: linkage-impl.h:131

References v8::internal::anonymous_namespace{flags.cc}::flags, and v8::internal::compiler::LinkageHelper< LinkageTraits >::GetStubCallDescriptor().

+ Here is the call graph for this function:

◆ GetStubCallDescriptor() [2/2]

CallDescriptor * v8::internal::compiler::Linkage::GetStubCallDescriptor ( CallInterfaceDescriptor  descriptor,
int  stack_parameter_count = 0,
CallDescriptor::Flags  flags = CallDescriptor::kNoFlags 
)

Definition at line 103 of file linkage.cc.

105  {
106  return GetStubCallDescriptor(descriptor, stack_parameter_count, flags,
107  this->info_->zone());
108 }

References v8::internal::anonymous_namespace{flags.cc}::flags, info_, and v8::internal::CompilationInfo::zone().

Referenced by v8::internal::compiler::RawMachineAssembler::CallFunctionStub0(), v8::internal::compiler::SimplifiedLowering::DoStringAdd(), Linkage(), v8::internal::compiler::JSGenericLowering::ReplaceWithBuiltinCall(), v8::internal::compiler::JSGenericLowering::ReplaceWithCompareIC(), and v8::internal::compiler::JSGenericLowering::ReplaceWithStubCall().

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

◆ info()

CompilationInfo* v8::internal::compiler::Linkage::info ( ) const
inline

Definition at line 219 of file linkage.h.

219 { return info_; }

References info_.

Referenced by v8::internal::compiler::Pipeline::GenerateCode(), and Linkage().

+ Here is the caller graph for this function:

◆ NeedsFrameState()

bool v8::internal::compiler::Linkage::NeedsFrameState ( Runtime::FunctionId  function)
static

Definition at line 112 of file linkage.cc.

112  {
113  if (!FLAG_turbo_deoptimization) {
114  return false;
115  }
116  // TODO(jarin) At the moment, we only add frame state for
117  // few chosen runtime functions.
118  switch (function) {
119  case Runtime::kDebugBreak:
120  case Runtime::kDebugGetLoadedScripts:
121  case Runtime::kDeoptimizeFunction:
122  case Runtime::kInlineCallFunction:
123  case Runtime::kPrepareStep:
124  case Runtime::kSetScriptBreakPoint:
125  case Runtime::kStackGuard:
126  case Runtime::kCheckExecutionState:
127  case Runtime::kDebugEvaluate:
128  case Runtime::kCollectStackTrace:
129  return true;
130  default:
131  return false;
132  }
133 }

Referenced by v8::internal::compiler::LinkageHelper< LinkageTraits >::GetRuntimeCallDescriptor(), and v8::internal::compiler::OperatorProperties::HasFrameStateInput().

+ Here is the caller graph for this function:

Member Data Documentation

◆ incoming_

CallDescriptor* v8::internal::compiler::Linkage::incoming_
private

◆ info_

CompilationInfo* v8::internal::compiler::Linkage::info_
private

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