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_TYPE_FEEDBACK_VECTOR_H_ | 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_ |
6 #define V8_TYPE_FEEDBACK_VECTOR_H_ | 6 #define V8_TYPE_FEEDBACK_VECTOR_H_ |
7 | 7 |
8 #include "src/checks.h" | 8 #include "src/checks.h" |
9 #include "src/elements-kind.h" | 9 #include "src/elements-kind.h" |
10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 FeedbackVectorICSlot slot() const { return slot_; } | 195 FeedbackVectorICSlot slot() const { return slot_; } |
196 | 196 |
197 InlineCacheState ic_state() const { return StateFromFeedback(); } | 197 InlineCacheState ic_state() const { return StateFromFeedback(); } |
198 Map* FindFirstMap() const { | 198 Map* FindFirstMap() const { |
199 MapHandleList maps; | 199 MapHandleList maps; |
200 ExtractMaps(&maps); | 200 ExtractMaps(&maps); |
201 if (maps.length() > 0) return *maps.at(0); | 201 if (maps.length() > 0) return *maps.at(0); |
202 return NULL; | 202 return NULL; |
203 } | 203 } |
204 | 204 |
| 205 // TODO(mvstanton): remove FindAllMaps, it didn't survive a code review. |
| 206 void FindAllMaps(MapHandleList* maps) const { ExtractMaps(maps); } |
| 207 |
205 virtual InlineCacheState StateFromFeedback() const = 0; | 208 virtual InlineCacheState StateFromFeedback() const = 0; |
206 virtual int ExtractMaps(MapHandleList* maps) const = 0; | 209 virtual int ExtractMaps(MapHandleList* maps) const = 0; |
207 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const = 0; | 210 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const = 0; |
208 virtual bool FindHandlers(CodeHandleList* code_list, int length = -1) const { | 211 virtual bool FindHandlers(CodeHandleList* code_list, int length = -1) const { |
209 return length == 0; | 212 return length == 0; |
210 } | 213 } |
211 virtual Name* FindFirstName() const { return NULL; } | 214 virtual Name* FindFirstName() const { return NULL; } |
212 | 215 |
213 Object* GetFeedback() const { return vector()->Get(slot()); } | 216 Object* GetFeedback() const { return vector()->Get(slot()); } |
214 | 217 |
(...skipping 28 matching lines...) Expand all Loading... |
243 public: | 246 public: |
244 CallICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) | 247 CallICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
245 : FeedbackNexus(vector, slot) { | 248 : FeedbackNexus(vector, slot) { |
246 DCHECK(vector->GetKind(slot) == Code::CALL_IC); | 249 DCHECK(vector->GetKind(slot) == Code::CALL_IC); |
247 } | 250 } |
248 CallICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) | 251 CallICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) |
249 : FeedbackNexus(vector, slot) { | 252 : FeedbackNexus(vector, slot) { |
250 DCHECK(vector->GetKind(slot) == Code::CALL_IC); | 253 DCHECK(vector->GetKind(slot) == Code::CALL_IC); |
251 } | 254 } |
252 | 255 |
| 256 void Clear(Code* host); |
| 257 |
253 void ConfigureUninitialized(); | 258 void ConfigureUninitialized(); |
254 void ConfigureGeneric(); | 259 void ConfigureGeneric(); |
255 void ConfigureMonomorphicArray(); | 260 void ConfigureMonomorphicArray(); |
256 void ConfigureMonomorphic(Handle<JSFunction> function); | 261 void ConfigureMonomorphic(Handle<JSFunction> function); |
257 | 262 |
258 virtual InlineCacheState StateFromFeedback() const OVERRIDE; | 263 virtual InlineCacheState StateFromFeedback() const OVERRIDE; |
259 | 264 |
260 virtual int ExtractMaps(MapHandleList* maps) const OVERRIDE { | 265 virtual int ExtractMaps(MapHandleList* maps) const OVERRIDE { |
261 // CallICs don't record map feedback. | 266 // CallICs don't record map feedback. |
262 return 0; | 267 return 0; |
263 } | 268 } |
264 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE { | 269 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE { |
265 return MaybeHandle<Code>(); | 270 return MaybeHandle<Code>(); |
266 } | 271 } |
267 virtual bool FindHandlers(CodeHandleList* code_list, | 272 virtual bool FindHandlers(CodeHandleList* code_list, |
268 int length = -1) const OVERRIDE { | 273 int length = -1) const OVERRIDE { |
269 return length == 0; | 274 return length == 0; |
270 } | 275 } |
271 }; | 276 }; |
| 277 |
| 278 |
| 279 class LoadICNexus : public FeedbackNexus { |
| 280 public: |
| 281 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
| 282 : FeedbackNexus(vector, slot) { |
| 283 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); |
| 284 } |
| 285 LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) |
| 286 : FeedbackNexus(vector, slot) { |
| 287 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); |
| 288 } |
| 289 |
| 290 void Clear(Code* host); |
| 291 |
| 292 void ConfigureMegamorphic(); |
| 293 void ConfigurePremonomorphic(); |
| 294 void ConfigureMonomorphic(Handle<HeapType> type, Handle<Code> handler); |
| 295 |
| 296 void ConfigurePolymorphic(TypeHandleList* types, CodeHandleList* handlers); |
| 297 |
| 298 virtual InlineCacheState StateFromFeedback() const OVERRIDE; |
| 299 virtual int ExtractMaps(MapHandleList* maps) const OVERRIDE; |
| 300 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; |
| 301 virtual bool FindHandlers(CodeHandleList* code_list, |
| 302 int length = -1) const OVERRIDE; |
| 303 }; |
| 304 |
| 305 |
| 306 class KeyedLoadICNexus : public FeedbackNexus { |
| 307 public: |
| 308 KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
| 309 : FeedbackNexus(vector, slot) { |
| 310 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); |
| 311 } |
| 312 KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) |
| 313 : FeedbackNexus(vector, slot) { |
| 314 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); |
| 315 } |
| 316 |
| 317 void Clear(Code* host); |
| 318 |
| 319 void ConfigureMegamorphic(); |
| 320 void ConfigureGeneric(); |
| 321 void ConfigurePremonomorphic(); |
| 322 // name can be a null handle for element loads. |
| 323 void ConfigureMonomorphic(Handle<Name> name, Handle<HeapType> type, |
| 324 Handle<Code> handler); |
| 325 // name can be null. |
| 326 void ConfigurePolymorphic(Handle<Name> name, TypeHandleList* types, |
| 327 CodeHandleList* handlers); |
| 328 |
| 329 virtual InlineCacheState StateFromFeedback() const OVERRIDE; |
| 330 virtual int ExtractMaps(MapHandleList* maps) const OVERRIDE; |
| 331 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; |
| 332 virtual bool FindHandlers(CodeHandleList* code_list, |
| 333 int length = -1) const OVERRIDE; |
| 334 virtual Name* FindFirstName() const OVERRIDE; |
| 335 }; |
272 } | 336 } |
273 } // namespace v8::internal | 337 } // namespace v8::internal |
274 | 338 |
275 #endif // V8_TRANSITIONS_H_ | 339 #endif // V8_TRANSITIONS_H_ |
OLD | NEW |