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/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
11 #include "src/parsing/token.h" | 11 #include "src/parsing/token.h" |
12 #include "src/types.h" | 12 #include "src/types.h" |
13 #include "src/zone.h" | 13 #include "src/zone.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 // Forward declarations. | 18 // Forward declarations. |
19 class SmallMapList; | 19 class SmallMapList; |
20 | 20 class FeedbackNexus; |
21 | 21 |
22 class TypeFeedbackOracle: public ZoneObject { | 22 class TypeFeedbackOracle: public ZoneObject { |
23 public: | 23 public: |
24 TypeFeedbackOracle(Isolate* isolate, Zone* zone, Handle<Code> code, | 24 TypeFeedbackOracle(Isolate* isolate, Zone* zone, Handle<Code> code, |
25 Handle<TypeFeedbackVector> feedback_vector, | 25 Handle<TypeFeedbackVector> feedback_vector, |
26 Handle<Context> native_context); | 26 Handle<Context> native_context); |
27 | 27 |
28 InlineCacheState LoadInlineCacheState(FeedbackVectorSlot slot); | 28 InlineCacheState LoadInlineCacheState(FeedbackVectorSlot slot); |
29 bool StoreIsUninitialized(FeedbackVectorSlot slot); | 29 bool StoreIsUninitialized(FeedbackVectorSlot slot); |
30 bool CallIsUninitialized(FeedbackVectorSlot slot); | 30 bool CallIsUninitialized(FeedbackVectorSlot slot); |
(...skipping 18 matching lines...) Expand all Loading... |
49 void AssignmentReceiverTypes(FeedbackVectorSlot slot, Handle<Name> name, | 49 void AssignmentReceiverTypes(FeedbackVectorSlot slot, Handle<Name> name, |
50 SmallMapList* receiver_types); | 50 SmallMapList* receiver_types); |
51 void KeyedAssignmentReceiverTypes(FeedbackVectorSlot slot, | 51 void KeyedAssignmentReceiverTypes(FeedbackVectorSlot slot, |
52 SmallMapList* receiver_types, | 52 SmallMapList* receiver_types, |
53 KeyedAccessStoreMode* store_mode, | 53 KeyedAccessStoreMode* store_mode, |
54 IcCheckType* key_type); | 54 IcCheckType* key_type); |
55 void CountReceiverTypes(FeedbackVectorSlot slot, | 55 void CountReceiverTypes(FeedbackVectorSlot slot, |
56 SmallMapList* receiver_types); | 56 SmallMapList* receiver_types); |
57 | 57 |
58 void CollectReceiverTypes(FeedbackVectorSlot slot, SmallMapList* types); | 58 void CollectReceiverTypes(FeedbackVectorSlot slot, SmallMapList* types); |
59 template <class T> | 59 void CollectReceiverTypes(FeedbackNexus* nexus, SmallMapList* types); |
60 void CollectReceiverTypes(T* obj, SmallMapList* types); | |
61 | 60 |
62 static bool IsRelevantFeedback(Map* map, Context* native_context) { | 61 static bool IsRelevantFeedback(Map* map, Context* native_context) { |
63 Object* constructor = map->GetConstructor(); | 62 Object* constructor = map->GetConstructor(); |
64 return !constructor->IsJSFunction() || | 63 return !constructor->IsJSFunction() || |
65 JSFunction::cast(constructor)->context()->native_context() == | 64 JSFunction::cast(constructor)->context()->native_context() == |
66 native_context; | 65 native_context; |
67 } | 66 } |
68 | 67 |
69 Handle<JSFunction> GetCallTarget(FeedbackVectorSlot slot); | 68 Handle<JSFunction> GetCallTarget(FeedbackVectorSlot slot); |
70 Handle<AllocationSite> GetCallAllocationSite(FeedbackVectorSlot slot); | 69 Handle<AllocationSite> GetCallAllocationSite(FeedbackVectorSlot slot); |
(...skipping 20 matching lines...) Expand all Loading... |
91 Type** combined); | 90 Type** combined); |
92 | 91 |
93 Type* CountType(TypeFeedbackId id); | 92 Type* CountType(TypeFeedbackId id); |
94 | 93 |
95 Zone* zone() const { return zone_; } | 94 Zone* zone() const { return zone_; } |
96 Isolate* isolate() const { return isolate_; } | 95 Isolate* isolate() const { return isolate_; } |
97 | 96 |
98 private: | 97 private: |
99 void CollectReceiverTypes(FeedbackVectorSlot slot, Handle<Name> name, | 98 void CollectReceiverTypes(FeedbackVectorSlot slot, Handle<Name> name, |
100 Code::Flags flags, SmallMapList* types); | 99 Code::Flags flags, SmallMapList* types); |
101 template <class T> | 100 void CollectReceiverTypes(FeedbackNexus* nexus, Handle<Name> name, |
102 void CollectReceiverTypes(T* obj, Handle<Name> name, Code::Flags flags, | 101 Code::Flags flags, SmallMapList* types); |
103 SmallMapList* types); | |
104 | 102 |
105 // Returns true if there is at least one string map and if | 103 // Returns true if there is at least one string map and if |
106 // all maps are string maps. | 104 // all maps are string maps. |
107 bool HasOnlyStringMaps(SmallMapList* receiver_types); | 105 bool HasOnlyStringMaps(SmallMapList* receiver_types); |
108 | 106 |
109 void SetInfo(TypeFeedbackId id, Object* target); | 107 void SetInfo(TypeFeedbackId id, Object* target); |
110 | 108 |
111 void BuildDictionary(Handle<Code> code); | 109 void BuildDictionary(Handle<Code> code); |
112 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); | 110 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); |
113 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); | 111 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); |
(...skipping 17 matching lines...) Expand all Loading... |
131 Handle<UnseededNumberDictionary> dictionary_; | 129 Handle<UnseededNumberDictionary> dictionary_; |
132 Handle<TypeFeedbackVector> feedback_vector_; | 130 Handle<TypeFeedbackVector> feedback_vector_; |
133 | 131 |
134 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 132 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
135 }; | 133 }; |
136 | 134 |
137 } // namespace internal | 135 } // namespace internal |
138 } // namespace v8 | 136 } // namespace v8 |
139 | 137 |
140 #endif // V8_TYPE_INFO_H_ | 138 #endif // V8_TYPE_INFO_H_ |
OLD | NEW |