42 #define IC_UTIL_LIST(ICU) \
44 ICU(KeyedLoadIC_Miss) \
46 ICU(StoreIC_ArrayLength) \
48 ICU(SharedStoreIC_ExtendStorage) \
49 ICU(KeyedStoreIC_Miss) \
50 ICU(KeyedStoreIC_Slow) \
52 ICU(StoreCallbackProperty) \
53 ICU(LoadPropertyWithInterceptorOnly) \
54 ICU(LoadPropertyWithInterceptorForLoad) \
55 ICU(LoadPropertyWithInterceptorForCall) \
56 ICU(KeyedLoadPropertyWithInterceptor) \
57 ICU(StoreInterceptorProperty) \
59 ICU(BinaryOpIC_Miss) \
60 ICU(CompareNilIC_Miss) \
70 #define CONST_NAME(name) k##name,
109 bool IsLoadStub()
const {
110 return target()->is_load_stub() ||
target()->is_keyed_load_stub();
113 bool IsStoreStub()
const {
114 return target()->is_store_stub() ||
target()->is_keyed_store_stub();
146 typename T::Region* region);
159 #ifdef ENABLE_DEBUGGER_SUPPORT
163 Code* GetCode()
const;
165 Code* GetOriginalCode()
const;
247 extra_ic_state_ =
state;
252 target_ =
handle(raw_target(), isolate_);
256 Code* raw_target()
const {
259 inline ConstantPoolArray* constant_pool()
const;
260 inline ConstantPoolArray* raw_constant_pool()
const;
284 DISALLOW_IMPLICIT_CONSTRUCTORS(
IC);
293 : address_(
IC::AddressFromUtilityId(id)), id_(id) {}
323 :
IC(depth, isolate) {
330 if (receiver->IsGlobalObject()) {
393 bool inobject =
true,
394 Representation representation =
400 ConstantPoolArray* constant_pool);
409 :
LoadIC(depth, isolate) {
455 return isolate->
builtins()->KeyedLoadIC_PreMonomorphic();
458 return pre_monomorphic_stub(
isolate());
460 Handle<Code> indexed_interceptor_stub() {
463 Handle<Code> sloppy_arguments_stub() {
466 Handle<Code> string_stub() {
470 static void Clear(Isolate* isolate,
473 ConstantPoolArray* constant_pool);
495 :
IC(depth, isolate) {
563 static void Clear(
Isolate* isolate,
566 ConstantPoolArray* constant_pool);
589 public BitField<KeyedAccessStoreMode, 2, 4> {};
633 if (strict_mode ==
STRICT) {
634 return isolate->
builtins()->KeyedStoreIC_PreMonomorphic_Strict();
636 return isolate->
builtins()->KeyedStoreIC_PreMonomorphic();
654 void set_target(
Code* code) {
669 Handle<Code> sloppy_arguments_stub() {
673 static void Clear(Isolate* isolate,
676 ConstantPoolArray* constant_pool);
680 Handle<Object> value);
682 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver,
700 : op_(op), mode_(mode), left_kind_(
NONE), right_kind_(
NONE),
707 if (
Max(left_kind_, right_kind_) ==
NONE) {
710 if (
Max(left_kind_, right_kind_) ==
GENERIC) {
713 if (
Min(left_kind_, right_kind_) ==
GENERIC) {
721 static void GenerateAheadOfTime(
725 return (result_kind_ > SMI && result_kind_ <= NUMBER) &&
727 left_kind_ > SMI && left_kind_ <= NUMBER) ||
729 right_kind_ > SMI && right_kind_ <= NUMBER));
743 return FLAG_allocation_site_pretenuring &&
744 CouldCreateAllocationMementos();
748 return Max(left_kind_, right_kind_) ==
GENERIC;
754 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_);
757 static const int FIRST_TOKEN = Token::BIT_OR;
758 static const int LAST_TOKEN = Token::MOD;
765 return KindToType(left_kind_, zone);
768 return KindToType(right_kind_, zone);
770 Type* GetResultType(
Zone* zone)
const;
783 static const char* KindToString(Kind
kind);
785 static bool KindMaybeSmi(Kind
kind) {
786 return (kind >= SMI && kind <= NUMBER) || kind ==
GENERIC;
791 class OpField:
public BitField<int, 0, 4> {};
792 class OverwriteModeField:
public BitField<OverwriteMode, 4, 2> {};
793 class SSE2Field:
public BitField<bool, 6, 1> {};
794 class ResultKindField:
public BitField<Kind, 7, 3> {};
795 class LeftKindField:
public BitField<Kind, 10, 3> {};
798 class HasFixedRightArgField:
public BitField<bool, 13, 1> {};
799 class FixedRightArgValueField:
public BitField<int, 14, 4> {};
800 class RightKindField:
public BitField<Kind, 14, 3> {};
807 Maybe<int> fixed_right_arg_;
874 bool has_inlined_smi_code,
878 bool strict()
const {
return op_ == Token::EQ_STRICT; }
881 static Code* GetRawUninitialized(Isolate* isolate,
Token::Value op);
883 static void Clear(Isolate* isolate,
886 ConstantPoolArray* constant_pool);
static Handle< Code > initialize_stub(Isolate *isolate, StrictMode strict_mode)
static void GenerateSloppyArguments(MacroAssembler *masm)
ExtraICState extra_ic_state() const
void CopyICToMegamorphicCache(Handle< String > name)
static void GenerateRuntimeGetProperty(MacroAssembler *masm)
OverwriteMode mode() const
virtual Handle< Code > slow_stub() const
static ExtraICState ComputeExtraICState(StrictMode flag)
virtual void UpdateMegamorphicCache(HeapType *type, Name *name, Code *code)
static MUST_USE_RESULT MaybeObject * DoCompareNilSlow(NilValue nil, Handle< Object > object)
LoadIC(FrameDepth depth, Isolate *isolate)
virtual Code::Kind kind() const
void UpdateState(Handle< Object > receiver, Handle< Object > name)
MUST_USE_RESULT MaybeObject * Load(Handle< Object > object, Handle< String > name)
static ExtraICState ComputeExtraICState(StrictMode flag, KeyedAccessStoreMode mode)
static const ExtraICState kStrictModeState
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
virtual Handle< Code > slow_stub() const
static HeapObject * GetCodeCacheHolder(Isolate *isolate, Object *object, InlineCacheHolderFlag holder)
virtual Code::Kind kind() const
void set_extra_ic_state(ExtraICState state)
IC_Utility(IC::UtilityId id)
static ExtraICState ComputeExtraICState(ContextualMode contextual_mode)
virtual void UpdateMegamorphicCache(HeapType *type, Name *name, Code *code)
virtual Handle< Code > slow_stub() const
static void GenerateMiss(MacroAssembler *masm)
static Handle< Code > GetUninitialized(Isolate *isolate, Token::Value op)
Code * UpdateCaches(Handle< Object > x, Handle< Object > y)
bool CanReuseDoubleBox() const
CompareIC(Isolate *isolate, Token::Value op)
static ContextualMode GetContextualMode(ExtraICState state)
static void Clear(Address address, Code *target, ConstantPoolArray *constant_pool)
kSerializedDataOffset Object
static State NewInputState(State old_state, Handle< Object > value)
virtual Handle< Code > CompileHandler(LookupResult *lookup, Handle< Object > object, Handle< String > name, Handle< Object > value, InlineCacheHolderFlag cache_holder)
static void Clear(Isolate *isolate, Address address, ConstantPoolArray *constant_pool)
static void GenerateRuntimeSetProperty(MacroAssembler *masm, StrictMode strict_mode)
static const int kIsAccessCheckNeeded
Handle< Code > LoadElementStub(Handle< JSObject > receiver)
static void GenerateMegamorphic(MacroAssembler *masm)
Failure * TypeError(const char *type, Handle< Object > object, Handle< Object > key)
#define ASSERT(condition)
Isolate * isolate() const
static void GenerateMegamorphic(MacroAssembler *masm)
static Handle< Code > initialize_stub(Isolate *isolate, ExtraICState extra_state)
void TryRemoveInvalidHandlers(Handle< Map > map, Handle< String > name)
virtual Handle< Code > megamorphic_stub()
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check)
MaybeObject * Transition(Handle< AllocationSite > allocation_site, Handle< Object > left, Handle< Object > right) V8_WARN_UNUSED_RESULT
StrictMode strict_mode() const
kInstanceClassNameOffset flag
static void GenerateGeneric(MacroAssembler *masm, StrictMode strict_mode)
MUST_USE_RESULT MaybeObject * Store(Handle< Object > object, Handle< Object > name, Handle< Object > value)
bool CouldCreateAllocationMementos() const
static void StubInfoToType(int stub_minor_key, Type **left_type, Type **right_type, Type **overall_type, Handle< Map > map, Zone *zone)
bool HasSideEffects() const
static const int kHasIndexedInterceptor
virtual Handle< Code > pre_monomorphic_stub()
bool IsTransitionOfMonomorphicTarget(Map *source_map, Map *target_map)
static Handle< Code > pre_monomorphic_stub(Isolate *isolate, StrictMode strict_mode)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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_string(expose_natives_as
static Condition ComputeCondition(Token::Value op)
static void PostPatching(Address address, Code *target, Code *old_target)
Type * GetRightType(Zone *zone) const
static void GenerateInitialize(MacroAssembler *masm)
virtual Handle< Code > megamorphic_stub()
void PatchCache(Handle< HeapType > type, Handle< String > name, Handle< Code > code)
void UpdateMonomorphicIC(Handle< HeapType > type, Handle< Code > handler, Handle< String > name)
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
virtual Handle< Code > slow_stub() const
virtual Handle< Code > CompileHandler(LookupResult *lookup, Handle< Object > object, Handle< String > name, Handle< Object > value, InlineCacheHolderFlag cache_holder)
IC(FrameDepth depth, Isolate *isolate)
static Handle< HeapType > CurrentTypeOf(Handle< Object > object, Isolate *isolate)
KeyedLoadIC(FrameDepth depth, Isolate *isolate)
virtual Handle< Code > generic_stub() const
virtual Handle< Code > megamorphic_stub()
static void GeneratePreMonomorphic(MacroAssembler *masm)
void check(i::Vector< const uint8_t > string)
static void GeneratePreMonomorphic(MacroAssembler *masm)
static KeyedAccessStoreMode GetKeyedAccessStoreMode(ExtraICState extra_state)
static void GenerateGeneric(MacroAssembler *masm)
static void GenerateInitialize(MacroAssembler *masm)
static void GenerateMiss(MacroAssembler *masm)
InlineCacheState GetICState() const
ToBooleanIC(Isolate *isolate)
bool IsUndeclaredGlobal(Handle< Object > receiver)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static bool IsCleared(Code *code)
static void GenerateRuntimeSetProperty(MacroAssembler *masm, StrictMode strict_mode)
KeyedStoreIC(FrameDepth depth, Isolate *isolate)
static const uint32_t kShift
static Handle< Code > GetUninitialized()
virtual Code::Kind kind() const
#define ASSERT_LE(v1, v2)
STATIC_ASSERT(static_cast< int >(NOT_CONTEXTUAL)==0)
Handle< Code > ComputeHandler(LookupResult *lookup, Handle< Object > object, Handle< String > name, Handle< Object > value=Handle< Code >::null())
static Type * StateToType(Zone *zone, State state, Handle< Map > map=Handle< Map >())
static void GenerateSlow(MacroAssembler *masm)
void MarkMonomorphicPrototypeFailure()
virtual Code::Kind kind() const
InlineCacheState ic_state()
bool UseInlinedSmiCode() const
static void SetTargetAtAddress(Address address, Code *target, ConstantPoolArray *constant_pool)
static Code * GetTargetAtAddress(Address address, ConstantPoolArray *constant_pool)
static void GenerateRuntimeGetProperty(MacroAssembler *masm)
static void GenerateSloppyArguments(MacroAssembler *masm)
static StrictMode GetStrictMode(ExtraICState state)
virtual Handle< Code > generic_stub() const
void UpdateCaches(LookupResult *lookup, Handle< JSObject > receiver, Handle< String > name, Handle< Object > value)
virtual Handle< Code > generic_stub() const
static void GeneratePreMonomorphic(MacroAssembler *masm)
static void GenerateSlow(MacroAssembler *masm)
MaybeObject * ToBoolean(Handle< Object > object)
MUST_USE_RESULT MaybeObject * Store(Handle< Object > object, Handle< String > name, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode=JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)
static const int kSlowCaseBitFieldMask
KeyedStoreIncrementLength
bool TryRemoveInvalidPrototypeDependentStub(Handle< Object > receiver, Handle< String > name)
#define IC_UTIL_LIST(ICU)
Handle< T > handle(T *t, Isolate *isolate)
static InlineCacheHolderFlag GetCodeCacheForObject(Object *object)
bool ShouldCreateAllocationMementos() const
static void GenerateString(MacroAssembler *masm)
#define V8_WARN_UNUSED_RESULT
DECLARE_RUNTIME_FUNCTION(MaybeObject *, KeyedLoadIC_MissFromStubFailure)
State(Token::Value op, OverwriteMode mode)
ContextualMode contextual_mode() const
static Handle< T > null()
static T::TypeHandle MapToType(Handle< Map > map, typename T::Region *region)
StoreIC(FrameDepth depth, Isolate *isolate)
#define ASSERT_EQ(v1, v2)
MUST_USE_RESULT MaybeObject * Load(Handle< Object > object, Handle< Object > key)
static Builtins::JavaScript TokenToJSBuiltin(Token::Value op)
void Print(const v8::FunctionCallbackInfo< v8::Value > &args)
static void GenerateNormal(MacroAssembler *masm)
MUST_USE_RESULT MaybeObject * CompareNil(Handle< Object > object)
static void GenerateIndexedInterceptor(MacroAssembler *masm)
Handle< Code > StoreElementStub(Handle< JSObject > receiver, KeyedAccessStoreMode store_mode)
static void GenerateInitialize(MacroAssembler *masm)
CompareNilIC(Isolate *isolate)
void set_target(Code *code)
virtual Handle< Code > megamorphic_stub()
static ContextualMode decode(uint32_tvalue)
void UpdateCaches(LookupResult *lookup, Handle< Object > object, Handle< String > name)
virtual Handle< Code > megamorphic_stub()
const int kMaxKeyedPolymorphism
BinaryOpIC(Isolate *isolate)
static Representation Tagged()
virtual Code::Kind kind() const
static void GenerateMiss(MacroAssembler *masm)
virtual void UpdateMegamorphicCache(HeapType *type, Name *name, Code *code)
static const char * GetStateName(State state)
Handle< Code > target() const
virtual Handle< Code > slow_stub() const
Type * GetLeftType(Zone *zone) const
TypeImpl< HeapTypeConfig > HeapType
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
static Address AddressFromUtilityId(UtilityId id)
static void GenerateInitialize(MacroAssembler *masm)
Failure * ReferenceError(const char *type, Handle< String > name)
ExtraICState extra_ic_state()
static void GeneratePreMonomorphic(MacroAssembler *masm)
void set_target(Code *code)
virtual Handle< Code > CompileHandler(LookupResult *lookup, Handle< Object > object, Handle< String > name, Handle< Object > unused, InlineCacheHolderFlag cache_holder)
bool UpdatePolymorphicIC(Handle< HeapType > type, Handle< String > name, Handle< Code > code)
static uint32_t encode(ContextualModevalue)
virtual Handle< Code > pre_monomorphic_stub()
static InlineCacheHolderFlag GetCodeCacheFlag(HeapType *type)
static void GenerateNormal(MacroAssembler *masm)
static void GenerateMiss(MacroAssembler *masm)
static Handle< Map > TypeToMap(HeapType *type, Isolate *isolate)
Maybe< int > fixed_right_arg() const