| 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/base/logging.h" | 10 #include "src/base/logging.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 virtual bool FindHandlers(CodeHandleList* code_list, int length = -1) const; | 368 virtual bool FindHandlers(CodeHandleList* code_list, int length = -1) const; |
| 369 virtual Name* FindFirstName() const { return NULL; } | 369 virtual Name* FindFirstName() const { return NULL; } |
| 370 | 370 |
| 371 virtual void ConfigureUninitialized(); | 371 virtual void ConfigureUninitialized(); |
| 372 virtual void ConfigurePremonomorphic(); | 372 virtual void ConfigurePremonomorphic(); |
| 373 virtual void ConfigureMegamorphic(); | 373 virtual void ConfigureMegamorphic(); |
| 374 | 374 |
| 375 inline Object* GetFeedback() const; | 375 inline Object* GetFeedback() const; |
| 376 inline Object* GetFeedbackExtra() const; | 376 inline Object* GetFeedbackExtra() const; |
| 377 | 377 |
| 378 protected: | |
| 379 inline Isolate* GetIsolate() const; | 378 inline Isolate* GetIsolate() const; |
| 380 | 379 |
| 380 protected: |
| 381 inline void SetFeedback(Object* feedback, | 381 inline void SetFeedback(Object* feedback, |
| 382 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 382 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 383 inline void SetFeedbackExtra(Object* feedback_extra, | 383 inline void SetFeedbackExtra(Object* feedback_extra, |
| 384 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 384 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 385 | 385 |
| 386 Handle<FixedArray> EnsureArrayOfSize(int length); | 386 Handle<FixedArray> EnsureArrayOfSize(int length); |
| 387 Handle<FixedArray> EnsureExtraArrayOfSize(int length); | 387 Handle<FixedArray> EnsureExtraArrayOfSize(int length); |
| 388 void InstallHandlers(Handle<FixedArray> array, MapHandleList* maps, | 388 void InstallHandlers(Handle<FixedArray> array, MapHandleList* maps, |
| 389 CodeHandleList* handlers); | 389 CodeHandleList* handlers); |
| 390 | 390 |
| 391 private: | 391 private: |
| 392 // The reason for having a vector handle and a raw pointer is that we can and | 392 // The reason for having a vector handle and a raw pointer is that we can and |
| 393 // should use handles during IC miss, but not during GC when we clear ICs. If | 393 // should use handles during IC miss, but not during GC when we clear ICs. If |
| 394 // you have a handle to the vector that is better because more operations can | 394 // you have a handle to the vector that is better because more operations can |
| 395 // be done, like allocation. | 395 // be done, like allocation. |
| 396 Handle<TypeFeedbackVector> vector_handle_; | 396 Handle<TypeFeedbackVector> vector_handle_; |
| 397 TypeFeedbackVector* vector_; | 397 TypeFeedbackVector* vector_; |
| 398 FeedbackVectorSlot slot_; | 398 FeedbackVectorSlot slot_; |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 | 401 |
| 402 class CallICNexus : public FeedbackNexus { | 402 class CallICNexus final : public FeedbackNexus { |
| 403 public: | 403 public: |
| 404 // Monomorphic call ics store call counts. Platform code needs to increment | 404 // Monomorphic call ics store call counts. Platform code needs to increment |
| 405 // the count appropriately (ie, by 2). | 405 // the count appropriately (ie, by 2). |
| 406 static const int kCallCountIncrement = 2; | 406 static const int kCallCountIncrement = 2; |
| 407 | 407 |
| 408 CallICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot) | 408 CallICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot) |
| 409 : FeedbackNexus(vector, slot) { | 409 : FeedbackNexus(vector, slot) { |
| 410 DCHECK_EQ(FeedbackVectorSlotKind::CALL_IC, vector->GetKind(slot)); | 410 DCHECK_EQ(FeedbackVectorSlotKind::CALL_IC, vector->GetKind(slot)); |
| 411 } | 411 } |
| 412 CallICNexus(TypeFeedbackVector* vector, FeedbackVectorSlot slot) | 412 CallICNexus(TypeFeedbackVector* vector, FeedbackVectorSlot slot) |
| 413 : FeedbackNexus(vector, slot) { | 413 : FeedbackNexus(vector, slot) { |
| 414 DCHECK_EQ(FeedbackVectorSlotKind::CALL_IC, vector->GetKind(slot)); | 414 DCHECK_EQ(FeedbackVectorSlotKind::CALL_IC, vector->GetKind(slot)); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void Clear(Code* host); | 417 void Clear(Code* host); |
| 418 | 418 |
| 419 void ConfigureMonomorphicArray(); | 419 void ConfigureMonomorphicArray(); |
| 420 void ConfigureMonomorphic(Handle<JSFunction> function); | 420 void ConfigureMonomorphic(Handle<JSFunction> function); |
| 421 void ConfigureMegamorphic() final; |
| 422 void ConfigureMegamorphic(int call_count); |
| 421 | 423 |
| 422 InlineCacheState StateFromFeedback() const override; | 424 InlineCacheState StateFromFeedback() const final; |
| 423 | 425 |
| 424 int ExtractMaps(MapHandleList* maps) const override { | 426 int ExtractMaps(MapHandleList* maps) const final { |
| 425 // CallICs don't record map feedback. | 427 // CallICs don't record map feedback. |
| 426 return 0; | 428 return 0; |
| 427 } | 429 } |
| 428 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const override { | 430 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const final { |
| 429 return MaybeHandle<Code>(); | 431 return MaybeHandle<Code>(); |
| 430 } | 432 } |
| 431 bool FindHandlers(CodeHandleList* code_list, int length = -1) const override { | 433 bool FindHandlers(CodeHandleList* code_list, int length = -1) const final { |
| 432 return length == 0; | 434 return length == 0; |
| 433 } | 435 } |
| 434 | 436 |
| 435 int ExtractCallCount(); | 437 int ExtractCallCount(); |
| 436 }; | 438 }; |
| 437 | 439 |
| 438 | 440 |
| 439 class LoadICNexus : public FeedbackNexus { | 441 class LoadICNexus : public FeedbackNexus { |
| 440 public: | 442 public: |
| 441 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot) | 443 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 KeyedAccessStoreMode GetKeyedAccessStoreMode() const; | 543 KeyedAccessStoreMode GetKeyedAccessStoreMode() const; |
| 542 IcCheckType GetKeyType() const; | 544 IcCheckType GetKeyType() const; |
| 543 | 545 |
| 544 InlineCacheState StateFromFeedback() const override; | 546 InlineCacheState StateFromFeedback() const override; |
| 545 Name* FindFirstName() const override; | 547 Name* FindFirstName() const override; |
| 546 }; | 548 }; |
| 547 } // namespace internal | 549 } // namespace internal |
| 548 } // namespace v8 | 550 } // namespace v8 |
| 549 | 551 |
| 550 #endif // V8_TRANSITIONS_H_ | 552 #endif // V8_TRANSITIONS_H_ |
| OLD | NEW |