28 #ifndef V8_STUB_CACHE_H_
29 #define V8_STUB_CACHE_H_
113 bool is_dont_delete);
249 #ifdef ENABLE_DEBUGGER_SUPPORT
288 reinterpret_cast<Address>(&
first_entry(table)->key));
294 reinterpret_cast<Address>(&
first_entry(table)->map));
300 reinterpret_cast<Address>(&
first_entry(table)->value));
321 RelocInfo::Mode mode,
346 uint32_t map_low32bits =
347 static_cast<uint32_t
>(
reinterpret_cast<uintptr_t
>(map));
353 uint32_t key = (map_low32bits + field) ^ iflags;
362 uint32_t string_low32bits =
363 static_cast<uint32_t
>(
reinterpret_cast<uintptr_t
>(name));
368 uint32_t key = (seed - string_low32bits) + iflags;
377 static Entry* entry(Entry* table,
int offset) {
379 return reinterpret_cast<Entry*
>(
380 reinterpret_cast<Address>(table) + offset * multiplier);
383 static const int kPrimaryTableBits = 11;
384 static const int kPrimaryTableSize = (1 << kPrimaryTableBits);
385 static const int kSecondaryTableBits = 9;
386 static const int kSecondaryTableSize = (1 << kSecondaryTableBits);
388 Entry primary_[kPrimaryTableSize];
389 Entry secondary_[kSecondaryTableSize];
420 : isolate_(isolate), masm_(isolate,
NULL, 256), failure_(
NULL) { }
431 #ifdef ENABLE_DEBUGGER_SUPPORT
437 static void GenerateLoadGlobalFunctionPrototype(
MacroAssembler* masm,
447 static void GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm,
468 bool support_wrappers);
490 static void GenerateKeyedLoadMissForceGeneric(
MacroAssembler* masm);
515 return CheckPrototypes(
object, object_reg, holder, holder_reg, scratch1,
559 void GenerateDictionaryLoadCallback(
Register receiver,
580 LookupResult* lookup,
591 LookupResult* lookup);
643 bool is_dont_delete);
703 : StubCompiler(isolate), strict_mode_(strict_mode) { }
743 : StubCompiler(isolate),
744 strict_mode_(strict_mode),
745 grow_mode_(grow_mode) { }
784 #define CUSTOM_CALL_IC_GENERATORS(V) \
787 V(StringCharCodeAt) \
789 V(StringFromCharCode) \
794 class CallOptimization;
837 #define DECLARE_CALL_GENERATOR(name) \
838 Handle<Code> Compile##name##Call(Handle<Object> object, \
839 Handle<JSObject> holder, \
840 Handle<JSGlobalPropertyCell> cell, \
841 Handle<JSFunction> function, \
842 Handle<String> fname);
844 #undef DECLARE_CALL_GENERATOR
846 Handle<Code> CompileFastApiCall(
const CallOptimization& optimization,
847 Handle<Object>
object,
848 Handle<JSObject> holder,
849 Handle<JSGlobalPropertyCell> cell,
850 Handle<JSFunction>
function,
851 Handle<String> name);
854 Handle<Code> GetCode(Handle<JSFunction>
function);
856 const ParameterCount& arguments() {
return arguments_; }
858 void GenerateNameCheck(Handle<String> name, Label* miss);
860 void GenerateGlobalReceiverCheck(Handle<JSObject>
object,
861 Handle<JSObject> holder,
867 void GenerateLoadFunctionFromCell(Handle<JSGlobalPropertyCell> cell,
868 Handle<JSFunction>
function,
872 void GenerateMissBranch();
874 const ParameterCount arguments_;
895 explicit CallOptimization(LookupResult* lookup);
900 return !constant_function_.is_null();
904 ASSERT(is_constant_call());
905 return constant_function_;
909 return is_simple_api_call_;
913 ASSERT(is_simple_api_call());
914 return expected_receiver_type_;
918 ASSERT(is_simple_api_call());
919 return api_call_info_;
935 bool is_simple_api_call_;
943 #endif // V8_STUB_CACHE_H_
Handle< Code > CompileLoadFunctionPrototype(Handle< String > name)
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
static void GenerateStoreViaSetter(MacroAssembler *masm, Handle< JSFunction > setter)
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
Handle< Code > ComputeLoadNormal()
bool is_simple_api_call() const
Handle< Code > ComputeCallGlobal(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< JSObject > receiver, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< JSFunction > function)
Handle< Code > CompileLoadNonexistent(Handle< String > name, Handle< JSObject > object, Handle< JSObject > last)
Handle< Code > ComputeKeyedLoadFunctionPrototype(Handle< String > name, Handle< JSFunction > receiver)
Handle< Code > ComputeStoreField(Handle< String > name, Handle< JSObject > receiver, int field_index, Handle< Map > transition, StrictModeFlag strict_mode)
Handle< Code > CompileStoreElement(Handle< Map > receiver_map)
void GenerateProbe(MacroAssembler *masm, Code::Flags flags, Register receiver, Register name, Register scratch, Register extra, Register extra2=no_reg, Register extra3=no_reg)
Code * Set(String *name, Map *map, Code *code)
static void GenerateStoreExternalArray(MacroAssembler *masm, ElementsKind elements_kind)
Handle< Code > ComputeCallMiss(int argc, Code::Kind kind, Code::ExtraICState state)
void set_failure(Failure *failure)
static void GenerateLoadFastDoubleElement(MacroAssembler *masm)
bool is_constant_call() const
Handle< Code > ComputeLoadCallback(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< AccessorInfo > callback)
SCTableReference map_reference(StubCache::Table table)
Handle< Code > ComputeKeyedLoadOrStoreElement(Handle< Map > receiver_map, KeyedIC::StubKind stub_kind, StrictModeFlag strict_mode)
#define ASSERT(condition)
Handle< Code > ComputeStoreViaSetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > setter, StrictModeFlag strict_mode)
#define CUSTOM_CALL_IC_GENERATORS(V)
Handle< Code > ComputeCallMegamorphic(int argc, Code::Kind kind, Code::ExtraICState state)
Handle< Code > ComputeKeyedLoadInterceptor(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder)
Handle< Code > ComputeKeyedLoadCallback(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< AccessorInfo > callback)
#define DECLARE_CALL_GENERATOR(name)
void CollectMatchingMaps(SmallMapList *types, String *name, Code::Flags flags, Handle< Context > native_context, Zone *zone)
StubCompiler(Isolate *isolate)
CallStubCompiler(Isolate *isolate, int argc, Code::Kind kind, Code::ExtraICState extra_state, InlineCacheHolderFlag cache_holder)
Handle< Code > CompileLoadField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
Handle< Code > CompileStoreInterceptor(Handle< JSObject > object, Handle< String > name)
KeyedLoadStubCompiler(Isolate *isolate)
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
friend class SCTableReference
Handle< Code > ComputeKeyedLoadArrayLength(Handle< String > name, Handle< JSArray > receiver)
Handle< Code > ComputeCallInterceptor(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< Object > object, Handle< JSObject > holder)
Handle< Code > ComputeCallArguments(int argc, Code::Kind kind)
Handle< Code > ComputeLoadField(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, int field_index)
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
Handle< Code > ComputeStoreNormal(StrictModeFlag strict_mode)
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
Handle< Code > ComputeCallField(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< Object > object, Handle< JSObject > holder, int index)
Handle< Code > CompileCallGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< JSFunction > function, Handle< String > name)
Handle< Code > CompileLoadField(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, int index)
static void GenerateLoadViaGetter(MacroAssembler *masm, Handle< JSFunction > getter)
Handle< Code > CompileStoreGlobal(Handle< GlobalObject > object, Handle< JSGlobalPropertyCell > holder, Handle< String > name)
Handle< Code > CompileLoadViaGetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > getter)
Handle< Code > CompileLoadConstant(Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value, Handle< String > name)
Handle< Code > CompileLoadConstant(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value)
StubCache::Entry * first_entry(StubCache::Table table)
Handle< Code > CompileCallField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
static void GenerateStoreFastElement(MacroAssembler *masm, bool is_js_array, ElementsKind element_kind, KeyedAccessGrowMode grow_mode)
Handle< Code > CompileLoadStringLength(Handle< String > name)
Handle< Code > ComputeKeyedLoadStringLength(Handle< String > name, Handle< String > receiver)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Handle< Code > CompileLoadGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< String > name, bool is_dont_delete)
Handle< Code > CompileStoreCallback(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< AccessorInfo > callback)
Handle< Code > ComputeStoreGlobal(Handle< String > name, Handle< GlobalObject > receiver, Handle< JSGlobalPropertyCell > cell, StrictModeFlag strict_mode)
Handle< Code > ComputeStoreInterceptor(Handle< String > name, Handle< JSObject > receiver, StrictModeFlag strict_mode)
static void GenerateLoadDictionaryElement(MacroAssembler *masm)
static void GenerateLoadExternalArray(MacroAssembler *masm, ElementsKind elements_kind)
Handle< Code > ComputeLoadViaGetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > getter)
Handle< FunctionTemplateInfo > expected_receiver_type() const
SCTableReference key_reference(StubCache::Table table)
Register CheckPrototypes(Handle< JSObject > object, Register object_reg, Handle< JSObject > holder, Register holder_reg, Register scratch1, Register scratch2, Handle< String > name, Label *miss)
Handle< CallHandlerInfo > api_call_info() const
Handle< Code > ComputeKeyedLoadField(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, int field_index)
Handle< Code > ComputeCallNormal(int argc, Code::Kind kind, Code::ExtraICState state)
Handle< Code > ComputeKeyedStoreField(Handle< String > name, Handle< JSObject > receiver, int field_index, Handle< Map > transition, StrictModeFlag strict_mode)
Handle< Code > CompileCallInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
static void GenerateLoadFastElement(MacroAssembler *masm)
ConstructStubCompiler(Isolate *isolate)
static void GenerateStoreFastDoubleElement(MacroAssembler *masm, bool is_js_array, KeyedAccessGrowMode grow_mode)
LoadStubCompiler(Isolate *isolate)
Handle< Code > ComputeKeyedCallInitialize(int argc)
Handle< Code > CompileLoadArrayLength(Handle< String > name)
Handle< Code > CompileCallConstant(Handle< Object > object, Handle< JSObject > holder, Handle< JSFunction > function, Handle< String > name, CheckType check)
const int kHeapObjectTagSize
SCTableReference value_reference(StubCache::Table table)
static bool HasCustomCallGenerator(Handle< JSFunction > function)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if NULL
Handle< Code > ComputeCallInitialize(int argc, RelocInfo::Mode mode)
DECLARE_RUNTIME_FUNCTION(MaybeObject *, LoadCallbackProperty)
Code * FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind)
static const int kFlagsNotUsedInLookup
Handle< Code > ComputeCallPreMonomorphic(int argc, Code::Kind kind, Code::ExtraICState extra_state)
const int kInvalidProtoDepth
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
Handle< Code > ComputeLoadNonexistent(Handle< String > name, Handle< JSObject > receiver)
Handle< Code > ComputeLoadConstant(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > value)
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
Handle< Code > ComputeLoadInterceptor(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder)
static const int kHashShift
Handle< Code > CompileLoadPolymorphic(MapHandleList *receiver_maps, CodeHandleList *handler_ics)
Handle< Code > ComputeCallConstant(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< Object > object, Handle< JSObject > holder, Handle< JSFunction > function)
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
Handle< Code > CompileStorePolymorphic(MapHandleList *receiver_maps, CodeHandleList *handler_stubs, MapHandleList *transitioned_maps)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting 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 more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage including flags
KeyedStoreStubCompiler(Isolate *isolate, StrictModeFlag strict_mode, KeyedAccessGrowMode grow_mode)
Handle< JSFunction > constant_function() const
void check(i::Vector< const char > string)
Handle< Code > ComputeKeyedLoadConstant(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > value)
Handle< Code > CompileLoadElement(Handle< Map > receiver_map)
Handle< Code > CompileConstructStub(Handle< JSFunction > function)
Handle< Code > CompileStoreViaSetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > setter)
Handle< Code > ComputeLoadGlobal(Handle< String > name, Handle< JSObject > receiver, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, bool is_dont_delete)
StoreStubCompiler(Isolate *isolate, StrictModeFlag strict_mode)
Handle< Code > ComputeStoreCallback(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< AccessorInfo > callback, StrictModeFlag strict_mode)
static void GenerateStoreDictionaryElement(MacroAssembler *masm)