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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/checks.h" | 10 #include "src/checks.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 DCHECK(vector->GetKind(slot) == Code::CALL_IC); | 285 DCHECK(vector->GetKind(slot) == Code::CALL_IC); |
286 } | 286 } |
287 | 287 |
288 void Clear(Code* host); | 288 void Clear(Code* host); |
289 | 289 |
290 void ConfigureUninitialized(); | 290 void ConfigureUninitialized(); |
291 void ConfigureGeneric(); | 291 void ConfigureGeneric(); |
292 void ConfigureMonomorphicArray(); | 292 void ConfigureMonomorphicArray(); |
293 void ConfigureMonomorphic(Handle<JSFunction> function); | 293 void ConfigureMonomorphic(Handle<JSFunction> function); |
294 | 294 |
295 virtual InlineCacheState StateFromFeedback() const OVERRIDE; | 295 InlineCacheState StateFromFeedback() const OVERRIDE; |
296 | 296 |
297 virtual int ExtractMaps(MapHandleList* maps) const OVERRIDE { | 297 int ExtractMaps(MapHandleList* maps) const OVERRIDE { |
298 // CallICs don't record map feedback. | 298 // CallICs don't record map feedback. |
299 return 0; | 299 return 0; |
300 } | 300 } |
301 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE { | 301 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE { |
302 return MaybeHandle<Code>(); | 302 return MaybeHandle<Code>(); |
303 } | 303 } |
304 virtual bool FindHandlers(CodeHandleList* code_list, | 304 virtual bool FindHandlers(CodeHandleList* code_list, |
305 int length = -1) const OVERRIDE { | 305 int length = -1) const OVERRIDE { |
306 return length == 0; | 306 return length == 0; |
307 } | 307 } |
308 }; | 308 }; |
309 | 309 |
310 | 310 |
311 class LoadICNexus : public FeedbackNexus { | 311 class LoadICNexus : public FeedbackNexus { |
312 public: | 312 public: |
313 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) | 313 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
314 : FeedbackNexus(vector, slot) { | 314 : FeedbackNexus(vector, slot) { |
315 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); | 315 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); |
316 } | 316 } |
317 LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) | 317 LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) |
318 : FeedbackNexus(vector, slot) { | 318 : FeedbackNexus(vector, slot) { |
319 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); | 319 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); |
320 } | 320 } |
321 | 321 |
322 void Clear(Code* host); | 322 void Clear(Code* host); |
323 | 323 |
324 void ConfigureMegamorphic(); | 324 void ConfigureMegamorphic(); |
325 void ConfigurePremonomorphic(); | 325 void ConfigurePremonomorphic(); |
326 void ConfigureMonomorphic(Handle<HeapType> type, Handle<Code> handler); | 326 void ConfigureMonomorphic(Handle<HeapType> type, Handle<Code> handler); |
327 | 327 |
328 void ConfigurePolymorphic(TypeHandleList* types, CodeHandleList* handlers); | 328 void ConfigurePolymorphic(TypeHandleList* types, CodeHandleList* handlers); |
329 | 329 |
330 virtual InlineCacheState StateFromFeedback() const OVERRIDE; | 330 InlineCacheState StateFromFeedback() const OVERRIDE; |
331 virtual int ExtractMaps(MapHandleList* maps) const OVERRIDE; | 331 int ExtractMaps(MapHandleList* maps) const OVERRIDE; |
332 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; | 332 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; |
333 virtual bool FindHandlers(CodeHandleList* code_list, | 333 virtual bool FindHandlers(CodeHandleList* code_list, |
334 int length = -1) const OVERRIDE; | 334 int length = -1) const OVERRIDE; |
335 }; | 335 }; |
336 | 336 |
337 | 337 |
338 class KeyedLoadICNexus : public FeedbackNexus { | 338 class KeyedLoadICNexus : public FeedbackNexus { |
339 public: | 339 public: |
340 KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) | 340 KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
341 : FeedbackNexus(vector, slot) { | 341 : FeedbackNexus(vector, slot) { |
342 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); | 342 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); |
343 } | 343 } |
344 KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) | 344 KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) |
345 : FeedbackNexus(vector, slot) { | 345 : FeedbackNexus(vector, slot) { |
346 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); | 346 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); |
347 } | 347 } |
348 | 348 |
349 void Clear(Code* host); | 349 void Clear(Code* host); |
350 | 350 |
351 void ConfigureMegamorphic(); | 351 void ConfigureMegamorphic(); |
352 void ConfigureGeneric(); | 352 void ConfigureGeneric(); |
353 void ConfigurePremonomorphic(); | 353 void ConfigurePremonomorphic(); |
354 // name can be a null handle for element loads. | 354 // name can be a null handle for element loads. |
355 void ConfigureMonomorphic(Handle<Name> name, Handle<HeapType> type, | 355 void ConfigureMonomorphic(Handle<Name> name, Handle<HeapType> type, |
356 Handle<Code> handler); | 356 Handle<Code> handler); |
357 // name can be null. | 357 // name can be null. |
358 void ConfigurePolymorphic(Handle<Name> name, TypeHandleList* types, | 358 void ConfigurePolymorphic(Handle<Name> name, TypeHandleList* types, |
359 CodeHandleList* handlers); | 359 CodeHandleList* handlers); |
360 | 360 |
361 virtual InlineCacheState StateFromFeedback() const OVERRIDE; | 361 InlineCacheState StateFromFeedback() const OVERRIDE; |
362 virtual int ExtractMaps(MapHandleList* maps) const OVERRIDE; | 362 int ExtractMaps(MapHandleList* maps) const OVERRIDE; |
363 virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; | 363 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; |
364 virtual bool FindHandlers(CodeHandleList* code_list, | 364 virtual bool FindHandlers(CodeHandleList* code_list, |
365 int length = -1) const OVERRIDE; | 365 int length = -1) const OVERRIDE; |
366 virtual Name* FindFirstName() const OVERRIDE; | 366 Name* FindFirstName() const OVERRIDE; |
367 }; | 367 }; |
368 } | 368 } |
369 } // namespace v8::internal | 369 } // namespace v8::internal |
370 | 370 |
371 #endif // V8_TRANSITIONS_H_ | 371 #endif // V8_TRANSITIONS_H_ |
OLD | NEW |