21 : call_descriptor_(stub->GetCallInterfaceDescriptor()),
22 stack_parameter_count_(
no_reg),
23 hint_stack_parameter_count_(-1),
25 deoptimization_handler_(
NULL),
28 has_miss_handler_(
false) {
29 stub->InitializeDescriptor(
this);
34 : stack_parameter_count_(
no_reg),
35 hint_stack_parameter_count_(-1),
37 deoptimization_handler_(
NULL),
40 has_miss_handler_(
false) {
41 CodeStub::InitializeDescriptor(isolate, stub_key,
this);
46 int hint_stack_parameter_count,
56 int hint_stack_parameter_count,
65 bool CodeStub::FindCodeInCache(
Code** code_out) {
69 *code_out = Code::cast(stubs->
ValueAt(index));
76 void CodeStub::RecordCodeGeneration(Handle<Code> code) {
80 PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code, os.c_str()));
81 Counters* counters = isolate()->counters();
82 counters->total_stubs_code_size()->Increment(code->instruction_size());
91 Handle<Code> CodeStub::GetCodeCopy(
const Code::FindAndReplacePattern& pattern) {
92 Handle<Code> ic = GetCode();
93 ic = isolate()->factory()->CopyCode(ic);
94 ic->FindAndReplace(pattern);
95 RecordCodeGeneration(ic);
101 Factory* factory = isolate()->factory();
111 isolate()->counters()->code_stubs()->Increment();
136 Heap* heap = isolate()->heap();
138 if (UseSpecialCache() ? FindCodeInSpecialCache(&code)
139 : FindCodeInCache(&code)) {
148 new_object->set_stub_key(GetKey());
150 RecordCodeGeneration(new_object);
152 #ifdef ENABLE_DISASSEMBLER
153 if (FLAG_print_code_stubs) {
154 CodeTracer::Scope trace_scope(isolate()->GetCodeTracer());
155 OFStream os(trace_scope.file());
158 new_object->Disassemble(
name.c_str(), os);
163 if (UseSpecialCache()) {
164 AddToSpecialCache(new_object);
167 Handle<UnseededNumberDictionary> dict =
169 Handle<UnseededNumberDictionary>(heap->code_stubs()),
178 DCHECK(!NeedsImmovableCode() ||
181 return Handle<Code>(code, isolate());
185 const char* CodeStub::MajorName(CodeStub::Major major_key,
186 bool allow_unknown_keys) {
188 #define DEF_CASE(name) case name: return #name "Stub";
192 return "<NoCache>Stub";
201 void CodeStub::PrintBaseName(OStream& os)
const {
202 os << MajorName(MajorKey(),
false);
206 void CodeStub::PrintName(OStream& os)
const {
212 void CodeStub::Dispatch(Isolate* isolate,
uint32_t key,
void** value_out,
213 DispatchedCall call) {
214 switch (MajorKeyFromKey(key)) {
215 #define DEF_CASE(NAME) \
217 NAME##Stub stub(key, isolate); \
218 CodeStub* pstub = &stub; \
219 call(pstub, value_out); \
237 stub->InitializeDescriptor(descriptor_out);
243 CodeStubDescriptor* desc) {
244 void** value_out =
reinterpret_cast<void**
>(desc);
249 void CodeStub::GetCodeDispatchCall(
CodeStub* stub,
void** value_out) {
250 Handle<Code>* code_out =
reinterpret_cast<Handle<Code>*
>(value_out);
252 *code_out = stub->UseSpecialCache() ? Handle<Code>() : stub->GetCode();
256 MaybeHandle<Code> CodeStub::GetCode(Isolate* isolate,
uint32_t key) {
257 HandleScope scope(isolate);
259 void** value_out =
reinterpret_cast<void**
>(&code);
260 Dispatch(isolate, key, value_out, &GetCodeDispatchCall);
261 return scope.CloseAndEscape(code);
268 for (
int op = Token::BIT_OR; op <= Token::MOD; ++op) {
289 const BinaryOpICState& state) {
296 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(
Isolate* isolate) {
298 BinaryOpICState::GenerateAheadOfTime(isolate, &GenerateAheadOfTime);
302 void BinaryOpICWithAllocationSiteStub::PrintState(
309 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(
310 Isolate* isolate,
const BinaryOpICState& state) {
311 if (state.CouldCreateAllocationMementos()) {
312 BinaryOpICWithAllocationSiteStub stub(isolate, state);
318 void StringAddStub::PrintBaseName(OStream& os)
const {
319 os <<
"StringAddStub";
327 if (pretenure_flag() ==
TENURED) {
361 Isolate* isolate = new_object->GetIsolate();
362 Factory* factory = isolate->
factory();
365 factory->strict_compare_ic_string() :
366 factory->compare_ic_string(),
372 Factory* factory = isolate()->factory();
380 *factory->strict_compare_ic_string() :
381 *factory->compare_ic_string(),
384 if (probe->IsCode()) {
385 *code_out = Code::cast(*probe);
437 if (object->IsNull()) {
439 }
else if (object->IsUndefined()) {
441 }
else if (object->IsUndetectableObject() ||
442 object->IsOddball() ||
443 !object->IsHeapObject()) {
457 template<
class StateType>
462 if (!FLAG_trace_ic)
return;
466 os <<
": " << from <<
"=>" <<
to <<
"]" <<
endl;
471 CodeStub::PrintBaseName(os);
543 os <<
state() <<
" (Array)";
553 os <<
"InstanceofStub";
562 code->GetIsolate()->factory()->NewFixedArray(1,
TENURED);
564 code->set_handler_table(*handler_table);
573 void LoadDictionaryElementStub::InitializeDescriptor(
574 CodeStubDescriptor* descriptor) {
575 descriptor->Initialize(
FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure));
579 void KeyedLoadGenericStub::InitializeDescriptor(
580 CodeStubDescriptor* descriptor) {
581 descriptor->Initialize(
587 if (
kind() == Code::STORE_IC) {
589 }
else if (
kind() == Code::KEYED_LOAD_IC) {
596 if (
kind() == Code::LOAD_IC ||
kind() == Code::KEYED_LOAD_IC) {
605 void StoreFastElementStub::InitializeDescriptor(
611 void ElementsTransitionAndStoreStub::InitializeDescriptor(
612 CodeStubDescriptor* descriptor) {
613 descriptor->Initialize(
FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
619 Address deoptimization_handler) {
621 descriptor->
Initialize(deoptimization_handler);
625 void VectorLoadStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
631 void VectorKeyedLoadStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
633 isolate(), descriptor,
638 void MegamorphicLoadStub::InitializeDescriptor(CodeStubDescriptor* d) {}
641 void FastNewClosureStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
642 descriptor->Initialize(
647 void FastNewContextStub::InitializeDescriptor(CodeStubDescriptor* d) {}
650 void ToNumberStub::InitializeDescriptor(CodeStubDescriptor* d) {}
653 void NumberToStringStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
654 NumberToStringDescriptor call_descriptor(isolate());
655 descriptor->Initialize(
660 void FastCloneShallowArrayStub::InitializeDescriptor(
661 CodeStubDescriptor* descriptor) {
662 FastCloneShallowArrayDescriptor call_descriptor(isolate());
663 descriptor->Initialize(
668 void FastCloneShallowObjectStub::InitializeDescriptor(
669 CodeStubDescriptor* descriptor) {
670 FastCloneShallowObjectDescriptor call_descriptor(isolate());
671 descriptor->Initialize(
676 void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {}
679 void RegExpConstructResultStub::InitializeDescriptor(
680 CodeStubDescriptor* descriptor) {
681 descriptor->Initialize(
686 void TransitionElementsKindStub::InitializeDescriptor(
687 CodeStubDescriptor* descriptor) {
688 descriptor->Initialize(
693 void CompareNilICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
695 descriptor->SetMissHandler(
696 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
700 void ToBooleanStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
702 descriptor->SetMissHandler(
703 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
707 void BinaryOpICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
709 descriptor->SetMissHandler(
710 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
714 void BinaryOpWithAllocationSiteStub::InitializeDescriptor(
715 CodeStubDescriptor* descriptor) {
716 descriptor->Initialize(
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
720 void StringAddStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
739 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
740 case EXTERNAL_##TYPE##_ELEMENTS: \
741 case TYPE##_ELEMENTS:
744 #undef TYPED_ARRAY_CASE
776 os <<
"ArgumentsAccessStub_";
782 os <<
"NewSloppyFast";
785 os <<
"NewSloppySlow";
796 os <<
"CallFunctionStub_Args" <<
argc();
801 os <<
"CallConstructStub";
807 os <<
"ArrayConstructorStub";
819 os <<
"_More_Than_One";
827 const char*
name)
const {
830 os <<
"_DISABLE_ALLOCATION_SITES";
838 Types old_types = new_types;
842 return to_boolean_value;
868 if (object->IsUndefined()) {
871 }
else if (object->IsBoolean()) {
873 return object->IsTrue();
874 }
else if (object->IsNull()) {
877 }
else if (object->IsSmi()) {
879 return Smi::cast(*object)->value() != 0;
880 }
else if (object->IsSpecObject()) {
882 return !
object->IsUndetectableObject();
883 }
else if (object->IsString()) {
885 return !
object->IsUndetectableObject() &&
886 String::cast(*object)->length() != 0;
887 }
else if (object->IsSymbol()) {
890 }
else if (object->IsHeapNumber()) {
891 DCHECK(!object->IsUndetectableObject());
893 double value = HeapNumber::cast(*object)->value();
894 return value != 0 && !std::isnan(value);
926 intptr_t stack_pointer,
930 entry_hook(
function, stack_pointer);
A stack-allocated class that governs a number of local handles.
An object reference managed by the v8 garbage collector.
Isolate represents an isolated instance of the V8 engine.
void GenerateReadElement(MacroAssembler *masm)
void GenerateNewSloppySlow(MacroAssembler *masm)
virtual void PrintName(OStream &os) const OVERRIDE
void GenerateNewStrict(MacroAssembler *masm)
void GenerateNewSloppyFast(MacroAssembler *masm)
static void GenerateStubsAheadOfTime(Isolate *isolate)
AllocationSiteOverrideMode override_mode() const
OStream & BasePrintName(OStream &os, const char *name) const
ElementsKind elements_kind() const
ArrayConstructorStub(Isolate *isolate, int argument_count)
ArgumentCountKey argument_count() const
virtual void PrintName(OStream &os) const OVERRIDE
void GetCode(CodeDesc *desc)
static void GenerateAheadOfTime(Isolate *isolate)
BinaryOpICState state() const
virtual void PrintState(OStream &os) const FINAL OVERRIDE
static U update(U previous, T value)
bool RecordCallTarget() const
virtual void PrintName(OStream &os) const OVERRIDE
virtual void PrintName(OStream &os) const OVERRIDE
CallICState state() const
virtual void PrintState(OStream &os) const OVERRIDE
virtual void PrintState(OStream &os) const OVERRIDE
Address deoptimization_handler_
StubFunctionMode function_mode_
Address deoptimization_handler() const
void set_call_descriptor(CallInterfaceDescriptor d)
CodeStubDescriptor(CodeStub *stub)
int hint_stack_parameter_count() const
int hint_stack_parameter_count_
void Initialize(Address deoptimization_handler=NULL, int hint_stack_parameter_count=-1, StubFunctionMode function_mode=NOT_JS_FUNCTION_STUB_MODE)
HandlerArgumentsMode handler_arguments_mode_
Register stack_parameter_count_
StubFunctionMode function_mode() const
Register stack_parameter_count() const
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, StubType type=NORMAL, CacheHolderFlag holder=kCacheOnReceiver)
Condition GetCondition() const
virtual InlineCacheState GetICState() const
virtual Code::Kind GetCodeKind() const
void GenerateInternalizedStrings(MacroAssembler *masm)
void GenerateStrings(MacroAssembler *masm)
CompareICState::State state() const
void GenerateMiss(MacroAssembler *masm)
CompareICState::State left() const
void GenerateGeneric(MacroAssembler *masm)
CompareICState::State right() const
void GenerateObjects(MacroAssembler *masm)
virtual void AddToSpecialCache(Handle< Code > new_object)
virtual bool FindCodeInSpecialCache(Code **code_out)
void GenerateNumbers(MacroAssembler *masm)
void GenerateUniqueNames(MacroAssembler *masm)
void GenerateKnownObjects(MacroAssembler *masm)
void GenerateSmis(MacroAssembler *masm)
static Condition ComputeCondition(Token::Value op)
virtual void PrintState(OStream &os) const OVERRIDE
bool IsMonomorphic() const
void UpdateStatus(Handle< Object > object)
Type * GetInputType(Zone *zone, Handle< Map > map)
virtual void PrintBaseName(OStream &os) const OVERRIDE
NilValue nil_value() const
Type * GetType(Zone *zone, Handle< Map > map=Handle< Map >())
static void GenerateAheadOfTime(Isolate *isolate)
Object * ValueAt(int entry)
static void GenerateStoreSlow(MacroAssembler *masm)
bool Contains(E element) const
virtual void InitializeDescriptor(CodeStubDescriptor *descriptor) OVERRIDE
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE
virtual Code::Kind kind() const =0
static const int kNotFound
LargeObjectSpace * lo_space()
void public_set_code_stubs(UnseededNumberDictionary *value)
void TraceTransition(StateType from, StateType to)
void set_sub_minor_key(uint32_t key)
uint32_t sub_minor_key() const
static void RegisterWeakMapDependency(Handle< Code > stub)
virtual void PrintName(OStream &os) const OVERRIDE
bool HasCallSiteInlineCheck() const
bool HasArgsInRegisters() const
bool ReturnTrueFalseObject() const
static void GenerateStubsAheadOfTime(Isolate *isolate)
InternalArrayConstructorStub(Isolate *isolate)
FunctionEntryHook function_entry_hook()
virtual void FinishCode(Handle< Code > code)
bool Contains(HeapObject *obj)
void set_generating_stub(bool value)
Handle< Object > CodeObject()
static void UpdateCodeCache(Handle< Map > map, Handle< Name > name, Handle< Code > code)
bool Contains(Address addr)
static void EntryHookTrampoline(intptr_t function, intptr_t stack_pointer, Isolate *isolate)
static const Function * FunctionForId(FunctionId id)
SimpleListPrinter(OStream &os)
static Smi * FromInt(int value)
ElementsKind elements_kind() const
static void GenerateAheadOfTime(Isolate *isolate)
bool CanBeUndetectable() const
bool UpdateStatus(Handle< Object > object)
virtual void PrintState(OStream &os) const OVERRIDE
bool UpdateStatus(Handle< Object > object)
static TypeHandle Class(i::Handle< i::Map > map, Region *region)
static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region *reg)
static MUST_USE_RESULT Handle< UnseededNumberDictionary > AtNumberPut(Handle< UnseededNumberDictionary > dictionary, uint32_t key, Handle< Object > value)
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size)
#define CODE_STUB_LIST(V)
#define PROFILE(IsolateGetter, Call)
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
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions true
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
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 DCHECK(condition)
#define DCHECK_EQ(v1, v2)
static void FinishCode(MacroAssembler *masm)
@ NOT_JS_FUNCTION_STUB_MODE
OStream & endl(OStream &os)
@ FAST_HOLEY_DOUBLE_ELEMENTS
@ SLOPPY_ARGUMENTS_ELEMENTS
@ FAST_HOLEY_SMI_ELEMENTS
const char * ElementsKindToString(ElementsKind kind)
static void InitializeVectorLoadStub(Isolate *isolate, CodeStubDescriptor *descriptor, Address deoptimization_handler)
static void InitializeDescriptorDispatchedCall(CodeStub *stub, void **value_out)
OStream & operator<<(OStream &os, const BasicBlockProfiler &p)
@ DISABLE_ALLOCATION_SITES
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)
Debugger support for the V8 JavaScript engine.
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
FunctionEntryHook is the type of the profile entry hook called at entry to any generated function whe...
Handle< Primitive > Null(Isolate *isolate)
Handle< Primitive > Undefined(Isolate *isolate)