V8 Project
v8::internal::compiler::X64OperandConverter Class Reference
+ Inheritance diagram for v8::internal::compiler::X64OperandConverter:
+ Collaboration diagram for v8::internal::compiler::X64OperandConverter:

Public Member Functions

 X64OperandConverter (CodeGenerator *gen, Instruction *instr)
 
RegisterOrOperand InputRegisterOrOperand (int index)
 
Immediate InputImmediate (int index)
 
RegisterOrOperand OutputRegisterOrOperand ()
 
Immediate64 InputImmediate64 (int index)
 
Immediate64 ToImmediate64 (InstructionOperand *operand)
 
Immediate ToImmediate (InstructionOperand *operand)
 
Operand ToOperand (InstructionOperand *op, int extra=0)
 
RegisterOrOperand ToRegisterOrOperand (InstructionOperand *op, int extra=0)
 
Operand MemoryOperand (int *offset)
 
Operand MemoryOperand ()
 
- Public Member Functions inherited from v8::internal::compiler::InstructionOperandConverter
 InstructionOperandConverter (CodeGenerator *gen, Instruction *instr)
 
Register InputRegister (int index)
 
DoubleRegister InputDoubleRegister (int index)
 
double InputDouble (int index)
 
int32_t InputInt32 (int index)
 
int8_t InputInt8 (int index)
 
int16_t InputInt16 (int index)
 
uint8_t InputInt5 (int index)
 
uint8_t InputInt6 (int index)
 
Handle< HeapObjectInputHeapObject (int index)
 
Label * InputLabel (int index)
 
BasicBlock * InputBlock (int index)
 
Register OutputRegister (int index=0)
 
DoubleRegister OutputDoubleRegister ()
 
Register TempRegister (int index)
 
Register ToRegister (InstructionOperand *op)
 
DoubleRegister ToDoubleRegister (InstructionOperand *op)
 
Constant ToConstant (InstructionOperand *operand)
 
double ToDouble (InstructionOperand *operand)
 
Handle< HeapObjectToHeapObject (InstructionOperand *operand)
 
Frameframe () const
 
Isolateisolate () const
 
Linkagelinkage () const
 

Static Public Member Functions

static int NextOffset (int *offset)
 
static ScaleFactor ScaleFor (AddressingMode one, AddressingMode mode)
 

Additional Inherited Members

- Protected Attributes inherited from v8::internal::compiler::InstructionOperandConverter
CodeGeneratorgen_
 
Instructioninstr_
 

Detailed Description

Definition at line 47 of file code-generator-x64.cc.

Constructor & Destructor Documentation

◆ X64OperandConverter()

v8::internal::compiler::X64OperandConverter::X64OperandConverter ( CodeGenerator gen,
Instruction instr 
)
inline

Definition at line 49 of file code-generator-x64.cc.

50  : InstructionOperandConverter(gen, instr) {}
InstructionOperandConverter(CodeGenerator *gen, Instruction *instr)

Member Function Documentation

◆ InputImmediate()

Immediate v8::internal::compiler::X64OperandConverter::InputImmediate ( int  index)
inline

Definition at line 56 of file code-generator-x64.cc.

56  {
57  return ToImmediate(instr_->InputAt(index));
58  }
InstructionOperand * InputAt(size_t i) const
Definition: instruction.h:416
Immediate ToImmediate(InstructionOperand *operand)

References v8::internal::compiler::Instruction::InputAt(), v8::internal::compiler::InstructionOperandConverter::instr_, and ToImmediate().

+ Here is the call graph for this function:

◆ InputImmediate64()

Immediate64 v8::internal::compiler::X64OperandConverter::InputImmediate64 ( int  index)
inline

Definition at line 64 of file code-generator-x64.cc.

64  {
65  return ToImmediate64(instr_->InputAt(index));
66  }
Immediate64 ToImmediate64(InstructionOperand *operand)

References v8::internal::compiler::Instruction::InputAt(), v8::internal::compiler::InstructionOperandConverter::instr_, and ToImmediate64().

+ Here is the call graph for this function:

◆ InputRegisterOrOperand()

RegisterOrOperand v8::internal::compiler::X64OperandConverter::InputRegisterOrOperand ( int  index)
inline

Definition at line 52 of file code-generator-x64.cc.

52  {
53  return ToRegisterOrOperand(instr_->InputAt(index));
54  }
RegisterOrOperand ToRegisterOrOperand(InstructionOperand *op, int extra=0)

References v8::internal::compiler::Instruction::InputAt(), v8::internal::compiler::InstructionOperandConverter::instr_, and ToRegisterOrOperand().

+ Here is the call graph for this function:

◆ MemoryOperand() [1/2]

Operand v8::internal::compiler::X64OperandConverter::MemoryOperand ( )
inline

Definition at line 223 of file code-generator-x64.cc.

223  {
224  int first_input = 0;
225  return MemoryOperand(&first_input);
226  }

◆ MemoryOperand() [2/2]

Operand v8::internal::compiler::X64OperandConverter::MemoryOperand ( int offset)
inline

Definition at line 164 of file code-generator-x64.cc.

164  {
166  switch (mode) {
167  case kMode_MR: {
168  Register base = InputRegister(NextOffset(offset));
169  int32_t disp = 0;
170  return Operand(base, disp);
171  }
172  case kMode_MRI: {
173  Register base = InputRegister(NextOffset(offset));
174  int32_t disp = InputInt32(NextOffset(offset));
175  return Operand(base, disp);
176  }
177  case kMode_MR1:
178  case kMode_MR2:
179  case kMode_MR4:
180  case kMode_MR8: {
181  Register base = InputRegister(NextOffset(offset));
182  Register index = InputRegister(NextOffset(offset));
183  ScaleFactor scale = ScaleFor(kMode_MR1, mode);
184  int32_t disp = 0;
185  return Operand(base, index, scale, disp);
186  }
187  case kMode_MR1I:
188  case kMode_MR2I:
189  case kMode_MR4I:
190  case kMode_MR8I: {
191  Register base = InputRegister(NextOffset(offset));
192  Register index = InputRegister(NextOffset(offset));
193  ScaleFactor scale = ScaleFor(kMode_MR1I, mode);
194  int32_t disp = InputInt32(NextOffset(offset));
195  return Operand(base, index, scale, disp);
196  }
197  case kMode_M1:
198  case kMode_M2:
199  case kMode_M4:
200  case kMode_M8: {
201  Register index = InputRegister(NextOffset(offset));
202  ScaleFactor scale = ScaleFor(kMode_M1, mode);
203  int32_t disp = 0;
204  return Operand(index, scale, disp);
205  }
206  case kMode_M1I:
207  case kMode_M2I:
208  case kMode_M4I:
209  case kMode_M8I: {
210  Register index = InputRegister(NextOffset(offset));
211  ScaleFactor scale = ScaleFor(kMode_M1I, mode);
212  int32_t disp = InputInt32(NextOffset(offset));
213  return Operand(index, scale, disp);
214  }
215  case kMode_None:
216  UNREACHABLE();
217  return Operand(no_reg, 0);
218  }
219  UNREACHABLE();
220  return Operand(no_reg, 0);
221  }
InstructionCode opcode() const
Definition: instruction.h:427
static ScaleFactor ScaleFor(AddressingMode one, AddressingMode mode)
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
#define UNREACHABLE()
Definition: logging.h:30
int int32_t
Definition: unicode.cc:24
const Register no_reg

References v8::internal::BitFieldBase< T, shift, size, uint32_t >::decode(), v8::internal::compiler::InstructionOperandConverter::InputInt32(), v8::internal::compiler::InstructionOperandConverter::InputRegister(), v8::internal::compiler::InstructionOperandConverter::instr_, mode(), NextOffset(), v8::internal::no_reg, v8::internal::compiler::Instruction::opcode(), ScaleFor(), and UNREACHABLE.

+ Here is the call graph for this function:

◆ NextOffset()

static int v8::internal::compiler::X64OperandConverter::NextOffset ( int offset)
inlinestatic

Definition at line 148 of file code-generator-x64.cc.

148  {
149  int i = *offset;
150  (*offset)++;
151  return i;
152  }

Referenced by MemoryOperand().

+ Here is the caller graph for this function:

◆ OutputRegisterOrOperand()

RegisterOrOperand v8::internal::compiler::X64OperandConverter::OutputRegisterOrOperand ( )
inline

Definition at line 60 of file code-generator-x64.cc.

60  {
62  }
InstructionOperand * Output() const
Definition: instruction.h:413

References v8::internal::compiler::InstructionOperandConverter::instr_, v8::internal::compiler::Instruction::Output(), and ToRegisterOrOperand().

+ Here is the call graph for this function:

◆ ScaleFor()

static ScaleFactor v8::internal::compiler::X64OperandConverter::ScaleFor ( AddressingMode  one,
AddressingMode  mode 
)
inlinestatic

Definition at line 154 of file code-generator-x64.cc.

154  {
155  STATIC_ASSERT(0 == static_cast<int>(times_1));
156  STATIC_ASSERT(1 == static_cast<int>(times_2));
157  STATIC_ASSERT(2 == static_cast<int>(times_4));
158  STATIC_ASSERT(3 == static_cast<int>(times_8));
159  int scale = static_cast<int>(mode - one);
160  DCHECK(scale >= 0 && scale < 4);
161  return static_cast<ScaleFactor>(scale);
162  }
#define DCHECK(condition)
Definition: logging.h:205
STATIC_ASSERT(DoubleRegister::kMaxNumAllocatableRegisters >=Register::kMaxNumAllocatableRegisters)

References DCHECK, mode(), v8::internal::compiler::STATIC_ASSERT(), v8::internal::times_1, v8::internal::times_2, v8::internal::times_4, and v8::internal::times_8.

Referenced by MemoryOperand().

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

◆ ToImmediate()

Immediate v8::internal::compiler::X64OperandConverter::ToImmediate ( InstructionOperand operand)
inline

Definition at line 101 of file code-generator-x64.cc.

101  {
102  Constant constant = ToConstant(operand);
103  switch (constant.type()) {
104  case Constant::kInt32:
105  return Immediate(constant.ToInt32());
106  case Constant::kInt64:
107  case Constant::kFloat32:
108  case Constant::kFloat64:
109  case Constant::kExternalReference:
110  case Constant::kHeapObject:
111  break;
112  }
113  UNREACHABLE();
114  return Immediate(-1);
115  }
Constant ToConstant(InstructionOperand *operand)

References v8::internal::compiler::InstructionOperandConverter::ToConstant(), and UNREACHABLE.

Referenced by InputImmediate().

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

◆ ToImmediate64()

Immediate64 v8::internal::compiler::X64OperandConverter::ToImmediate64 ( InstructionOperand operand)
inline

Definition at line 68 of file code-generator-x64.cc.

68  {
69  Constant constant = ToConstant(operand);
70  Immediate64 immediate;
71  immediate.value = 0xbeefdeaddeefbeed;
72  immediate.type = kImm64Value;
73  switch (constant.type()) {
74  case Constant::kInt32:
75  case Constant::kInt64:
76  immediate.value = constant.ToInt64();
77  return immediate;
78  case Constant::kFloat32:
79  immediate.type = kImm64Handle;
80  immediate.handle =
81  isolate()->factory()->NewNumber(constant.ToFloat32(), TENURED);
82  return immediate;
83  case Constant::kFloat64:
84  immediate.type = kImm64Handle;
85  immediate.handle =
86  isolate()->factory()->NewNumber(constant.ToFloat64(), TENURED);
87  return immediate;
88  case Constant::kExternalReference:
89  immediate.type = kImm64Reference;
90  immediate.reference = constant.ToExternalReference();
91  return immediate;
92  case Constant::kHeapObject:
93  immediate.type = kImm64Handle;
94  immediate.handle = constant.ToHeapObject();
95  return immediate;
96  }
97  UNREACHABLE();
98  return immediate;
99  }
Factory * factory()
Definition: isolate.h:982

References v8::internal::Isolate::factory(), v8::internal::compiler::Immediate64::handle, v8::internal::compiler::InstructionOperandConverter::isolate(), v8::internal::compiler::kImm64Handle, v8::internal::compiler::kImm64Reference, v8::internal::compiler::kImm64Value, v8::internal::compiler::Immediate64::reference, v8::internal::TENURED, v8::internal::compiler::InstructionOperandConverter::ToConstant(), v8::internal::compiler::Immediate64::type, UNREACHABLE, and v8::internal::compiler::Immediate64::value.

Referenced by InputImmediate64().

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

◆ ToOperand()

Operand v8::internal::compiler::X64OperandConverter::ToOperand ( InstructionOperand op,
int  extra = 0 
)
inline

Definition at line 117 of file code-generator-x64.cc.

117  {
118  RegisterOrOperand result = ToRegisterOrOperand(op, extra);
119  DCHECK_EQ(kOperand, result.type);
120  return result.operand;
121  }
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206

References DCHECK_EQ, v8::internal::compiler::kOperand, v8::internal::compiler::RegisterOrOperand::operand, ToRegisterOrOperand(), and v8::internal::compiler::RegisterOrOperand::type.

+ Here is the call graph for this function:

◆ ToRegisterOrOperand()

RegisterOrOperand v8::internal::compiler::X64OperandConverter::ToRegisterOrOperand ( InstructionOperand op,
int  extra = 0 
)
inline

Definition at line 123 of file code-generator-x64.cc.

123  {
124  RegisterOrOperand result;
125  if (op->IsRegister()) {
126  DCHECK(extra == 0);
127  result.type = kRegister;
128  result.reg = ToRegister(op);
129  return result;
130  } else if (op->IsDoubleRegister()) {
131  DCHECK(extra == 0);
132  DCHECK(extra == 0);
133  result.type = kDoubleRegister;
134  result.double_reg = ToDoubleRegister(op);
135  return result;
136  }
137 
138  DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
139 
140  result.type = kOperand;
141  // The linkage computes where all spill slots are located.
142  FrameOffset offset = linkage()->GetFrameOffset(op->index(), frame(), extra);
143  result.operand =
144  Operand(offset.from_stack_pointer() ? rsp : rbp, offset.offset());
145  return result;
146  }
DoubleRegister ToDoubleRegister(InstructionOperand *op)
FrameOffset GetFrameOffset(int spill_slot, Frame *frame, int extra=0)
Definition: linkage.cc:63
const Register rbp
const Register rsp

References DCHECK, v8::internal::compiler::RegisterOrOperand::double_reg, v8::internal::compiler::InstructionOperandConverter::frame(), v8::internal::compiler::FrameOffset::from_stack_pointer(), v8::internal::compiler::Linkage::GetFrameOffset(), v8::internal::compiler::InstructionOperand::index(), v8::internal::compiler::kDoubleRegister, v8::internal::compiler::kOperand, v8::internal::compiler::kRegister, v8::internal::compiler::InstructionOperandConverter::linkage(), v8::internal::compiler::FrameOffset::offset(), v8::internal::compiler::RegisterOrOperand::operand, v8::internal::rbp, v8::internal::compiler::RegisterOrOperand::reg, v8::internal::rsp, v8::internal::compiler::InstructionOperandConverter::ToDoubleRegister(), v8::internal::compiler::InstructionOperandConverter::ToRegister(), and v8::internal::compiler::RegisterOrOperand::type.

Referenced by InputRegisterOrOperand(), OutputRegisterOrOperand(), and ToOperand().

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

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