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(). | |
17 static Code* FindPreMonomorphic(Isolate* isolate, Code::Kind kind, | |
18 ExtraICState extra_ic_state); | |
19 | |
20 // Named | 16 // Named |
21 static Handle<Code> ComputeStore(Isolate* isolate, InlineCacheState ic_state, | 17 static Handle<Code> ComputeStore(Isolate* isolate, InlineCacheState ic_state, |
22 ExtraICState extra_state); | 18 ExtraICState extra_state); |
23 | 19 |
24 // Keyed | 20 // Keyed |
25 static Handle<Code> ComputeKeyedLoadMonomorphicHandler( | 21 static Handle<Code> ComputeKeyedLoadMonomorphicHandler( |
26 Handle<Map> receiver_map, ExtraICState extra_ic_state); | 22 Handle<Map> receiver_map, ExtraICState extra_ic_state); |
27 | 23 |
28 static Handle<Code> ComputeKeyedStoreMonomorphicHandler( | 24 static Handle<Code> ComputeKeyedStoreMonomorphicHandler( |
29 Handle<Map> receiver_map, LanguageMode language_mode, | 25 Handle<Map> receiver_map, LanguageMode language_mode, |
(...skipping 10 matching lines...) Expand all Loading... |
40 LanguageMode language_mode); | 36 LanguageMode language_mode); |
41 | 37 |
42 | 38 |
43 private: | 39 private: |
44 PropertyICCompiler(Isolate* isolate, Code::Kind kind, | 40 PropertyICCompiler(Isolate* isolate, Code::Kind kind, |
45 ExtraICState extra_ic_state = kNoExtraICState, | 41 ExtraICState extra_ic_state = kNoExtraICState, |
46 CacheHolderFlag cache_holder = kCacheOnReceiver) | 42 CacheHolderFlag cache_holder = kCacheOnReceiver) |
47 : PropertyAccessCompiler(isolate, kind, cache_holder), | 43 : PropertyAccessCompiler(isolate, kind, cache_holder), |
48 extra_ic_state_(extra_ic_state) {} | 44 extra_ic_state_(extra_ic_state) {} |
49 | 45 |
50 static Handle<Code> Find(Handle<Name> name, Handle<Map> stub_holder_map, | |
51 Code::Kind kind, | |
52 ExtraICState extra_ic_state = kNoExtraICState, | |
53 CacheHolderFlag cache_holder = kCacheOnReceiver); | |
54 | |
55 Handle<Code> CompileLoadInitialize(Code::Flags flags); | |
56 Handle<Code> CompileStoreInitialize(Code::Flags flags); | |
57 Handle<Code> CompileStorePreMonomorphic(Code::Flags flags); | |
58 Handle<Code> CompileStoreGeneric(Code::Flags flags); | |
59 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); | 46 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); |
60 | 47 |
61 Handle<Code> CompileKeyedStoreMonomorphicHandler( | 48 Handle<Code> CompileKeyedStoreMonomorphicHandler( |
62 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode); | 49 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode); |
63 Handle<Code> CompileKeyedStoreMonomorphic(Handle<Map> receiver_map, | |
64 KeyedAccessStoreMode store_mode); | |
65 void CompileKeyedStorePolymorphicHandlers(MapHandleList* receiver_maps, | 50 void CompileKeyedStorePolymorphicHandlers(MapHandleList* receiver_maps, |
66 MapHandleList* transitioned_maps, | 51 MapHandleList* transitioned_maps, |
67 CodeHandleList* handlers, | 52 CodeHandleList* handlers, |
68 KeyedAccessStoreMode store_mode); | 53 KeyedAccessStoreMode store_mode); |
69 | 54 |
70 bool IncludesNumberMap(MapHandleList* maps); | 55 Handle<Code> GetCode(Code::Kind kind, Handle<Name> name, |
71 | |
72 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name, | |
73 InlineCacheState state = MONOMORPHIC); | 56 InlineCacheState state = MONOMORPHIC); |
74 | 57 |
75 Logger::LogEventsAndTags log_kind(Handle<Code> code) { | 58 Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
76 if (kind() == Code::LOAD_IC) { | 59 if (kind() == Code::LOAD_IC) { |
77 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG | 60 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG |
78 : Logger::LOAD_POLYMORPHIC_IC_TAG; | 61 : Logger::LOAD_POLYMORPHIC_IC_TAG; |
79 } else if (kind() == Code::KEYED_LOAD_IC) { | 62 } else if (kind() == Code::KEYED_LOAD_IC) { |
80 return code->ic_state() == MONOMORPHIC | 63 return code->ic_state() == MONOMORPHIC |
81 ? Logger::KEYED_LOAD_IC_TAG | 64 ? Logger::KEYED_LOAD_IC_TAG |
82 : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; | 65 : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; |
83 } else if (kind() == Code::STORE_IC) { | 66 } else if (kind() == Code::STORE_IC) { |
84 return code->ic_state() == MONOMORPHIC ? Logger::STORE_IC_TAG | 67 return code->ic_state() == MONOMORPHIC ? Logger::STORE_IC_TAG |
85 : Logger::STORE_POLYMORPHIC_IC_TAG; | 68 : Logger::STORE_POLYMORPHIC_IC_TAG; |
86 } else { | 69 } else { |
87 DCHECK_EQ(Code::KEYED_STORE_IC, kind()); | 70 DCHECK_EQ(Code::KEYED_STORE_IC, kind()); |
88 return code->ic_state() == MONOMORPHIC | 71 return code->ic_state() == MONOMORPHIC |
89 ? Logger::KEYED_STORE_IC_TAG | 72 ? Logger::KEYED_STORE_IC_TAG |
90 : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | 73 : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; |
91 } | 74 } |
92 } | 75 } |
93 | 76 |
94 const ExtraICState extra_ic_state_; | 77 const ExtraICState extra_ic_state_; |
95 }; | 78 }; |
96 | 79 |
97 | 80 |
98 } // namespace internal | 81 } // namespace internal |
99 } // namespace v8 | 82 } // namespace v8 |
100 | 83 |
101 #endif // V8_IC_IC_COMPILER_H_ | 84 #endif // V8_IC_IC_COMPILER_H_ |
OLD | NEW |