V8 Project
v8::internal::CompareICState Class Reference

#include <ic-state.h>

+ Collaboration diagram for v8::internal::CompareICState:

Public Types

enum  State {
  UNINITIALIZED , SMI , NUMBER , STRING ,
  INTERNALIZED_STRING , UNIQUE_NAME , OBJECT , KNOWN_OBJECT ,
  GENERIC
}
 

Static Public Member Functions

static TypeStateToType (Zone *zone, State state, Handle< Map > map=Handle< Map >())
 
static State NewInputState (State old_state, Handle< Object > value)
 
static const char * GetStateName (CompareICState::State state)
 
static State TargetState (State old_state, State old_left, State old_right, Token::Value op, bool has_inlined_smi_code, Handle< Object > x, Handle< Object > y)
 

Detailed Description

Definition at line 179 of file ic-state.h.

Member Enumeration Documentation

◆ State

Enumerator
UNINITIALIZED 
SMI 
NUMBER 
STRING 
INTERNALIZED_STRING 
UNIQUE_NAME 
OBJECT 
KNOWN_OBJECT 
GENERIC 

Definition at line 187 of file ic-state.h.

187  {
189  SMI,
190  NUMBER,
191  STRING,
193  UNIQUE_NAME, // Symbol or InternalizedString
194  OBJECT, // JSObject
195  KNOWN_OBJECT, // JSObject with specific map (faster check)
196  GENERIC
197  };

Member Function Documentation

◆ GetStateName()

const char * v8::internal::CompareICState::GetStateName ( CompareICState::State  state)
static

Definition at line 457 of file ic-state.cc.

457  {
458  switch (state) {
459  case UNINITIALIZED:
460  return "UNINITIALIZED";
461  case SMI:
462  return "SMI";
463  case NUMBER:
464  return "NUMBER";
465  case INTERNALIZED_STRING:
466  return "INTERNALIZED_STRING";
467  case STRING:
468  return "STRING";
469  case UNIQUE_NAME:
470  return "UNIQUE_NAME";
471  case OBJECT:
472  return "OBJECT";
473  case KNOWN_OBJECT:
474  return "KNOWN_OBJECT";
475  case GENERIC:
476  return "GENERIC";
477  }
478  UNREACHABLE();
479  return NULL;
480 }
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
#define UNREACHABLE()
Definition: logging.h:30

References v8::internal::GENERIC, INTERNALIZED_STRING, NULL, STRING, v8::internal::UNINITIALIZED, and UNREACHABLE.

Referenced by v8::internal::CompareIC::UpdateCaches().

+ Here is the caller graph for this function:

◆ NewInputState()

CompareICState::State v8::internal::CompareICState::NewInputState ( State  old_state,
Handle< Object value 
)
static

Definition at line 509 of file ic-state.cc.

510  {
511  switch (old_state) {
512  case UNINITIALIZED:
513  if (value->IsSmi()) return SMI;
514  if (value->IsHeapNumber()) return NUMBER;
515  if (value->IsInternalizedString()) return INTERNALIZED_STRING;
516  if (value->IsString()) return STRING;
517  if (value->IsSymbol()) return UNIQUE_NAME;
518  if (value->IsJSObject()) return OBJECT;
519  break;
520  case SMI:
521  if (value->IsSmi()) return SMI;
522  if (value->IsHeapNumber()) return NUMBER;
523  break;
524  case NUMBER:
525  if (value->IsNumber()) return NUMBER;
526  break;
527  case INTERNALIZED_STRING:
528  if (value->IsInternalizedString()) return INTERNALIZED_STRING;
529  if (value->IsString()) return STRING;
530  if (value->IsSymbol()) return UNIQUE_NAME;
531  break;
532  case STRING:
533  if (value->IsString()) return STRING;
534  break;
535  case UNIQUE_NAME:
536  if (value->IsUniqueName()) return UNIQUE_NAME;
537  break;
538  case OBJECT:
539  if (value->IsJSObject()) return OBJECT;
540  break;
541  case GENERIC:
542  break;
543  case KNOWN_OBJECT:
544  UNREACHABLE();
545  break;
546  }
547  return GENERIC;
548 }

References v8::internal::GENERIC, INTERNALIZED_STRING, STRING, v8::internal::UNINITIALIZED, and UNREACHABLE.

Referenced by v8::internal::CompareIC::UpdateCaches().

+ Here is the caller graph for this function:

◆ StateToType()

Type * v8::internal::CompareICState::StateToType ( Zone zone,
State  state,
Handle< Map map = Handle<Map>() 
)
static

Definition at line 483 of file ic-state.cc.

483  {
484  switch (state) {
485  case UNINITIALIZED:
486  return Type::None(zone);
487  case SMI:
488  return Type::SignedSmall(zone);
489  case NUMBER:
490  return Type::Number(zone);
491  case STRING:
492  return Type::String(zone);
493  case INTERNALIZED_STRING:
494  return Type::InternalizedString(zone);
495  case UNIQUE_NAME:
496  return Type::UniqueName(zone);
497  case OBJECT:
498  return Type::Receiver(zone);
499  case KNOWN_OBJECT:
500  return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone);
501  case GENERIC:
502  return Type::Any(zone);
503  }
504  UNREACHABLE();
505  return NULL;
506 }
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 map
TypeImpl< ZoneTypeConfig > Type
@ None
Definition: v8.h:2211

References v8::internal::GENERIC, INTERNALIZED_STRING, map, v8::None, NULL, STRING, v8::internal::UNINITIALIZED, and UNREACHABLE.

Referenced by v8::internal::TypeFeedbackOracle::CompareType().

+ Here is the caller graph for this function:

◆ TargetState()

CompareICState::State v8::internal::CompareICState::TargetState ( State  old_state,
State  old_left,
State  old_right,
Token::Value  op,
bool  has_inlined_smi_code,
Handle< Object x,
Handle< Object y 
)
static

Definition at line 552 of file ic-state.cc.

554  {
555  switch (old_state) {
556  case UNINITIALIZED:
557  if (x->IsSmi() && y->IsSmi()) return SMI;
558  if (x->IsNumber() && y->IsNumber()) return NUMBER;
560  // Ordered comparisons treat undefined as NaN, so the
561  // NUMBER stub will do the right thing.
562  if ((x->IsNumber() && y->IsUndefined()) ||
563  (y->IsNumber() && x->IsUndefined())) {
564  return NUMBER;
565  }
566  }
567  if (x->IsInternalizedString() && y->IsInternalizedString()) {
568  // We compare internalized strings as plain ones if we need to determine
569  // the order in a non-equality compare.
571  }
572  if (x->IsString() && y->IsString()) return STRING;
573  if (!Token::IsEqualityOp(op)) return GENERIC;
574  if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME;
575  if (x->IsJSObject() && y->IsJSObject()) {
576  if (Handle<JSObject>::cast(x)->map() ==
578  return KNOWN_OBJECT;
579  } else {
580  return OBJECT;
581  }
582  }
583  return GENERIC;
584  case SMI:
585  return x->IsNumber() && y->IsNumber() ? NUMBER : GENERIC;
586  case INTERNALIZED_STRING:
588  if (x->IsString() && y->IsString()) return STRING;
589  if (x->IsUniqueName() && y->IsUniqueName()) return UNIQUE_NAME;
590  return GENERIC;
591  case NUMBER:
592  // If the failure was due to one side changing from smi to heap number,
593  // then keep the state (if other changed at the same time, we will get
594  // a second miss and then go to generic).
595  if (old_left == SMI && x->IsHeapNumber()) return NUMBER;
596  if (old_right == SMI && y->IsHeapNumber()) return NUMBER;
597  return GENERIC;
598  case KNOWN_OBJECT:
600  if (x->IsJSObject() && y->IsJSObject()) {
601  return OBJECT;
602  }
603  return GENERIC;
604  case STRING:
605  case UNIQUE_NAME:
606  case OBJECT:
607  case GENERIC:
608  return GENERIC;
609  }
610  UNREACHABLE();
611  return GENERIC; // Make the compiler happy.
612 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
static bool IsOrderedRelationalCompareOp(Value op)
Definition: token.h:206
static bool IsEqualityOp(Value op)
Definition: token.h:210
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::internal::GENERIC, INTERNALIZED_STRING, map, STRING, v8::internal::UNINITIALIZED, UNREACHABLE, and v8::base::internal::y.

Referenced by v8::internal::CompareIC::UpdateCaches().

+ Here is the caller graph for this function:

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