OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_TYPE_INFO_H_ | 5 #ifndef V8_TYPE_INFO_H_ |
6 #define V8_TYPE_INFO_H_ | 6 #define V8_TYPE_INFO_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/types.h" | 10 #include "src/types.h" |
11 #include "src/zone-inl.h" | 11 #include "src/zone-inl.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // Forward declarations. | 16 // Forward declarations. |
17 class SmallMapList; | 17 class SmallMapList; |
18 | 18 |
19 | 19 |
20 class TypeFeedbackOracle: public ZoneObject { | 20 class TypeFeedbackOracle: public ZoneObject { |
21 public: | 21 public: |
22 TypeFeedbackOracle(Handle<Code> code, | 22 TypeFeedbackOracle(Handle<Code> code, |
23 Handle<TypeFeedbackVector> feedback_vector, | 23 Handle<TypeFeedbackVector> feedback_vector, |
24 Handle<Context> native_context, Zone* zone); | 24 Handle<Context> native_context, Zone* zone); |
25 | 25 |
26 bool LoadIsUninitialized(TypeFeedbackId id); | 26 bool LoadIsUninitialized(TypeFeedbackId id); |
| 27 bool LoadIsUninitialized(FeedbackVectorICSlot slot); |
27 bool StoreIsUninitialized(TypeFeedbackId id); | 28 bool StoreIsUninitialized(TypeFeedbackId id); |
28 bool CallIsUninitialized(FeedbackVectorICSlot slot); | 29 bool CallIsUninitialized(FeedbackVectorICSlot slot); |
29 bool CallIsMonomorphic(FeedbackVectorICSlot slot); | 30 bool CallIsMonomorphic(FeedbackVectorICSlot slot); |
30 bool KeyedArrayCallIsHoley(TypeFeedbackId id); | 31 bool KeyedArrayCallIsHoley(TypeFeedbackId id); |
31 bool CallNewIsMonomorphic(FeedbackVectorSlot slot); | 32 bool CallNewIsMonomorphic(FeedbackVectorSlot slot); |
32 | 33 |
33 // TODO(1571) We can't use ForInStatement::ForInType as the return value due | 34 // TODO(1571) We can't use ForInStatement::ForInType as the return value due |
34 // to various cycles in our headers. | 35 // to various cycles in our headers. |
35 // TODO(rossberg): once all oracle access is removed from ast.cc, it should | 36 // TODO(rossberg): once all oracle access is removed from ast.cc, it should |
36 // be possible. | 37 // be possible. |
37 byte ForInType(FeedbackVectorSlot feedback_vector_slot); | 38 byte ForInType(FeedbackVectorSlot feedback_vector_slot); |
38 | 39 |
39 void GetStoreModeAndKeyType(TypeFeedbackId id, | 40 void GetStoreModeAndKeyType(TypeFeedbackId id, |
40 KeyedAccessStoreMode* store_mode, | 41 KeyedAccessStoreMode* store_mode, |
41 IcCheckType* key_type); | 42 IcCheckType* key_type); |
42 | 43 |
43 void PropertyReceiverTypes(TypeFeedbackId id, Handle<String> name, | 44 void PropertyReceiverTypes(TypeFeedbackId id, Handle<String> name, |
44 SmallMapList* receiver_types); | 45 SmallMapList* receiver_types); |
| 46 void PropertyReceiverTypes(FeedbackVectorICSlot slot, Handle<String> name, |
| 47 SmallMapList* receiver_types); |
45 void KeyedPropertyReceiverTypes(TypeFeedbackId id, | 48 void KeyedPropertyReceiverTypes(TypeFeedbackId id, |
46 SmallMapList* receiver_types, | 49 SmallMapList* receiver_types, |
47 bool* is_string); | 50 bool* is_string); |
| 51 void KeyedPropertyReceiverTypes(FeedbackVectorICSlot slot, |
| 52 SmallMapList* receiver_types, |
| 53 bool* is_string); |
48 void AssignmentReceiverTypes(TypeFeedbackId id, | 54 void AssignmentReceiverTypes(TypeFeedbackId id, |
49 Handle<String> name, | 55 Handle<String> name, |
50 SmallMapList* receiver_types); | 56 SmallMapList* receiver_types); |
51 void KeyedAssignmentReceiverTypes(TypeFeedbackId id, | 57 void KeyedAssignmentReceiverTypes(TypeFeedbackId id, |
52 SmallMapList* receiver_types, | 58 SmallMapList* receiver_types, |
53 KeyedAccessStoreMode* store_mode, | 59 KeyedAccessStoreMode* store_mode, |
54 IcCheckType* key_type); | 60 IcCheckType* key_type); |
55 void CountReceiverTypes(TypeFeedbackId id, | 61 void CountReceiverTypes(TypeFeedbackId id, |
56 SmallMapList* receiver_types); | 62 SmallMapList* receiver_types); |
57 | 63 |
58 void CollectReceiverTypes(TypeFeedbackId id, | 64 void CollectReceiverTypes(TypeFeedbackId id, |
59 SmallMapList* types); | 65 SmallMapList* types); |
| 66 template <class T> |
| 67 void CollectReceiverTypes(T* obj, SmallMapList* types); |
60 | 68 |
61 static bool CanRetainOtherContext(Map* map, Context* native_context); | 69 static bool CanRetainOtherContext(Map* map, Context* native_context); |
62 static bool CanRetainOtherContext(JSFunction* function, | 70 static bool CanRetainOtherContext(JSFunction* function, |
63 Context* native_context); | 71 Context* native_context); |
64 | 72 |
65 Handle<JSFunction> GetCallTarget(FeedbackVectorICSlot slot); | 73 Handle<JSFunction> GetCallTarget(FeedbackVectorICSlot slot); |
66 Handle<AllocationSite> GetCallAllocationSite(FeedbackVectorICSlot slot); | 74 Handle<AllocationSite> GetCallAllocationSite(FeedbackVectorICSlot slot); |
67 Handle<JSFunction> GetCallNewTarget(FeedbackVectorSlot slot); | 75 Handle<JSFunction> GetCallNewTarget(FeedbackVectorSlot slot); |
68 Handle<AllocationSite> GetCallNewAllocationSite(FeedbackVectorSlot slot); | 76 Handle<AllocationSite> GetCallNewAllocationSite(FeedbackVectorSlot slot); |
69 | 77 |
(...skipping 21 matching lines...) Expand all Loading... |
91 Type* CountType(TypeFeedbackId id); | 99 Type* CountType(TypeFeedbackId id); |
92 | 100 |
93 Zone* zone() const { return zone_; } | 101 Zone* zone() const { return zone_; } |
94 Isolate* isolate() const { return zone_->isolate(); } | 102 Isolate* isolate() const { return zone_->isolate(); } |
95 | 103 |
96 private: | 104 private: |
97 void CollectReceiverTypes(TypeFeedbackId id, | 105 void CollectReceiverTypes(TypeFeedbackId id, |
98 Handle<String> name, | 106 Handle<String> name, |
99 Code::Flags flags, | 107 Code::Flags flags, |
100 SmallMapList* types); | 108 SmallMapList* types); |
| 109 template <class T> |
| 110 void CollectReceiverTypes(T* obj, Handle<String> name, Code::Flags flags, |
| 111 SmallMapList* types); |
| 112 |
| 113 // Returns true if there is at least one string map and if |
| 114 // all maps are string maps. |
| 115 bool HasOnlyStringMaps(SmallMapList* receiver_types); |
101 | 116 |
102 void SetInfo(TypeFeedbackId id, Object* target); | 117 void SetInfo(TypeFeedbackId id, Object* target); |
103 | 118 |
104 void BuildDictionary(Handle<Code> code); | 119 void BuildDictionary(Handle<Code> code); |
105 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); | 120 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); |
106 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); | 121 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); |
107 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, | 122 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
108 Code* old_code, | 123 Code* old_code, |
109 Code* new_code); | 124 Code* new_code); |
110 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); | 125 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); |
(...skipping 12 matching lines...) Expand all Loading... |
123 Zone* zone_; | 138 Zone* zone_; |
124 Handle<UnseededNumberDictionary> dictionary_; | 139 Handle<UnseededNumberDictionary> dictionary_; |
125 Handle<TypeFeedbackVector> feedback_vector_; | 140 Handle<TypeFeedbackVector> feedback_vector_; |
126 | 141 |
127 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 142 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
128 }; | 143 }; |
129 | 144 |
130 } } // namespace v8::internal | 145 } } // namespace v8::internal |
131 | 146 |
132 #endif // V8_TYPE_INFO_H_ | 147 #endif // V8_TYPE_INFO_H_ |
OLD | NEW |