V8 Project
v8::internal::HCompareNumericAndBranch Class Reference

#include <hydrogen-instructions.h>

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

Public Member Functions

 DECLARE_INSTRUCTION_FACTORY_P3 (HCompareNumericAndBranch, HValue *, HValue *, Token::Value)
 
 DECLARE_INSTRUCTION_FACTORY_P5 (HCompareNumericAndBranch, HValue *, HValue *, Token::Value, HBasicBlock *, HBasicBlock *)
 
HValueleft () const
 
HValueright () const
 
Token::Value token () const
 
void set_observed_input_representation (Representation left, Representation right)
 
virtual void InferRepresentation (HInferRepresentationPhase *h_infer) OVERRIDE
 
virtual Representation RequiredInputRepresentation (int index) OVERRIDE
 
virtual Representation observed_input_representation (int index) OVERRIDE
 
virtual bool KnownSuccessorBlock (HBasicBlock **block) OVERRIDE
 
virtual OStreamPrintDataTo (OStream &os) const OVERRIDE
 
void SetOperandPositions (Zone *zone, HSourcePosition left_pos, HSourcePosition right_pos)
 
- Public Member Functions inherited from v8::internal::HTemplateControlInstruction< 2, 2 >
int SuccessorCount () const OVERRIDE
 
HBasicBlockSuccessorAt (int i) const OVERRIDE
 
void SetSuccessorAt (int i, HBasicBlock *block) OVERRIDE
 
int OperandCount () const OVERRIDE
 
HValueOperandAt (int i) const OVERRIDE
 
- Public Member Functions inherited from v8::internal::HControlInstruction
HBasicBlockFirstSuccessor ()
 
HBasicBlockSecondSuccessor ()
 
void Not ()
 
- Public Member Functions inherited from v8::internal::HInstruction
HInstructionnext () const
 
HInstructionprevious () const
 
virtual OStreamPrintTo (OStream &os) const OVERRIDE
 
bool IsLinked () const
 
void Unlink ()
 
void InsertBefore (HInstruction *next)
 
template<class T >
TPrepend (T *instr)
 
void InsertAfter (HInstruction *previous)
 
template<class T >
TAppend (T *instr)
 
virtual HSourcePosition position () const OVERRIDE
 
bool has_position () const
 
void set_position (HSourcePosition position)
 
virtual HSourcePosition operand_position (int index) const OVERRIDE
 
void set_operand_position (Zone *zone, int index, HSourcePosition pos)
 
bool Dominates (HInstruction *other)
 
bool CanTruncateToSmi () const
 
bool CanTruncateToInt32 () const
 
virtual LInstructionCompileToLithium (LChunkBuilder *builder)=0
 
bool CanDeoptimize ()
 
virtual bool HasStackCheck ()
 
- Public Member Functions inherited from v8::internal::HValue
 STATIC_ASSERT (kLastFlag< kBitsPerInt)
 
virtual Opcode opcode () const =0
 
bool IsPhi () const
 
bool IsBitwiseBinaryShift ()
 
 HValue (HType type=HType::Tagged())
 
virtual ~HValue ()
 
HBasicBlock * block () const
 
void SetBlock (HBasicBlock *block)
 
Isolateisolate () const
 
int id () const
 
void set_id (int id)
 
HUseIterator uses () const
 
virtual bool EmitAtUses ()
 
Representation representation () const
 
void ChangeRepresentation (Representation r)
 
virtual void AssumeRepresentation (Representation r)
 
virtual Representation KnownOptimalRepresentation ()
 
HType type () const
 
void set_type (HType new_type)
 
virtual int RedefinedOperandIndex ()
 
bool IsInformativeDefinition ()
 
HValueRedefinedOperand ()
 
bool CanReplaceWithDummyUses ()
 
virtual int argument_delta () const
 
virtual bool IsPurelyInformativeDefinition ()
 
HValueActualValue ()
 
bool IsInteger32Constant ()
 
int32_t GetInteger32Constant ()
 
bool EqualsInteger32Constant (int32_t value)
 
bool IsDefinedAfter (HBasicBlock *other) const
 
void SetOperandAt (int index, HValue *value)
 
void DeleteAndReplaceWith (HValue *other)
 
void ReplaceAllUsesWith (HValue *other)
 
bool HasNoUses () const
 
bool HasOneUse () const
 
bool HasMultipleUses () const
 
int UseCount () const
 
void Kill ()
 
int flags () const
 
void SetFlag (Flag f)
 
void ClearFlag (Flag f)
 
bool CheckFlag (Flag f) const
 
void CopyFlag (Flag f, HValue *other)
 
bool CheckUsesForFlag (Flag f) const
 
bool CheckUsesForFlag (Flag f, HValue **value) const
 
bool HasAtLeastOneUseWithFlagAndNoneWithout (Flag f) const
 
GVNFlagSet ChangesFlags () const
 
GVNFlagSet DependsOnFlags () const
 
void SetChangesFlag (GVNFlag f)
 
void SetDependsOnFlag (GVNFlag f)
 
void ClearChangesFlag (GVNFlag f)
 
void ClearDependsOnFlag (GVNFlag f)
 
bool CheckChangesFlag (GVNFlag f) const
 
bool CheckDependsOnFlag (GVNFlag f) const
 
void SetAllSideEffects ()
 
void ClearAllSideEffects ()
 
bool HasSideEffects () const
 
bool HasObservableSideEffects () const
 
GVNFlagSet SideEffectFlags () const
 
GVNFlagSet ObservableChangesFlags () const
 
Range * range () const
 
bool HasRange () const
 
void AddNewRange (Range *r, Zone *zone)
 
void RemoveLastAddedRange ()
 
void ComputeInitialRange (Zone *zone)
 
virtual bool HasEscapingOperandAt (int index)
 
virtual bool HasOutOfBoundsAccess (int size)
 
virtual HValueCanonicalize ()
 
bool Equals (HValue *other)
 
virtual intptr_t Hashcode ()
 
virtual void FinalizeUniqueness ()
 
const char * Mnemonic () const
 
bool HasMonomorphicJSObjectType ()
 
virtual Handle< MapGetMonomorphicJSObjectMap ()
 
bool UpdateInferredType ()
 
virtual HType CalculateInferredType ()
 
virtual bool HandleSideEffectDominator (GVNFlag side_effect, HValue *dominator)
 
bool CannotBeEliminated () const
 
virtual bool TryDecompose (DecompositionResult *decomposition)
 
bool ToStringCanBeObserved () const
 
bool ToNumberCanBeObserved () const
 
MinusZeroMode GetMinusZeroMode ()
 
- 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)
 

Private Member Functions

 HCompareNumericAndBranch (HValue *left, HValue *right, Token::Value token, HBasicBlock *true_target=NULL, HBasicBlock *false_target=NULL)
 

Private Attributes

Representation observed_input_representation_ [2]
 
Token::Value token_
 

Additional Inherited Members

- Public Types inherited from v8::internal::HValue
enum  Flag {
  kFlexibleRepresentation , kCannotBeTagged , kUseGVN , kTrackSideEffectDominators ,
  kCanOverflow , kBailoutOnMinusZero , kCanBeDivByZero , kLeftCanBeMinInt ,
  kLeftCanBeNegative , kLeftCanBePositive , kAllowUndefinedAsNaN , kIsArguments ,
  kTruncatingToInt32 , kAllUsesTruncatingToInt32 , kTruncatingToSmi , kAllUsesTruncatingToSmi ,
  kIsDead , kUint32 , kHasNoObservableSideEffects , kCantBeReplaced ,
  kIsLive , kEndsLiveRange = kIsLive , kLastFlag = kIsLive
}
 
enum  Opcode { kPhi }
 
- Static Public Member Functions inherited from v8::internal::HValue
static HValuecast (HValue *value)
 
- Static Public Attributes inherited from v8::internal::HValue
static const int kNoNumber = -1
 
static const int kNoRedefinedOperand = -1
 
- Protected Member Functions inherited from v8::internal::HTemplateControlInstruction< 2, 2 >
void InternalSetOperandAt (int i, HValue *value) OVERRIDE
 
- Protected Member Functions inherited from v8::internal::HInstruction
 HInstruction (HType type=HType::Tagged())
 
virtual void DeleteFromGraph () OVERRIDE
 
- Protected Member Functions inherited from v8::internal::HValue
virtual bool DataEquals (HValue *other)
 
bool ToStringOrToNumberCanBeObserved () const
 
virtual Representation RepresentationFromInputs ()
 
virtual Representation RepresentationFromUses ()
 
Representation RepresentationFromUseRequirements ()
 
bool HasNonSmiUse ()
 
virtual void UpdateRepresentation (Representation new_rep, HInferRepresentationPhase *h_infer, const char *reason)
 
void AddDependantsToWorklist (HInferRepresentationPhase *h_infer)
 
virtual void RepresentationChanged (Representation to)
 
virtual Range * InferRange (Zone *zone)
 
void clear_block ()
 
void set_representation (Representation r)
 
HUseListNodeRemoveUse (HValue *value, int index)
 
void RegisterUse (int index, HValue *new_value)
 
- Static Protected Member Functions inherited from v8::internal::HValue
static GVNFlagSet AllFlagSet ()
 
static GVNFlagSet AllSideEffectsFlagSet ()
 
static GVNFlagSet AllObservableSideEffectsFlagSet ()
 
- Protected Attributes inherited from v8::internal::HValue
HBasicBlock * block_
 
int id_
 
Representation representation_
 
HType type_
 
HUseListNodeuse_list_
 
Range * range_
 
int flags_
 
GVNFlagSet changes_flags_
 
GVNFlagSet depends_on_flags_
 

Detailed Description

Definition at line 4279 of file hydrogen-instructions.h.

Constructor & Destructor Documentation

◆ HCompareNumericAndBranch()

v8::internal::HCompareNumericAndBranch::HCompareNumericAndBranch ( HValue left,
HValue right,
Token::Value  token,
HBasicBlock true_target = NULL,
HBasicBlock false_target = NULL 
)
inlineprivate

Definition at line 4321 of file hydrogen-instructions.h.

4326  : token_(token) {
4329  SetOperandAt(0, left);
4330  SetOperandAt(1, right);
4331  SetSuccessorAt(0, true_target);
4332  SetSuccessorAt(1, false_target);
4333  }
void SetSuccessorAt(int i, HBasicBlock *block) OVERRIDE
void SetOperandAt(int index, HValue *value)
static bool IsCompareOp(Value op)
Definition: token.h:202
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::internal::Token::IsCompareOp(), v8::internal::HValue::kFlexibleRepresentation, left(), right(), v8::internal::HValue::SetFlag(), v8::internal::HValue::SetOperandAt(), v8::internal::HTemplateControlInstruction< 2, 2 >::SetSuccessorAt(), and token().

+ Here is the call graph for this function:

Member Function Documentation

◆ DECLARE_INSTRUCTION_FACTORY_P3()

v8::internal::HCompareNumericAndBranch::DECLARE_INSTRUCTION_FACTORY_P3 ( HCompareNumericAndBranch  ,
HValue ,
HValue ,
Token::Value   
)

◆ DECLARE_INSTRUCTION_FACTORY_P5()

v8::internal::HCompareNumericAndBranch::DECLARE_INSTRUCTION_FACTORY_P5 ( HCompareNumericAndBranch  ,
HValue ,
HValue ,
Token::Value  ,
HBasicBlock ,
HBasicBlock  
)

◆ InferRepresentation()

void v8::internal::HCompareNumericAndBranch::InferRepresentation ( HInferRepresentationPhase h_infer)
virtual

Reimplemented from v8::internal::HValue.

Definition at line 3348 of file hydrogen-instructions.cc.

3349  {
3350  Representation left_rep = left()->representation();
3351  Representation right_rep = right()->representation();
3352  Representation observed_left = observed_input_representation(0);
3353  Representation observed_right = observed_input_representation(1);
3354 
3355  Representation rep = Representation::None();
3356  rep = rep.generalize(observed_left);
3357  rep = rep.generalize(observed_right);
3358  if (rep.IsNone() || rep.IsSmiOrInteger32()) {
3359  if (!left_rep.IsTagged()) rep = rep.generalize(left_rep);
3360  if (!right_rep.IsTagged()) rep = rep.generalize(right_rep);
3361  } else {
3362  rep = Representation::Double();
3363  }
3364 
3365  if (rep.IsDouble()) {
3366  // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, ===
3367  // and !=) have special handling of undefined, e.g. undefined == undefined
3368  // is 'true'. Relational comparisons have a different semantic, first
3369  // calling ToPrimitive() on their arguments. The standard Crankshaft
3370  // tagged-to-double conversion to ensure the HCompareNumericAndBranch's
3371  // inputs are doubles caused 'undefined' to be converted to NaN. That's
3372  // compatible out-of-the box with ordered relational comparisons (<, >, <=,
3373  // >=). However, for equality comparisons (and for 'in' and 'instanceof'),
3374  // it is not consistent with the spec. For example, it would cause undefined
3375  // == undefined (should be true) to be evaluated as NaN == NaN
3376  // (false). Therefore, any comparisons other than ordered relational
3377  // comparisons must cause a deopt when one of their arguments is undefined.
3378  // See also v8:1434
3381  }
3382  }
3383  ChangeRepresentation(rep);
3384 }
virtual Representation observed_input_representation(int index) OVERRIDE
void ChangeRepresentation(Representation r)
Representation representation() const
static Representation Double()
static Representation None()
static bool IsOrderedRelationalCompareOp(Value op)
Definition: token.h:206

References v8::internal::Representation::generalize(), v8::internal::Representation::IsDouble(), v8::internal::Representation::IsNone(), v8::internal::Representation::IsSmiOrInteger32(), v8::internal::Representation::IsTagged(), and v8::None.

+ Here is the call graph for this function:

◆ KnownSuccessorBlock()

bool v8::internal::HCompareNumericAndBranch::KnownSuccessorBlock ( HBasicBlock **  block)
virtual

Reimplemented from v8::internal::HControlInstruction.

Definition at line 3303 of file hydrogen-instructions.cc.

3303  {
3304  if (left() == right() &&
3305  left()->representation().IsSmiOrInteger32()) {
3306  *block = (token() == Token::EQ ||
3307  token() == Token::EQ_STRICT ||
3308  token() == Token::LTE ||
3309  token() == Token::GTE)
3311  return true;
3312  }
3313  *block = NULL;
3314  return false;
3315 }
HBasicBlock * block() const
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::EQ, and NULL.

◆ left()

HValue* v8::internal::HCompareNumericAndBranch::left ( ) const
inline

Definition at line 4287 of file hydrogen-instructions.h.

4287 { return OperandAt(0); }

References v8::internal::HTemplateControlInstruction< 2, 2 >::OperandAt().

Referenced by HCompareNumericAndBranch(), v8::internal::HRangeAnalysisPhase::InferControlFlowRange(), and set_observed_input_representation().

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

◆ observed_input_representation()

virtual Representation v8::internal::HCompareNumericAndBranch::observed_input_representation ( int  index)
inlinevirtual

Reimplemented from v8::internal::HValue.

Definition at line 4303 of file hydrogen-instructions.h.

4303  {
4304  return observed_input_representation_[index];
4305  }

References observed_input_representation_.

◆ PrintDataTo()

OStream & v8::internal::HCompareNumericAndBranch::PrintDataTo ( OStream os) const
virtual

Reimplemented from v8::internal::HControlInstruction.

Definition at line 3197 of file hydrogen-instructions.cc.

3197  { // NOLINT
3198  os << Token::Name(token()) << " " << NameOf(left()) << " " << NameOf(right());
3200 }
virtual OStream & PrintDataTo(OStream &os) const OVERRIDE
static const char * Name(Value tok)
Definition: token.h:180

◆ RequiredInputRepresentation()

virtual Representation v8::internal::HCompareNumericAndBranch::RequiredInputRepresentation ( int  index)
inlinevirtual

Implements v8::internal::HValue.

Definition at line 4300 of file hydrogen-instructions.h.

4300  {
4301  return representation();
4302  }

References v8::internal::HValue::representation().

+ Here is the call graph for this function:

◆ right()

HValue* v8::internal::HCompareNumericAndBranch::right ( ) const
inline

Definition at line 4288 of file hydrogen-instructions.h.

4288 { return OperandAt(1); }

References v8::internal::HTemplateControlInstruction< 2, 2 >::OperandAt().

Referenced by HCompareNumericAndBranch(), v8::internal::HRangeAnalysisPhase::InferControlFlowRange(), and set_observed_input_representation().

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

◆ set_observed_input_representation()

void v8::internal::HCompareNumericAndBranch::set_observed_input_representation ( Representation  left,
Representation  right 
)
inline

Definition at line 4291 of file hydrogen-instructions.h.

4292  {
4295  }

References left(), observed_input_representation_, and right().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildCompareInstruction().

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

◆ SetOperandPositions()

void v8::internal::HCompareNumericAndBranch::SetOperandPositions ( Zone zone,
HSourcePosition  left_pos,
HSourcePosition  right_pos 
)
inline

Definition at line 4311 of file hydrogen-instructions.h.

4313  {
4314  set_operand_position(zone, 0, left_pos);
4315  set_operand_position(zone, 1, right_pos);
4316  }
void set_operand_position(Zone *zone, int index, HSourcePosition pos)

References v8::internal::HInstruction::set_operand_position().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildCompareInstruction().

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

◆ token()

Token::Value v8::internal::HCompareNumericAndBranch::token ( ) const
inline

Definition at line 4289 of file hydrogen-instructions.h.

4289 { return token_; }

References token_.

Referenced by HCompareNumericAndBranch(), and v8::internal::HRangeAnalysisPhase::InferControlFlowRange().

+ Here is the caller graph for this function:

Member Data Documentation

◆ observed_input_representation_

Representation v8::internal::HCompareNumericAndBranch::observed_input_representation_[2]
private

◆ token_

Token::Value v8::internal::HCompareNumericAndBranch::token_
private

Definition at line 4336 of file hydrogen-instructions.h.

Referenced by token().


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