OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_IC_IC_COMPILER_H_ | 5 #ifndef V8_IC_IC_COMPILER_H_ |
6 #define V8_IC_IC_COMPILER_H_ | 6 #define V8_IC_IC_COMPILER_H_ |
7 | 7 |
8 #include "src/ic/access-compiler.h" | 8 #include "src/ic/access-compiler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 | 13 |
14 class PropertyICCompiler : public PropertyAccessCompiler { | 14 class PropertyICCompiler : public PropertyAccessCompiler { |
15 public: | 15 public: |
16 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 16 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
17 static Code* FindPreMonomorphic(Isolate* isolate, Code::Kind kind, | 17 static Code* FindPreMonomorphic(Isolate* isolate, Code::Kind kind, |
18 ExtraICState extra_ic_state); | 18 ExtraICState extra_ic_state); |
19 | 19 |
20 // Named | 20 // Named |
21 static Handle<Code> ComputeStore(Isolate* isolate, InlineCacheState ic_state, | 21 static Handle<Code> ComputeStore(Isolate* isolate, InlineCacheState ic_state, |
22 ExtraICState extra_state); | 22 ExtraICState extra_state); |
23 | 23 |
24 static Handle<Code> ComputeMonomorphic(Code::Kind kind, Handle<Name> name, | |
25 Handle<Map> map, Handle<Code> handler, | |
26 ExtraICState extra_ic_state); | |
27 static Handle<Code> ComputePolymorphic(Code::Kind kind, MapHandleList* maps, | |
28 CodeHandleList* handlers, | |
29 int number_of_valid_maps, | |
30 Handle<Name> name, | |
31 ExtraICState extra_ic_state); | |
32 | |
33 // Keyed | 24 // Keyed |
34 static Handle<Code> ComputeKeyedLoadMonomorphicHandler( | 25 static Handle<Code> ComputeKeyedLoadMonomorphicHandler( |
35 Handle<Map> receiver_map, ExtraICState extra_ic_state); | 26 Handle<Map> receiver_map, ExtraICState extra_ic_state); |
36 | 27 |
37 static Handle<Code> ComputeKeyedStoreMonomorphicHandler( | 28 static Handle<Code> ComputeKeyedStoreMonomorphicHandler( |
38 Handle<Map> receiver_map, LanguageMode language_mode, | 29 Handle<Map> receiver_map, LanguageMode language_mode, |
39 KeyedAccessStoreMode store_mode); | 30 KeyedAccessStoreMode store_mode); |
40 static Handle<Code> ComputeKeyedStoreMonomorphic( | |
41 Handle<Map> receiver_map, LanguageMode language_mode, | |
42 KeyedAccessStoreMode store_mode); | |
43 static void ComputeKeyedStorePolymorphicHandlers( | 31 static void ComputeKeyedStorePolymorphicHandlers( |
44 MapHandleList* receiver_maps, MapHandleList* transitioned_maps, | 32 MapHandleList* receiver_maps, MapHandleList* transitioned_maps, |
45 CodeHandleList* handlers, KeyedAccessStoreMode store_mode, | 33 CodeHandleList* handlers, KeyedAccessStoreMode store_mode, |
46 LanguageMode language_mode); | 34 LanguageMode language_mode); |
47 static Handle<Code> ComputeKeyedStorePolymorphic( | |
48 MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode, | |
49 LanguageMode language_mode); | |
50 | 35 |
51 // Compare nil | 36 // Compare nil |
52 static Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, | 37 static Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, |
53 CompareNilICStub* stub); | 38 CompareNilICStub* stub); |
54 | 39 |
55 // Helpers | 40 // Helpers |
56 // TODO(verwaest): Move all uses of these helpers to the PropertyICCompiler | 41 // TODO(verwaest): Move all uses of these helpers to the PropertyICCompiler |
57 // and make the helpers private. | 42 // and make the helpers private. |
58 static void GenerateRuntimeSetProperty(MacroAssembler* masm, | 43 static void GenerateRuntimeSetProperty(MacroAssembler* masm, |
59 LanguageMode language_mode); | 44 LanguageMode language_mode); |
(...skipping 10 matching lines...) Expand all Loading... |
70 Code::Kind kind, | 55 Code::Kind kind, |
71 ExtraICState extra_ic_state = kNoExtraICState, | 56 ExtraICState extra_ic_state = kNoExtraICState, |
72 CacheHolderFlag cache_holder = kCacheOnReceiver); | 57 CacheHolderFlag cache_holder = kCacheOnReceiver); |
73 | 58 |
74 Handle<Code> CompileLoadInitialize(Code::Flags flags); | 59 Handle<Code> CompileLoadInitialize(Code::Flags flags); |
75 Handle<Code> CompileStoreInitialize(Code::Flags flags); | 60 Handle<Code> CompileStoreInitialize(Code::Flags flags); |
76 Handle<Code> CompileStorePreMonomorphic(Code::Flags flags); | 61 Handle<Code> CompileStorePreMonomorphic(Code::Flags flags); |
77 Handle<Code> CompileStoreGeneric(Code::Flags flags); | 62 Handle<Code> CompileStoreGeneric(Code::Flags flags); |
78 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); | 63 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); |
79 | 64 |
80 Handle<Code> CompileMonomorphic(Handle<Map> map, Handle<Code> handler, | |
81 Handle<Name> name, IcCheckType check); | |
82 Handle<Code> CompilePolymorphic(MapHandleList* maps, CodeHandleList* handlers, | |
83 Handle<Name> name, Code::StubType type, | |
84 IcCheckType check); | |
85 | |
86 Handle<Code> CompileKeyedStoreMonomorphicHandler( | 65 Handle<Code> CompileKeyedStoreMonomorphicHandler( |
87 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode); | 66 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode); |
88 Handle<Code> CompileKeyedStoreMonomorphic(Handle<Map> receiver_map, | 67 Handle<Code> CompileKeyedStoreMonomorphic(Handle<Map> receiver_map, |
89 KeyedAccessStoreMode store_mode); | 68 KeyedAccessStoreMode store_mode); |
90 Handle<Code> CompileKeyedStorePolymorphic(MapHandleList* receiver_maps, | |
91 KeyedAccessStoreMode store_mode); | |
92 void CompileKeyedStorePolymorphicHandlers(MapHandleList* receiver_maps, | 69 void CompileKeyedStorePolymorphicHandlers(MapHandleList* receiver_maps, |
93 MapHandleList* transitioned_maps, | 70 MapHandleList* transitioned_maps, |
94 CodeHandleList* handlers, | 71 CodeHandleList* handlers, |
95 KeyedAccessStoreMode store_mode); | 72 KeyedAccessStoreMode store_mode); |
96 Handle<Code> CompileKeyedStorePolymorphic(MapHandleList* receiver_maps, | |
97 CodeHandleList* handler_stubs, | |
98 MapHandleList* transitioned_maps); | |
99 | 73 |
100 bool IncludesNumberMap(MapHandleList* maps); | 74 bool IncludesNumberMap(MapHandleList* maps); |
101 | 75 |
102 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name, | 76 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name, |
103 InlineCacheState state = MONOMORPHIC); | 77 InlineCacheState state = MONOMORPHIC); |
104 | 78 |
105 Logger::LogEventsAndTags log_kind(Handle<Code> code) { | 79 Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
106 if (kind() == Code::LOAD_IC) { | 80 if (kind() == Code::LOAD_IC) { |
107 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG | 81 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG |
108 : Logger::LOAD_POLYMORPHIC_IC_TAG; | 82 : Logger::LOAD_POLYMORPHIC_IC_TAG; |
(...skipping 13 matching lines...) Expand all Loading... |
122 } | 96 } |
123 | 97 |
124 const ExtraICState extra_ic_state_; | 98 const ExtraICState extra_ic_state_; |
125 }; | 99 }; |
126 | 100 |
127 | 101 |
128 } // namespace internal | 102 } // namespace internal |
129 } // namespace v8 | 103 } // namespace v8 |
130 | 104 |
131 #endif // V8_IC_IC_COMPILER_H_ | 105 #endif // V8_IC_IC_COMPILER_H_ |
OLD | NEW |