V8 Project
v8::internal::PropertyICCompiler Class Reference

#include <ic-compiler.h>

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

Static Public Member Functions

static CodeFindPreMonomorphic (Isolate *isolate, Code::Kind kind, ExtraICState extra_ic_state)
 
static Handle< CodeComputeLoad (Isolate *isolate, InlineCacheState ic_state, ExtraICState extra_state)
 
static Handle< CodeComputeStore (Isolate *isolate, InlineCacheState ic_state, ExtraICState extra_state)
 
static Handle< CodeComputeMonomorphic (Code::Kind kind, Handle< Name > name, Handle< HeapType > type, Handle< Code > handler, ExtraICState extra_ic_state)
 
static Handle< CodeComputePolymorphic (Code::Kind kind, TypeHandleList *types, CodeHandleList *handlers, int number_of_valid_maps, Handle< Name > name, ExtraICState extra_ic_state)
 
static Handle< CodeComputeKeyedLoadMonomorphic (Handle< Map > receiver_map)
 
static Handle< CodeComputeKeyedStoreMonomorphic (Handle< Map > receiver_map, StrictMode strict_mode, KeyedAccessStoreMode store_mode)
 
static Handle< CodeComputeKeyedLoadPolymorphic (MapHandleList *receiver_maps)
 
static Handle< CodeComputeKeyedStorePolymorphic (MapHandleList *receiver_maps, KeyedAccessStoreMode store_mode, StrictMode strict_mode)
 
static Handle< CodeComputeCompareNil (Handle< Map > receiver_map, CompareNilICStub *stub)
 
static void GenerateRuntimeSetProperty (MacroAssembler *masm, StrictMode strict_mode)
 

Private Member Functions

 PropertyICCompiler (Isolate *isolate, Code::Kind kind, ExtraICState extra_ic_state=kNoExtraICState, CacheHolderFlag cache_holder=kCacheOnReceiver)
 
Handle< CodeCompileLoadInitialize (Code::Flags flags)
 
Handle< CodeCompileLoadPreMonomorphic (Code::Flags flags)
 
Handle< CodeCompileStoreInitialize (Code::Flags flags)
 
Handle< CodeCompileStorePreMonomorphic (Code::Flags flags)
 
Handle< CodeCompileStoreGeneric (Code::Flags flags)
 
Handle< CodeCompileStoreMegamorphic (Code::Flags flags)
 
Handle< CodeCompileMonomorphic (Handle< HeapType > type, Handle< Code > handler, Handle< Name > name, IcCheckType check)
 
Handle< CodeCompilePolymorphic (TypeHandleList *types, CodeHandleList *handlers, Handle< Name > name, Code::StubType type, IcCheckType check)
 
Handle< CodeCompileKeyedStoreMonomorphic (Handle< Map > receiver_map, KeyedAccessStoreMode store_mode)
 
Handle< CodeCompileKeyedStorePolymorphic (MapHandleList *receiver_maps, KeyedAccessStoreMode store_mode)
 
Handle< CodeCompileKeyedStorePolymorphic (MapHandleList *receiver_maps, CodeHandleList *handler_stubs, MapHandleList *transitioned_maps)
 
bool IncludesNumberType (TypeHandleList *types)
 
Handle< CodeGetCode (Code::Kind kind, Code::StubType type, Handle< Name > name, InlineCacheState state=MONOMORPHIC)
 
Logger::LogEventsAndTags log_kind (Handle< Code > code)
 

Static Private Member Functions

static Handle< CodeFind (Handle< Name > name, Handle< Map > stub_holder_map, Code::Kind kind, ExtraICState extra_ic_state=kNoExtraICState, CacheHolderFlag cache_holder=kCacheOnReceiver)
 

Private Attributes

const ExtraICState extra_ic_state_
 

Detailed Description

Definition at line 17 of file ic-compiler.h.

Constructor & Destructor Documentation

◆ PropertyICCompiler()

v8::internal::PropertyICCompiler::PropertyICCompiler ( Isolate isolate,
Code::Kind  kind,
ExtraICState  extra_ic_state = kNoExtraICState,
CacheHolderFlag  cache_holder = kCacheOnReceiver 
)
inlineprivate

Definition at line 62 of file ic-compiler.h.

65  : PropertyAccessCompiler(isolate, kind, cache_holder),
66  extra_ic_state_(extra_ic_state) {}
const ExtraICState extra_ic_state_
Definition: ic-compiler.h:118

Member Function Documentation

◆ CompileKeyedStoreMonomorphic()

Handle< Code > v8::internal::PropertyICCompiler::CompileKeyedStoreMonomorphic ( Handle< Map receiver_map,
KeyedAccessStoreMode  store_mode 
)
private

Definition at line 423 of file ic-compiler.cc.

424  {
425  ElementsKind elements_kind = receiver_map->elements_kind();
426  bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE;
427  Handle<Code> stub;
428  if (receiver_map->has_fast_elements() ||
429  receiver_map->has_external_array_elements() ||
430  receiver_map->has_fixed_typed_array_elements()) {
431  stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind,
432  store_mode).GetCode();
433  } else {
434  stub = StoreElementStub(isolate(), elements_kind).GetCode();
435  }
436 
437  __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
438 
439  TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
440 
441  return GetCode(kind(), Code::NORMAL, factory()->empty_string());
442 }
Handle< Code > GetCode(Code::Kind kind, Code::StubType type, Handle< Name > name, InlineCacheState state=MONOMORPHIC)
Definition: ic-compiler.cc:360
#define __
Definition: ic-compiler.cc:420
@ DO_SMI_CHECK
Definition: globals.h:641
@ JS_ARRAY_TYPE
Definition: objects.h:738

References __, v8::internal::DO_SMI_CHECK, GetCode(), v8::internal::JS_ARRAY_TYPE, and v8::internal::Code::NORMAL.

Referenced by ComputeKeyedStoreMonomorphic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileKeyedStorePolymorphic() [1/2]

Handle<Code> v8::internal::PropertyICCompiler::CompileKeyedStorePolymorphic ( MapHandleList receiver_maps,
CodeHandleList handler_stubs,
MapHandleList transitioned_maps 
)
private

◆ CompileKeyedStorePolymorphic() [2/2]

Handle< Code > v8::internal::PropertyICCompiler::CompileKeyedStorePolymorphic ( MapHandleList receiver_maps,
KeyedAccessStoreMode  store_mode 
)
private

Definition at line 372 of file ic-compiler.cc.

373  {
374  // Collect MONOMORPHIC stubs for all |receiver_maps|.
375  CodeHandleList handlers(receiver_maps->length());
376  MapHandleList transitioned_maps(receiver_maps->length());
377  for (int i = 0; i < receiver_maps->length(); ++i) {
378  Handle<Map> receiver_map(receiver_maps->at(i));
379  Handle<Code> cached_stub;
380  Handle<Map> transitioned_map =
381  receiver_map->FindTransitionedMap(receiver_maps);
382 
383  // TODO(mvstanton): The code below is doing pessimistic elements
384  // transitions. I would like to stop doing that and rely on Allocation Site
385  // Tracking to do a better job of ensuring the data types are what they need
386  // to be. Not all the elements are in place yet, pessimistic elements
387  // transitions are still important for performance.
388  bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
389  ElementsKind elements_kind = receiver_map->elements_kind();
390  if (!transitioned_map.is_null()) {
391  cached_stub =
392  ElementsTransitionAndStoreStub(isolate(), elements_kind,
393  transitioned_map->elements_kind(),
394  is_js_array, store_mode).GetCode();
395  } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
396  cached_stub = isolate()->builtins()->KeyedStoreIC_Slow();
397  } else {
398  if (receiver_map->has_fast_elements() ||
399  receiver_map->has_external_array_elements() ||
400  receiver_map->has_fixed_typed_array_elements()) {
401  cached_stub = StoreFastElementStub(isolate(), is_js_array,
402  elements_kind, store_mode).GetCode();
403  } else {
404  cached_stub = StoreElementStub(isolate(), elements_kind).GetCode();
405  }
406  }
407  DCHECK(!cached_stub.is_null());
408  handlers.Add(cached_stub);
409  transitioned_maps.Add(transitioned_map);
410  }
411 
412  Handle<Code> code = CompileKeyedStorePolymorphic(receiver_maps, &handlers,
413  &transitioned_maps);
414  isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
415  PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, 0));
416  return code;
417 }
Handle< Code > CompileKeyedStorePolymorphic(MapHandleList *receiver_maps, KeyedAccessStoreMode store_mode)
Definition: ic-compiler.cc:372
Logger::LogEventsAndTags log_kind(Handle< Code > code)
Definition: ic-compiler.h:99
#define PROFILE(IsolateGetter, Call)
Definition: cpu-profiler.h:181
#define DCHECK(condition)
Definition: logging.h:205
List< Handle< Code > > CodeHandleList
Definition: list.h:199
@ FIRST_JS_RECEIVER_TYPE
Definition: objects.h:772
List< Handle< Map > > MapHandleList
Definition: list.h:197

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::List< T, AllocationPolicy >::at(), DCHECK, v8::internal::FIRST_JS_RECEIVER_TYPE, v8::internal::Handle< T >::is_null(), v8::internal::JS_ARRAY_TYPE, log_kind(), and PROFILE.

Referenced by ComputeKeyedStorePolymorphic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileLoadInitialize()

Handle< Code > v8::internal::PropertyICCompiler::CompileLoadInitialize ( Code::Flags  flags)
private

Definition at line 308 of file ic-compiler.cc.

308  {
310  Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadInitialize");
311  PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_INITIALIZE_TAG, *code, 0));
312  return code;
313 }
static void GenerateInitialize(MacroAssembler *masm)
Definition: ic.h:348

References v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::LoadIC::GenerateInitialize(), and PROFILE.

Referenced by ComputeLoad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileLoadPreMonomorphic()

Handle< Code > v8::internal::PropertyICCompiler::CompileLoadPreMonomorphic ( Code::Flags  flags)
private

Definition at line 316 of file ic-compiler.cc.

316  {
318  Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic");
319  PROFILE(isolate(),
320  CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0));
321  return code;
322 }
static void GeneratePreMonomorphic(MacroAssembler *masm)
Definition: ic.h:349

References v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::LoadIC::GeneratePreMonomorphic(), and PROFILE.

Referenced by ComputeLoad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileMonomorphic()

Handle< Code > v8::internal::PropertyICCompiler::CompileMonomorphic ( Handle< HeapType type,
Handle< Code handler,
Handle< Name name,
IcCheckType  check 
)
private

Definition at line 36 of file ic-compiler.cc.

39  {
40  TypeHandleList types(1);
41  CodeHandleList handlers(1);
42  types.Add(type);
43  handlers.Add(handler);
44  Code::StubType stub_type = handler->type();
45  return CompilePolymorphic(&types, &handlers, name, stub_type, check);
46 }
Handle< Code > CompilePolymorphic(TypeHandleList *types, CodeHandleList *handlers, Handle< Name > name, Code::StubType type, IcCheckType check)
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
List< Handle< HeapType > > TypeHandleList
Definition: list.h:198

References v8::internal::List< T, AllocationPolicy >::Add(), CompilePolymorphic(), and name.

Referenced by ComputeKeyedLoadMonomorphic(), and ComputeMonomorphic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompilePolymorphic()

Handle<Code> v8::internal::PropertyICCompiler::CompilePolymorphic ( TypeHandleList types,
CodeHandleList handlers,
Handle< Name name,
Code::StubType  type,
IcCheckType  check 
)
private

Referenced by CompileMonomorphic(), ComputeKeyedLoadPolymorphic(), and ComputePolymorphic().

+ Here is the caller graph for this function:

◆ CompileStoreGeneric()

Handle< Code > v8::internal::PropertyICCompiler::CompileStoreGeneric ( Code::Flags  flags)
private

Definition at line 342 of file ic-compiler.cc.

342  {
344  StrictMode strict_mode = StoreIC::GetStrictMode(extra_state);
345  GenerateRuntimeSetProperty(masm(), strict_mode);
346  Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric");
347  PROFILE(isolate(), CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0));
348  return code;
349 }
static ExtraICState ExtractExtraICStateFromFlags(Flags flags)
Definition: objects-inl.h:4991
static void GenerateRuntimeSetProperty(MacroAssembler *masm, StrictMode strict_mode)
static StrictMode GetStrictMode(ExtraICState state)
Definition: ic.h:453
int ExtraICState
Definition: objects.h:305

References v8::internal::Code::ExtractExtraICStateFromFlags(), v8::internal::anonymous_namespace{flags.cc}::flags, GenerateRuntimeSetProperty(), v8::internal::StoreIC::GetStrictMode(), and PROFILE.

Referenced by ComputeStore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileStoreInitialize()

Handle< Code > v8::internal::PropertyICCompiler::CompileStoreInitialize ( Code::Flags  flags)
private

Definition at line 325 of file ic-compiler.cc.

325  {
327  Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize");
328  PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0));
329  return code;
330 }
static void GenerateInitialize(MacroAssembler *masm)
Definition: ic.h:471

References v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::StoreIC::GenerateInitialize(), and PROFILE.

Referenced by ComputeStore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileStoreMegamorphic()

Handle< Code > v8::internal::PropertyICCompiler::CompileStoreMegamorphic ( Code::Flags  flags)
private

Definition at line 352 of file ic-compiler.cc.

352  {
354  Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic");
355  PROFILE(isolate(), CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0));
356  return code;
357 }
static void GenerateMegamorphic(MacroAssembler *masm)

References v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::StoreIC::GenerateMegamorphic(), and PROFILE.

Referenced by ComputeStore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileStorePreMonomorphic()

Handle< Code > v8::internal::PropertyICCompiler::CompileStorePreMonomorphic ( Code::Flags  flags)
private

Definition at line 333 of file ic-compiler.cc.

333  {
335  Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic");
336  PROFILE(isolate(),
337  CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0));
338  return code;
339 }
static void GeneratePreMonomorphic(MacroAssembler *masm)
Definition: ic.h:472

References v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::StoreIC::GeneratePreMonomorphic(), and PROFILE.

Referenced by ComputeStore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeCompareNil()

Handle< Code > v8::internal::PropertyICCompiler::ComputeCompareNil ( Handle< Map receiver_map,
CompareNilICStub stub 
)
static

Definition at line 221 of file ic-compiler.cc.

222  {
223  Isolate* isolate = receiver_map->GetIsolate();
224  Handle<String> name(isolate->heap()->empty_string());
225  if (!receiver_map->is_dictionary_map()) {
226  Handle<Code> cached_ic =
227  Find(name, receiver_map, Code::COMPARE_NIL_IC, stub->GetExtraICState());
228  if (!cached_ic.is_null()) return cached_ic;
229  }
230 
231  Code::FindAndReplacePattern pattern;
232  pattern.Add(isolate->factory()->meta_map(), receiver_map);
233  Handle<Code> ic = stub->GetCodeCopy(pattern);
234 
235  if (!receiver_map->is_dictionary_map()) {
236  Map::UpdateCodeCache(receiver_map, name, ic);
237  }
238 
239  return ic;
240 }
static void UpdateCodeCache(Handle< Map > map, Handle< Name > name, Handle< Code > code)
Definition: objects.cc:7030
static Handle< Code > Find(Handle< Name > name, Handle< Map > stub_holder_map, Code::Kind kind, ExtraICState extra_ic_state=kNoExtraICState, CacheHolderFlag cache_holder=kCacheOnReceiver)
Definition: ic-compiler.cc:16

References v8::internal::Code::FindAndReplacePattern::Add(), v8::internal::Isolate::factory(), Find(), v8::internal::CompareNilICStub::GetExtraICState(), v8::internal::Isolate::heap(), v8::internal::Handle< T >::is_null(), name, and v8::internal::Map::UpdateCodeCache().

Referenced by v8::internal::CompareNilIC::CompareNil().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeKeyedLoadMonomorphic()

Handle< Code > v8::internal::PropertyICCompiler::ComputeKeyedLoadMonomorphic ( Handle< Map receiver_map)
static

Definition at line 86 of file ic-compiler.cc.

87  {
88  Isolate* isolate = receiver_map->GetIsolate();
89  Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
90  Handle<Name> name = isolate->factory()->KeyedLoadMonomorphic_string();
91 
92  Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate);
93  if (probe->IsCode()) return Handle<Code>::cast(probe);
94 
95  ElementsKind elements_kind = receiver_map->elements_kind();
96  Handle<Code> stub;
97  if (receiver_map->has_indexed_interceptor()) {
98  stub = LoadIndexedInterceptorStub(isolate).GetCode();
99  } else if (receiver_map->has_sloppy_arguments_elements()) {
100  stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode();
101  } else if (receiver_map->has_fast_elements() ||
102  receiver_map->has_external_array_elements() ||
103  receiver_map->has_fixed_typed_array_elements()) {
104  stub = LoadFastElementStub(isolate,
105  receiver_map->instance_type() == JS_ARRAY_TYPE,
106  elements_kind).GetCode();
107  } else {
108  stub = LoadDictionaryElementStub(isolate).GetCode();
109  }
110  PropertyICCompiler compiler(isolate, Code::KEYED_LOAD_IC);
111  Handle<Code> code =
112  compiler.CompileMonomorphic(HeapType::Class(receiver_map, isolate), stub,
113  isolate->factory()->empty_string(), ELEMENT);
114 
115  Map::UpdateCodeCache(receiver_map, name, code);
116  return code;
117 }
uint32_t Flags
Definition: objects.h:4929
static Flags ComputeMonomorphicFlags(Kind kind, ExtraICState extra_ic_state=kNoExtraICState, CacheHolderFlag holder=kCacheOnReceiver, StubType type=NORMAL)
Definition: objects-inl.h:4967
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
PropertyICCompiler(Isolate *isolate, Code::Kind kind, ExtraICState extra_ic_state=kNoExtraICState, CacheHolderFlag cache_holder=kCacheOnReceiver)
Definition: ic-compiler.h:62
static TypeHandle Class(i::Handle< i::Map > map, Region *region)
Definition: types.h:327

References v8::internal::Handle< T >::cast(), v8::internal::TypeImpl< Config >::Class(), CompileMonomorphic(), v8::internal::Code::ComputeMonomorphicFlags(), v8::internal::ELEMENT, v8::internal::Isolate::factory(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::JS_ARRAY_TYPE, name, and v8::internal::Map::UpdateCodeCache().

Referenced by v8::internal::KeyedLoadIC::LoadElementStub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeKeyedLoadPolymorphic()

Handle< Code > v8::internal::PropertyICCompiler::ComputeKeyedLoadPolymorphic ( MapHandleList receiver_maps)
static

Definition at line 244 of file ic-compiler.cc.

245  {
246  Isolate* isolate = receiver_maps->at(0)->GetIsolate();
247  Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC);
248  Handle<PolymorphicCodeCache> cache =
249  isolate->factory()->polymorphic_code_cache();
250  Handle<Object> probe = cache->Lookup(receiver_maps, flags);
251  if (probe->IsCode()) return Handle<Code>::cast(probe);
252 
253  TypeHandleList types(receiver_maps->length());
254  for (int i = 0; i < receiver_maps->length(); i++) {
255  types.Add(HeapType::Class(receiver_maps->at(i), isolate));
256  }
257  CodeHandleList handlers(receiver_maps->length());
258  ElementHandlerCompiler compiler(isolate);
259  compiler.CompileElementHandlers(receiver_maps, &handlers);
260  PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC);
261  Handle<Code> code = ic_compiler.CompilePolymorphic(
262  &types, &handlers, isolate->factory()->empty_string(), Code::NORMAL,
263  ELEMENT);
264 
265  isolate->counters()->keyed_load_polymorphic_stubs()->Increment();
266 
267  PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
268  return code;
269 }
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, StubType type=NORMAL, CacheHolderFlag holder=kCacheOnReceiver)
Definition: objects-inl.h:4954
static void Update(Handle< PolymorphicCodeCache > cache, MapHandleList *maps, Code::Flags flags, Handle< Code > code)
Definition: objects.cc:7538

References v8::internal::List< T, AllocationPolicy >::Add(), v8::internal::List< T, AllocationPolicy >::at(), v8::internal::Handle< T >::cast(), v8::internal::TypeImpl< Config >::Class(), v8::internal::ElementHandlerCompiler::CompileElementHandlers(), CompilePolymorphic(), v8::internal::Code::ComputeFlags(), v8::internal::Isolate::counters(), v8::internal::ELEMENT, v8::internal::Isolate::factory(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::Code::NORMAL, v8::internal::POLYMORPHIC, and v8::internal::PolymorphicCodeCache::Update().

Referenced by v8::internal::KeyedLoadIC::LoadElementStub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeKeyedStoreMonomorphic()

Handle< Code > v8::internal::PropertyICCompiler::ComputeKeyedStoreMonomorphic ( Handle< Map receiver_map,
StrictMode  strict_mode,
KeyedAccessStoreMode  store_mode 
)
static

Definition at line 120 of file ic-compiler.cc.

122  {
123  Isolate* isolate = receiver_map->GetIsolate();
124  ExtraICState extra_state =
125  KeyedStoreIC::ComputeExtraICState(strict_mode, store_mode);
127  Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, extra_state);
128 
129  DCHECK(store_mode == STANDARD_STORE ||
130  store_mode == STORE_AND_GROW_NO_TRANSITION ||
132  store_mode == STORE_NO_TRANSITION_HANDLE_COW);
133 
134  Handle<String> name = isolate->factory()->KeyedStoreMonomorphic_string();
135  Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate);
136  if (probe->IsCode()) return Handle<Code>::cast(probe);
137 
138  PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state);
139  Handle<Code> code =
140  compiler.CompileKeyedStoreMonomorphic(receiver_map, store_mode);
141 
142  Map::UpdateCodeCache(receiver_map, name, code);
143  DCHECK(KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()) ==
144  store_mode);
145  return code;
146 }
static ExtraICState ComputeExtraICState(StrictMode flag, KeyedAccessStoreMode mode)
Definition: ic.h:537
static KeyedAccessStoreMode GetKeyedAccessStoreMode(ExtraICState extra_state)
Definition: ic.h:543
@ STORE_AND_GROW_NO_TRANSITION
Definition: objects.h:161
@ STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS
Definition: objects.h:168
@ STORE_NO_TRANSITION_HANDLE_COW
Definition: objects.h:169
@ STANDARD_STORE
Definition: objects.h:154

References v8::internal::Handle< T >::cast(), CompileKeyedStoreMonomorphic(), v8::internal::KeyedStoreIC::ComputeExtraICState(), v8::internal::Code::ComputeMonomorphicFlags(), DCHECK, v8::internal::Isolate::factory(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::KeyedStoreIC::GetKeyedAccessStoreMode(), name, v8::internal::STANDARD_STORE, v8::internal::STORE_AND_GROW_NO_TRANSITION, v8::internal::STORE_NO_TRANSITION_HANDLE_COW, v8::internal::STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, and v8::internal::Map::UpdateCodeCache().

Referenced by v8::internal::KeyedStoreIC::StoreElementStub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeKeyedStorePolymorphic()

Handle< Code > v8::internal::PropertyICCompiler::ComputeKeyedStorePolymorphic ( MapHandleList receiver_maps,
KeyedAccessStoreMode  store_mode,
StrictMode  strict_mode 
)
static

Definition at line 283 of file ic-compiler.cc.

285  {
286  Isolate* isolate = receiver_maps->at(0)->GetIsolate();
287  DCHECK(store_mode == STANDARD_STORE ||
288  store_mode == STORE_AND_GROW_NO_TRANSITION ||
290  store_mode == STORE_NO_TRANSITION_HANDLE_COW);
291  Handle<PolymorphicCodeCache> cache =
292  isolate->factory()->polymorphic_code_cache();
293  ExtraICState extra_state =
294  KeyedStoreIC::ComputeExtraICState(strict_mode, store_mode);
296  Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state);
297  Handle<Object> probe = cache->Lookup(receiver_maps, flags);
298  if (probe->IsCode()) return Handle<Code>::cast(probe);
299 
300  PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state);
301  Handle<Code> code =
302  compiler.CompileKeyedStorePolymorphic(receiver_maps, store_mode);
303  PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
304  return code;
305 }

References v8::internal::List< T, AllocationPolicy >::at(), v8::internal::Handle< T >::cast(), CompileKeyedStorePolymorphic(), v8::internal::KeyedStoreIC::ComputeExtraICState(), v8::internal::Code::ComputeFlags(), DCHECK, v8::internal::Isolate::factory(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::POLYMORPHIC, v8::internal::STANDARD_STORE, v8::internal::STORE_AND_GROW_NO_TRANSITION, v8::internal::STORE_NO_TRANSITION_HANDLE_COW, v8::internal::STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, and v8::internal::PolymorphicCodeCache::Update().

Referenced by v8::internal::KeyedStoreIC::StoreElementStub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeLoad()

Handle< Code > v8::internal::PropertyICCompiler::ComputeLoad ( Isolate isolate,
InlineCacheState  ic_state,
ExtraICState  extra_state 
)
static

Definition at line 170 of file ic-compiler.cc.

172  {
173  Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, ic_state, extra_state);
174  Handle<UnseededNumberDictionary> cache =
175  isolate->factory()->non_monomorphic_cache();
176  int entry = cache->FindEntry(isolate, flags);
177  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
178 
179  PropertyICCompiler compiler(isolate, Code::LOAD_IC);
180  Handle<Code> code;
181  if (ic_state == UNINITIALIZED) {
182  code = compiler.CompileLoadInitialize(flags);
183  } else if (ic_state == PREMONOMORPHIC) {
184  code = compiler.CompileLoadPreMonomorphic(flags);
185  } else {
186  UNREACHABLE();
187  }
188  FillCache(isolate, code);
189  return code;
190 }
#define UNREACHABLE()
Definition: logging.h:30
static void FillCache(Isolate *isolate, Handle< Code > code)
Definition: ic-compiler.cc:163
@ UNINITIALIZED
Definition: globals.h:446
@ PREMONOMORPHIC
Definition: globals.h:448

References CompileLoadInitialize(), CompileLoadPreMonomorphic(), v8::internal::Code::ComputeFlags(), v8::internal::Isolate::factory(), v8::internal::FillCache(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::PREMONOMORPHIC, v8::internal::UNINITIALIZED, and UNREACHABLE.

Referenced by v8::internal::LoadIC::initialize_stub(), and v8::internal::LoadIC::pre_monomorphic_stub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeMonomorphic()

Handle< Code > v8::internal::PropertyICCompiler::ComputeMonomorphic ( Code::Kind  kind,
Handle< Name name,
Handle< HeapType type,
Handle< Code handler,
ExtraICState  extra_ic_state 
)
static

Definition at line 49 of file ic-compiler.cc.

51  {
52  Isolate* isolate = name->GetIsolate();
53  if (handler.is_identical_to(isolate->builtins()->LoadIC_Normal()) ||
54  handler.is_identical_to(isolate->builtins()->StoreIC_Normal())) {
55  name = isolate->factory()->normal_ic_symbol();
56  }
57 
59  Handle<Map> stub_holder = IC::GetICCacheHolder(*type, isolate, &flag);
60 
61  Handle<Code> ic;
62  // There are multiple string maps that all use the same prototype. That
63  // prototype cannot hold multiple handlers, one for each of the string maps,
64  // for a single name. Hence, turn off caching of the IC.
65  bool can_be_cached = !type->Is(HeapType::String());
66  if (can_be_cached) {
67  ic = Find(name, stub_holder, kind, extra_ic_state, flag);
68  if (!ic.is_null()) return ic;
69  }
70 
71 #ifdef DEBUG
72  if (kind == Code::KEYED_STORE_IC) {
75  }
76 #endif
77 
78  PropertyICCompiler ic_compiler(isolate, kind, extra_ic_state, flag);
79  ic = ic_compiler.CompileMonomorphic(type, handler, name, PROPERTY);
80 
81  if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic);
82  return ic;
83 }
static Handle< Map > GetICCacheHolder(HeapType *type, Isolate *isolate, CacheHolderFlag *flag)
Definition: ic-inl.h:198
kFeedbackVectorOffset flag
Definition: objects-inl.h:5418

References v8::internal::Isolate::builtins(), CompileMonomorphic(), DCHECK, v8::internal::Isolate::factory(), Find(), v8::internal::flag, v8::internal::IC::GetICCacheHolder(), v8::internal::KeyedStoreIC::GetKeyedAccessStoreMode(), v8::internal::Handle< T >::is_null(), name, v8::internal::PROPERTY, v8::internal::STANDARD_STORE, and v8::internal::Map::UpdateCodeCache().

Referenced by v8::internal::IC::UpdateMonomorphicIC(), and v8::internal::IC::UpdatePolymorphicIC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputePolymorphic()

Handle< Code > v8::internal::PropertyICCompiler::ComputePolymorphic ( Code::Kind  kind,
TypeHandleList types,
CodeHandleList handlers,
int  number_of_valid_maps,
Handle< Name name,
ExtraICState  extra_ic_state 
)
static

Definition at line 272 of file ic-compiler.cc.

274  {
275  Handle<Code> handler = handlers->at(0);
276  Code::StubType type = valid_types == 1 ? handler->type() : Code::NORMAL;
277  DCHECK(kind == Code::LOAD_IC || kind == Code::STORE_IC);
278  PropertyICCompiler ic_compiler(name->GetIsolate(), kind, extra_ic_state);
279  return ic_compiler.CompilePolymorphic(types, handlers, name, type, PROPERTY);
280 }

References v8::internal::List< T, AllocationPolicy >::at(), CompilePolymorphic(), DCHECK, name, v8::internal::Code::NORMAL, and v8::internal::PROPERTY.

Referenced by v8::internal::IC::UpdatePolymorphicIC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeStore()

Handle< Code > v8::internal::PropertyICCompiler::ComputeStore ( Isolate isolate,
InlineCacheState  ic_state,
ExtraICState  extra_state 
)
static

Definition at line 193 of file ic-compiler.cc.

195  {
196  Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, ic_state, extra_state);
197  Handle<UnseededNumberDictionary> cache =
198  isolate->factory()->non_monomorphic_cache();
199  int entry = cache->FindEntry(isolate, flags);
200  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
201 
202  PropertyICCompiler compiler(isolate, Code::STORE_IC);
203  Handle<Code> code;
204  if (ic_state == UNINITIALIZED) {
205  code = compiler.CompileStoreInitialize(flags);
206  } else if (ic_state == PREMONOMORPHIC) {
207  code = compiler.CompileStorePreMonomorphic(flags);
208  } else if (ic_state == GENERIC) {
209  code = compiler.CompileStoreGeneric(flags);
210  } else if (ic_state == MEGAMORPHIC) {
211  code = compiler.CompileStoreMegamorphic(flags);
212  } else {
213  UNREACHABLE();
214  }
215 
216  FillCache(isolate, code);
217  return code;
218 }

References CompileStoreGeneric(), CompileStoreInitialize(), CompileStoreMegamorphic(), CompileStorePreMonomorphic(), v8::internal::Code::ComputeFlags(), v8::internal::Isolate::factory(), v8::internal::FillCache(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::GENERIC, v8::internal::MEGAMORPHIC, v8::internal::PREMONOMORPHIC, v8::internal::UNINITIALIZED, and UNREACHABLE.

Referenced by v8::internal::StoreIC::generic_stub(), v8::internal::StoreIC::initialize_stub(), v8::internal::StoreIC::megamorphic_stub(), and v8::internal::StoreIC::pre_monomorphic_stub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Find()

Handle< Code > v8::internal::PropertyICCompiler::Find ( Handle< Name name,
Handle< Map stub_holder_map,
Code::Kind  kind,
ExtraICState  extra_ic_state = kNoExtraICState,
CacheHolderFlag  cache_holder = kCacheOnReceiver 
)
staticprivate

Definition at line 16 of file ic-compiler.cc.

19  {
21  Code::ComputeMonomorphicFlags(kind, extra_state, cache_holder);
22  Object* probe = stub_holder->FindInCodeCache(*name, flags);
23  if (probe->IsCode()) return handle(Code::cast(probe));
24  return Handle<Code>::null();
25 }
static Handle< T > null()
Definition: handles.h:123
kSerializedDataOffset Object
Definition: objects-inl.h:5322
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

References v8::internal::Code::ComputeMonomorphicFlags(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::handle(), name, and v8::internal::Handle< T >::null().

Referenced by ComputeCompareNil(), and ComputeMonomorphic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindPreMonomorphic()

Code * v8::internal::PropertyICCompiler::FindPreMonomorphic ( Isolate isolate,
Code::Kind  kind,
ExtraICState  extra_ic_state 
)
static

Definition at line 149 of file ic-compiler.cc.

150  {
152  UnseededNumberDictionary* dictionary =
153  isolate->heap()->non_monomorphic_cache();
154  int entry = dictionary->FindEntry(isolate, flags);
155  DCHECK(entry != -1);
156  Object* code = dictionary->ValueAt(entry);
157  // This might be called during the marking phase of the collector
158  // hence the unchecked cast.
159  return reinterpret_cast<Code*>(code);
160 }

References v8::internal::Code::ComputeFlags(), DCHECK, v8::internal::HashTable< Derived, Shape, Key >::FindEntry(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::Isolate::heap(), v8::internal::PREMONOMORPHIC, and v8::internal::Dictionary< Derived, Shape, Key >::ValueAt().

Referenced by v8::internal::LoadIC::Clear(), and v8::internal::StoreIC::Clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GenerateRuntimeSetProperty()

static void v8::internal::PropertyICCompiler::GenerateRuntimeSetProperty ( MacroAssembler masm,
StrictMode  strict_mode 
)
static

Referenced by CompileStoreGeneric().

+ Here is the caller graph for this function:

◆ GetCode()

Handle< Code > v8::internal::PropertyICCompiler::GetCode ( Code::Kind  kind,
Code::StubType  type,
Handle< Name name,
InlineCacheState  state = MONOMORPHIC 
)
private

Definition at line 360 of file ic-compiler.cc.

362  {
364  Code::ComputeFlags(kind, state, extra_ic_state_, type, cache_holder());
365  Handle<Code> code = GetCodeWithFlags(flags, name);
367  PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name));
368  return code;
369 }
static void RegisterWeakMapDependency(Handle< Code > stub)
Definition: ic.cc:442

References v8::internal::Code::ComputeFlags(), extra_ic_state_, v8::internal::anonymous_namespace{flags.cc}::flags, log_kind(), name, PROFILE, and v8::internal::IC::RegisterWeakMapDependency().

Referenced by CompileKeyedStoreMonomorphic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IncludesNumberType()

bool v8::internal::PropertyICCompiler::IncludesNumberType ( TypeHandleList types)
private

Definition at line 28 of file ic-compiler.cc.

28  {
29  for (int i = 0; i < types->length(); ++i) {
30  if (types->at(i)->Is(HeapType::Number())) return true;
31  }
32  return false;
33 }

References v8::internal::List< T, AllocationPolicy >::at().

+ Here is the call graph for this function:

◆ log_kind()

Logger::LogEventsAndTags v8::internal::PropertyICCompiler::log_kind ( Handle< Code code)
inlineprivate

Definition at line 99 of file ic-compiler.h.

99  {
100  if (kind() == Code::LOAD_IC) {
101  return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG
102  : Logger::LOAD_POLYMORPHIC_IC_TAG;
103  } else if (kind() == Code::KEYED_LOAD_IC) {
104  return code->ic_state() == MONOMORPHIC
105  ? Logger::KEYED_LOAD_IC_TAG
106  : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG;
107  } else if (kind() == Code::STORE_IC) {
108  return code->ic_state() == MONOMORPHIC ? Logger::STORE_IC_TAG
109  : Logger::STORE_POLYMORPHIC_IC_TAG;
110  } else {
111  DCHECK_EQ(Code::KEYED_STORE_IC, kind());
112  return code->ic_state() == MONOMORPHIC
113  ? Logger::KEYED_STORE_IC_TAG
114  : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG;
115  }
116  }
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206

References DCHECK_EQ, and v8::internal::MONOMORPHIC.

Referenced by CompileKeyedStorePolymorphic(), and GetCode().

+ Here is the caller graph for this function:

Member Data Documentation

◆ extra_ic_state_

const ExtraICState v8::internal::PropertyICCompiler::extra_ic_state_
private

Definition at line 118 of file ic-compiler.h.

Referenced by GetCode().


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