V8 Project
v8::internal::BinaryOpIC Class Reference

#include <ic.h>

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

Public Member Functions

 BinaryOpIC (Isolate *isolate)
 
MaybeHandle< ObjectTransition (Handle< AllocationSite > allocation_site, Handle< Object > left, Handle< Object > right) WARN_UNUSED_RESULT
 
- Public Member Functions inherited from v8::internal::IC
 IC (FrameDepth depth, Isolate *isolate)
 
virtual ~IC ()
 
State state () const
 
Address address () const
 
void UpdateState (Handle< Object > receiver, Handle< Object > name)
 
bool IsNameCompatibleWithPrototypeFailure (Handle< Object > name)
 
void MarkPrototypeFailure (Handle< Object > name)
 

Static Public Member Functions

static Builtins::JavaScript TokenToJSBuiltin (Token::Value op)
 
- Static Public Member Functions inherited from v8::internal::IC
static Address AddressFromUtilityId (UtilityId id)
 
static void RegisterWeakMapDependency (Handle< Code > stub)
 
static void InvalidateMaps (Code *stub)
 
static void Clear (Isolate *isolate, Address address, ConstantPoolArray *constant_pool)
 
template<class TypeClass >
static JSFunctionGetRootConstructor (TypeClass *type, Context *native_context)
 
static Handle< MapGetHandlerCacheHolder (HeapType *type, bool receiver_is_holder, Isolate *isolate, CacheHolderFlag *flag)
 
static Handle< MapGetICCacheHolder (HeapType *type, Isolate *isolate, CacheHolderFlag *flag)
 
static bool IsCleared (Code *code)
 
static Handle< MapTypeToMap (HeapType *type, Isolate *isolate)
 
template<class T >
static T::TypeHandle MapToType (Handle< Map > map, typename T::Region *region)
 
static Handle< HeapTypeCurrentTypeOf (Handle< Object > object, Isolate *isolate)
 

Additional Inherited Members

- Public Types inherited from v8::internal::IC
enum  UtilityId { kUtilityCount }
 
enum  FrameDepth { NO_EXTRA_FRAME = 0 , EXTRA_CALL_FRAME = 1 }
 
typedef InlineCacheState State
 
- Protected Member Functions inherited from v8::internal::IC
Handle< Codetarget () const
 
Address fp () const
 
Address pc () const
 
Isolateisolate () const
 
SharedFunctionInfoGetSharedFunctionInfo () const
 
CodeGetCode () const
 
CodeGetOriginalCode () const
 
void set_target (Code *code)
 
bool is_target_set ()
 
char TransitionMarkFromState (IC::State state)
 
void TraceIC (const char *type, Handle< Object > name)
 
void TraceIC (const char *type, Handle< Object > name, State old_state, State new_state)
 
MaybeHandle< ObjectTypeError (const char *type, Handle< Object > object, Handle< Object > key)
 
MaybeHandle< ObjectReferenceError (const char *type, Handle< Name > name)
 
Handle< CodeComputeHandler (LookupIterator *lookup, Handle< Object > value=Handle< Code >::null())
 
virtual Handle< CodeCompileHandler (LookupIterator *lookup, Handle< Object > value, CacheHolderFlag cache_holder)
 
void UpdateMonomorphicIC (Handle< Code > handler, Handle< Name > name)
 
bool UpdatePolymorphicIC (Handle< Name > name, Handle< Code > code)
 
void UpdateMegamorphicCache (HeapType *type, Name *name, Code *code)
 
void CopyICToMegamorphicCache (Handle< Name > name)
 
bool IsTransitionOfMonomorphicTarget (Map *source_map, Map *target_map)
 
void PatchCache (Handle< Name > name, Handle< Code > code)
 
Code::Kind kind () const
 
Code::Kind handler_kind () const
 
virtual Handle< Codemegamorphic_stub ()
 
bool TryRemoveInvalidPrototypeDependentStub (Handle< Object > receiver, Handle< String > name)
 
ExtraICState extra_ic_state () const
 
void set_extra_ic_state (ExtraICState state)
 
Handle< HeapTypereceiver_type ()
 
void update_receiver_type (Handle< Object > receiver)
 
void TargetMaps (MapHandleList *list)
 
void TargetTypes (TypeHandleList *list)
 
MapFirstTargetMap ()
 
void UpdateTarget ()
 
- Static Protected Member Functions inherited from v8::internal::IC
static CodeGetTargetAtAddress (Address address, ConstantPoolArray *constant_pool)
 
static void SetTargetAtAddress (Address address, Code *target, ConstantPoolArray *constant_pool)
 
static void OnTypeFeedbackChanged (Isolate *isolate, Address address, State old_state, State new_state, bool target_remains_ic_stub)
 
static void PostPatching (Address address, Code *target, Code *old_target)
 

Detailed Description

Definition at line 604 of file ic.h.

Constructor & Destructor Documentation

◆ BinaryOpIC()

v8::internal::BinaryOpIC::BinaryOpIC ( Isolate isolate)
inlineexplicit

Definition at line 606 of file ic.h.

Isolate * isolate() const
Definition: ic.h:136
IC(FrameDepth depth, Isolate *isolate)
Definition: ic.cc:141
@ EXTRA_CALL_FRAME
Definition: ic.h:59

Member Function Documentation

◆ TokenToJSBuiltin()

Builtins::JavaScript v8::internal::BinaryOpIC::TokenToJSBuiltin ( Token::Value  op)
static

Definition at line 2454 of file ic.cc.

2454  {
2455  switch (op) {
2456  default:
2457  UNREACHABLE();
2458  case Token::ADD:
2459  return Builtins::ADD;
2460  break;
2461  case Token::SUB:
2462  return Builtins::SUB;
2463  break;
2464  case Token::MUL:
2465  return Builtins::MUL;
2466  break;
2467  case Token::DIV:
2468  return Builtins::DIV;
2469  break;
2470  case Token::MOD:
2471  return Builtins::MOD;
2472  break;
2473  case Token::BIT_OR:
2474  return Builtins::BIT_OR;
2475  break;
2476  case Token::BIT_AND:
2477  return Builtins::BIT_AND;
2478  break;
2479  case Token::BIT_XOR:
2480  return Builtins::BIT_XOR;
2481  break;
2482  case Token::SAR:
2483  return Builtins::SAR;
2484  break;
2485  case Token::SHR:
2486  return Builtins::SHR;
2487  break;
2488  case Token::SHL:
2489  return Builtins::SHL;
2490  break;
2491  }
2492 }
#define UNREACHABLE()
Definition: logging.h:30

References v8::internal::ADD, v8::internal::DIV, v8::internal::MUL, v8::internal::SUB, and UNREACHABLE.

Referenced by v8::internal::HGraphBuilder::BuildBinaryOperation(), and Transition().

+ Here is the caller graph for this function:

◆ Transition()

MaybeHandle< Object > v8::internal::BinaryOpIC::Transition ( Handle< AllocationSite allocation_site,
Handle< Object left,
Handle< Object right 
)

Definition at line 2218 of file ic.cc.

2220  {
2221  BinaryOpICState state(isolate(), target()->extra_ic_state());
2222 
2223  // Compute the actual result using the builtin for the binary operation.
2224  Object* builtin = isolate()->js_builtins_object()->javascript_builtin(
2225  TokenToJSBuiltin(state.op()));
2226  Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate());
2227  Handle<Object> result;
2229  isolate(), result, Execution::Call(isolate(), function, left, 1, &right),
2230  Object);
2231 
2232  // Execution::Call can execute arbitrary JavaScript, hence potentially
2233  // update the state of this very IC, so we must update the stored state.
2234  UpdateTarget();
2235  // Compute the new state.
2236  BinaryOpICState old_state(isolate(), target()->extra_ic_state());
2237  state.Update(left, right, result);
2238 
2239  // Check if we have a string operation here.
2240  Handle<Code> target;
2241  if (!allocation_site.is_null() || state.ShouldCreateAllocationMementos()) {
2242  // Setup the allocation site on-demand.
2243  if (allocation_site.is_null()) {
2244  allocation_site = isolate()->factory()->NewAllocationSite();
2245  }
2246 
2247  // Install the stub with an allocation site.
2248  BinaryOpICWithAllocationSiteStub stub(isolate(), state);
2249  target = stub.GetCodeCopyFromTemplate(allocation_site);
2250 
2251  // Sanity check the trampoline stub.
2252  DCHECK_EQ(*allocation_site, target->FindFirstAllocationSite());
2253  } else {
2254  // Install the generic stub.
2255  BinaryOpICStub stub(isolate(), state);
2256  target = stub.GetCode();
2257 
2258  // Sanity check the generic stub.
2259  DCHECK_EQ(NULL, target->FindFirstAllocationSite());
2260  }
2261  set_target(*target);
2262 
2263  if (FLAG_trace_ic) {
2264  OFStream os(stdout);
2265  os << "[BinaryOpIC" << old_state << " => " << state << " @ "
2266  << static_cast<void*>(*target) << " <- ";
2267  JavaScriptFrame::PrintTop(isolate(), stdout, false, true);
2268  if (!allocation_site.is_null()) {
2269  os << " using allocation site " << static_cast<void*>(*allocation_site);
2270  }
2271  os << "]" << endl;
2272  }
2273 
2274  // Patch the inlined smi code as necessary.
2275  if (!old_state.UseInlinedSmiCode() && state.UseInlinedSmiCode()) {
2277  } else if (old_state.UseInlinedSmiCode() && !state.UseInlinedSmiCode()) {
2279  }
2280 
2281  return result;
2282 }
static Builtins::JavaScript TokenToJSBuiltin(Token::Value op)
Definition: ic.cc:2454
void UpdateTarget()
Definition: ic-inl.h:158
State state() const
Definition: ic.h:66
ExtraICState extra_ic_state() const
Definition: ic.h:200
Address address() const
Definition: ic-inl.h:19
Handle< Code > target() const
Definition: ic.h:132
void set_target(Code *code)
Definition: ic-inl.h:121
Handle< JSBuiltinsObject > js_builtins_object()
Definition: isolate.h:679
Factory * factory()
Definition: isolate.h:982
static void PrintTop(Isolate *isolate, FILE *file, bool print_args, bool print_line_number)
Definition: frames.cc:811
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 ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
Definition: isolate.h:135
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
@ DISABLE_INLINED_SMI_CHECK
Definition: ic.h:672
@ ENABLE_INLINED_SMI_CHECK
Definition: ic.h:672
OStream & endl(OStream &os)
Definition: ostreams.cc:112
kSerializedDataOffset Object
Definition: objects-inl.h:5322
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check)

References v8::internal::IC::address(), ASSIGN_RETURN_ON_EXCEPTION, DCHECK_EQ, v8::internal::DISABLE_INLINED_SMI_CHECK, v8::internal::ENABLE_INLINED_SMI_CHECK, v8::internal::endl(), v8::internal::IC::extra_ic_state(), v8::internal::Isolate::factory(), v8::internal::handle(), v8::internal::Handle< T >::is_null(), v8::internal::IC::isolate(), v8::internal::Isolate::js_builtins_object(), NULL, v8::internal::PatchInlinedSmiCode(), v8::internal::JavaScriptFrame::PrintTop(), v8::internal::IC::set_target(), v8::internal::IC::state(), v8::internal::IC::target(), TokenToJSBuiltin(), and v8::internal::IC::UpdateTarget().

+ Here is the call graph for this function:

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