5 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_
6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_
39 return TypeError(node, output_type, use_type);
45 if ((use_type &
rWord) && (output_type &
rWord)) {
58 }
else if (use_type &
kRepBit) {
60 }
else if (use_type &
rWord) {
72 switch (node->opcode()) {
73 case IrOpcode::kNumberConstant:
74 case IrOpcode::kHeapConstant:
76 case IrOpcode::kInt32Constant:
78 uint32_t value = OpParameter<uint32_t>(node);
81 int32_t value = OpParameter<int32_t>(node);
83 }
else if (output_type &
kRepBit) {
89 case IrOpcode::kFloat64Constant:
91 case IrOpcode::kFloat32Constant:
100 }
else if (output_type &
rWord) {
121 switch (node->opcode()) {
122 case IrOpcode::kFloat64Constant:
123 case IrOpcode::kNumberConstant:
126 case IrOpcode::kInt32Constant:
128 uint32_t value = OpParameter<uint32_t>(node);
131 int32_t value = OpParameter<int32_t>(node);
134 case IrOpcode::kFloat32Constant:
143 }
else if (output_type &
rWord) {
145 op =
machine()->ChangeUint32ToFloat64();
147 op =
machine()->ChangeInt32ToFloat64();
151 op =
machine()->TruncateFloat64ToFloat32();
154 ->ChangeTaggedToFloat64();
156 op =
machine()->TruncateFloat64ToFloat32();
158 op =
machine()->ChangeFloat32ToFloat64();
167 switch (node->opcode()) {
168 case IrOpcode::kNumberConstant:
170 case IrOpcode::kInt32Constant:
172 uint32_t value = OpParameter<uint32_t>(node);
175 int32_t value = OpParameter<int32_t>(node);
178 case IrOpcode::kFloat64Constant:
180 case IrOpcode::kFloat32Constant:
189 }
else if (output_type &
rWord) {
191 op =
machine()->ChangeUint32ToFloat64();
193 op =
machine()->ChangeInt32ToFloat64();
198 op =
machine()->ChangeFloat32ToFloat64();
220 switch (node->opcode()) {
221 case IrOpcode::kInt32Constant:
223 case IrOpcode::kFloat32Constant:
225 case IrOpcode::kNumberConstant:
226 case IrOpcode::kFloat64Constant:
235 op =
machine()->ChangeFloat64ToUint32();
237 op =
machine()->ChangeFloat64ToInt32();
242 op =
machine()->ChangeFloat64ToUint32();
244 op =
machine()->ChangeFloat64ToInt32();
260 switch (node->opcode()) {
261 case IrOpcode::kInt32Constant: {
262 int32_t value = OpParameter<int32_t>(node);
263 if (value == 0 || value == 1)
return node;
266 case IrOpcode::kHeapConstant: {
278 if (output_type &
rWord) {
300 case IrOpcode::kNumberAdd:
302 case IrOpcode::kNumberSubtract:
304 case IrOpcode::kNumberMultiply:
306 case IrOpcode::kNumberDivide:
308 case IrOpcode::kNumberModulus:
310 case IrOpcode::kNumberEqual:
311 return machine()->Word32Equal();
312 case IrOpcode::kNumberLessThan:
313 return machine()->Int32LessThan();
314 case IrOpcode::kNumberLessThanOrEqual:
315 return machine()->Int32LessThanOrEqual();
324 case IrOpcode::kNumberAdd:
326 case IrOpcode::kNumberSubtract:
328 case IrOpcode::kNumberMultiply:
330 case IrOpcode::kNumberDivide:
332 case IrOpcode::kNumberModulus:
334 case IrOpcode::kNumberEqual:
335 return machine()->Word32Equal();
336 case IrOpcode::kNumberLessThan:
337 return machine()->Uint32LessThan();
338 case IrOpcode::kNumberLessThanOrEqual:
339 return machine()->Uint32LessThanOrEqual();
348 case IrOpcode::kNumberAdd:
349 return machine()->Float64Add();
350 case IrOpcode::kNumberSubtract:
351 return machine()->Float64Sub();
352 case IrOpcode::kNumberMultiply:
353 return machine()->Float64Mul();
354 case IrOpcode::kNumberDivide:
355 return machine()->Float64Div();
356 case IrOpcode::kNumberModulus:
357 return machine()->Float64Mod();
358 case IrOpcode::kNumberEqual:
359 return machine()->Float64Equal();
360 case IrOpcode::kNumberLessThan:
361 return machine()->Float64LessThan();
362 case IrOpcode::kNumberLessThanOrEqual:
363 return machine()->Float64LessThanOrEqual();
403 out_str << static_cast<MachineType>(output_type);
406 use_str << static_cast<MachineType>(
use);
409 "RepresentationChangerError: node #%d:%s of "
410 "%s cannot be changed to %s",
411 node->id(), node->op()->mnemonic(), out_str.
c_str(),
const char * c_str() const
Node * NewNode(const Operator *op, int input_count, Node **inputs)
Node * Float32Constant(float value)
MachineOperatorBuilder * machine()
Node * Float64Constant(double value)
Node * Constant(Handle< Object > value)
Node * Int32Constant(int32_t value)
Node * MakeInt32Constant(double value)
const Operator * Float64OperatorFor(IrOpcode::Value opcode)
Node * GetTaggedRepresentationFor(Node *node, MachineTypeUnion output_type)
bool testing_type_errors_
SimplifiedOperatorBuilder * simplified_
Node * GetFloat32RepresentationFor(Node *node, MachineTypeUnion output_type)
Node * GetRepresentationFor(Node *node, MachineTypeUnion output_type, MachineTypeUnion use_type)
Node * GetWord32RepresentationFor(Node *node, MachineTypeUnion output_type, bool use_unsigned)
friend class RepresentationChangerTester
Node * TypeError(Node *node, MachineTypeUnion output_type, MachineTypeUnion use)
Node * InsertChangeFloat32ToFloat64(Node *node)
static const MachineTypeUnion rWord
const Operator * Int32OperatorFor(IrOpcode::Value opcode)
MachineType TypeForBasePointer(const FieldAccess &access)
Node * GetBitRepresentationFor(Node *node, MachineTypeUnion output_type)
Node * GetWord64RepresentationFor(Node *node, MachineTypeUnion output_type)
SimplifiedOperatorBuilder * simplified()
const Operator * Uint32OperatorFor(IrOpcode::Value opcode)
Node * GetFloat64RepresentationFor(Node *node, MachineTypeUnion output_type)
MachineType TypeForBasePointer(const ElementAccess &access)
RepresentationChanger(JSGraph *jsgraph, SimplifiedOperatorBuilder *simplified, Isolate *isolate)
MachineType TypeFromUpperBound(Type *type)
MachineOperatorBuilder * machine()
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 use(in kBytes)") DEFINE_INT(max_stack_trace_source_length
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
void V8_Fatal(const char *file, int line, const char *format,...)
#define DCHECK(condition)
bool IsPowerOfTwo32(uint32_t value)
const MachineTypeUnion kRepMask
uint16_t MachineTypeUnion
static bool IsUint32Double(double value)
static bool IsInt32Double(double value)
Handle< T > handle(T *t, Isolate *isolate)
float DoubleToFloat32(double x)
Debugger support for the V8 JavaScript engine.