V8 Project
ic-compiler.h
Go to the documentation of this file.
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_IC_IC_COMPILER_H_
6 #define V8_IC_IC_COMPILER_H_
7 
9 
10 namespace v8 {
11 namespace internal {
12 
13 
15 
16 
18  public:
19  // Finds the Code object stored in the Heap::non_monomorphic_cache().
20  static Code* FindPreMonomorphic(Isolate* isolate, Code::Kind kind,
21  ExtraICState extra_ic_state);
22 
23  // Named
24  static Handle<Code> ComputeLoad(Isolate* isolate, InlineCacheState ic_state,
25  ExtraICState extra_state);
26  static Handle<Code> ComputeStore(Isolate* isolate, InlineCacheState ic_state,
27  ExtraICState extra_state);
28 
30  Handle<HeapType> type,
31  Handle<Code> handler,
32  ExtraICState extra_ic_state);
34  CodeHandleList* handlers,
35  int number_of_valid_maps,
37  ExtraICState extra_ic_state);
38 
39  // Keyed
41 
43  Handle<Map> receiver_map, StrictMode strict_mode,
44  KeyedAccessStoreMode store_mode);
47  MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode,
48  StrictMode strict_mode);
49 
50  // Compare nil
51  static Handle<Code> ComputeCompareNil(Handle<Map> receiver_map,
52  CompareNilICStub* stub);
53 
54  // Helpers
55  // TODO(verwaest): Move all uses of these helpers to the PropertyICCompiler
56  // and make the helpers private.
58  StrictMode strict_mode);
59 
60 
61  private:
63  ExtraICState extra_ic_state = kNoExtraICState,
64  CacheHolderFlag cache_holder = kCacheOnReceiver)
65  : PropertyAccessCompiler(isolate, kind, cache_holder),
66  extra_ic_state_(extra_ic_state) {}
67 
68  static Handle<Code> Find(Handle<Name> name, Handle<Map> stub_holder_map,
69  Code::Kind kind,
70  ExtraICState extra_ic_state = kNoExtraICState,
71  CacheHolderFlag cache_holder = kCacheOnReceiver);
72 
79 
83  CodeHandleList* handlers, Handle<Name> name,
84  Code::StubType type, IcCheckType check);
85 
87  KeyedAccessStoreMode store_mode);
89  KeyedAccessStoreMode store_mode);
91  CodeHandleList* handler_stubs,
92  MapHandleList* transitioned_maps);
93 
95 
98 
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  }
117 
119 };
120 
121 
122 }
123 } // namespace v8::internal
124 
125 #endif // V8_IC_IC_COMPILER_H_
static Handle< Code > ComputeKeyedLoadMonomorphic(Handle< Map > receiver_map)
Definition: ic-compiler.cc:86
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
const ExtraICState extra_ic_state_
Definition: ic-compiler.h:118
Handle< Code > CompileStoreMegamorphic(Code::Flags flags)
Definition: ic-compiler.cc:352
static Handle< Code > ComputeMonomorphic(Code::Kind kind, Handle< Name > name, Handle< HeapType > type, Handle< Code > handler, ExtraICState extra_ic_state)
Definition: ic-compiler.cc:49
Handle< Code > CompileStoreInitialize(Code::Flags flags)
Definition: ic-compiler.cc:325
Handle< Code > GetCode(Code::Kind kind, Code::StubType type, Handle< Name > name, InlineCacheState state=MONOMORPHIC)
Definition: ic-compiler.cc:360
static Handle< Code > ComputePolymorphic(Code::Kind kind, TypeHandleList *types, CodeHandleList *handlers, int number_of_valid_maps, Handle< Name > name, ExtraICState extra_ic_state)
Definition: ic-compiler.cc:272
Handle< Code > CompileKeyedStorePolymorphic(MapHandleList *receiver_maps, KeyedAccessStoreMode store_mode)
Definition: ic-compiler.cc:372
Handle< Code > CompileKeyedStoreMonomorphic(Handle< Map > receiver_map, KeyedAccessStoreMode store_mode)
Definition: ic-compiler.cc:423
Handle< Code > CompileLoadPreMonomorphic(Code::Flags flags)
Definition: ic-compiler.cc:316
Handle< Code > CompileStorePreMonomorphic(Code::Flags flags)
Definition: ic-compiler.cc:333
static Handle< Code > ComputeLoad(Isolate *isolate, InlineCacheState ic_state, ExtraICState extra_state)
Definition: ic-compiler.cc:170
static Handle< Code > ComputeKeyedStorePolymorphic(MapHandleList *receiver_maps, KeyedAccessStoreMode store_mode, StrictMode strict_mode)
Definition: ic-compiler.cc:283
bool IncludesNumberType(TypeHandleList *types)
Definition: ic-compiler.cc:28
static Handle< Code > ComputeCompareNil(Handle< Map > receiver_map, CompareNilICStub *stub)
Definition: ic-compiler.cc:221
Handle< Code > CompileStoreGeneric(Code::Flags flags)
Definition: ic-compiler.cc:342
static void GenerateRuntimeSetProperty(MacroAssembler *masm, StrictMode strict_mode)
Logger::LogEventsAndTags log_kind(Handle< Code > code)
Definition: ic-compiler.h:99
Handle< Code > CompileKeyedStorePolymorphic(MapHandleList *receiver_maps, CodeHandleList *handler_stubs, MapHandleList *transitioned_maps)
static Handle< Code > ComputeStore(Isolate *isolate, InlineCacheState ic_state, ExtraICState extra_state)
Definition: ic-compiler.cc:193
PropertyICCompiler(Isolate *isolate, Code::Kind kind, ExtraICState extra_ic_state=kNoExtraICState, CacheHolderFlag cache_holder=kCacheOnReceiver)
Definition: ic-compiler.h:62
static Code * FindPreMonomorphic(Isolate *isolate, Code::Kind kind, ExtraICState extra_ic_state)
Definition: ic-compiler.cc:149
static Handle< Code > ComputeKeyedLoadPolymorphic(MapHandleList *receiver_maps)
Definition: ic-compiler.cc:244
Handle< Code > CompileLoadInitialize(Code::Flags flags)
Definition: ic-compiler.cc:308
static Handle< Code > ComputeKeyedStoreMonomorphic(Handle< Map > receiver_map, StrictMode strict_mode, KeyedAccessStoreMode store_mode)
Definition: ic-compiler.cc:120
Handle< Code > CompileMonomorphic(Handle< HeapType > type, Handle< Code > handler, Handle< Name > name, IcCheckType check)
Definition: ic-compiler.cc:36
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
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
static const ExtraICState kNoExtraICState
Definition: objects.h:306
KeyedAccessStoreMode
Definition: objects.h:153
@ kCacheOnReceiver
Definition: globals.h:488
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20