| 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_IC_H_ | 5 #ifndef V8_IC_H_ |
| 6 #define V8_IC_H_ | 6 #define V8_IC_H_ |
| 7 | 7 |
| 8 #include "src/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/feedback-vector.h" | 9 #include "src/feedback-vector.h" |
| 10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
| 11 #include "src/macro-assembler.h" | 11 #include "src/macro-assembler.h" |
| 12 #include "src/messages.h" | 12 #include "src/messages.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 // | 17 // |
| 18 // IC is the base class for LoadIC, StoreIC, KeyedLoadIC, and KeyedStoreIC. | 18 // IC is the base class for LoadIC, StoreIC, KeyedLoadIC, and KeyedStoreIC. |
| 19 // | 19 // |
| 20 class IC { | 20 class IC { |
| 21 public: | 21 public: |
| 22 // Alias the inline cache state type to make the IC code more readable. | 22 // Alias the inline cache state type to make the IC code more readable. |
| 23 typedef InlineCacheState State; | 23 typedef InlineCacheState State; |
| 24 | 24 |
| 25 // The IC code is either invoked with no extra frames on the stack | 25 // The IC code is either invoked with no extra frames on the stack |
| 26 // or with a single extra frame for supporting calls. | 26 // or with a single extra frame for supporting calls. |
| 27 enum FrameDepth { NO_EXTRA_FRAME = 0, EXTRA_CALL_FRAME = 1 }; | 27 enum FrameDepth { NO_EXTRA_FRAME = 0, EXTRA_CALL_FRAME = 1 }; |
| 28 | 28 |
| 29 // A polymorphic IC can handle at most 4 distinct maps before transitioning |
| 30 // to megamorphic state. |
| 31 static constexpr int kMaxPolymorphicMapCount = 4; |
| 32 |
| 29 // Construct the IC structure with the given number of extra | 33 // Construct the IC structure with the given number of extra |
| 30 // JavaScript frames on the stack. | 34 // JavaScript frames on the stack. |
| 31 IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL); | 35 IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL); |
| 32 virtual ~IC() {} | 36 virtual ~IC() {} |
| 33 | 37 |
| 34 State state() const { return state_; } | 38 State state() const { return state_; } |
| 35 inline Address address() const; | 39 inline Address address() const; |
| 36 | 40 |
| 37 // Compute the current IC state based on the target stub, receiver and name. | 41 // Compute the current IC state based on the target stub, receiver and name. |
| 38 void UpdateState(Handle<Object> receiver, Handle<Object> name); | 42 void UpdateState(Handle<Object> receiver, Handle<Object> name); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 490 |
| 487 // Helper for BinaryOpIC and CompareIC. | 491 // Helper for BinaryOpIC and CompareIC. |
| 488 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 492 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 489 void PatchInlinedSmiCode(Isolate* isolate, Address address, | 493 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 490 InlinedSmiCheck check); | 494 InlinedSmiCheck check); |
| 491 | 495 |
| 492 } // namespace internal | 496 } // namespace internal |
| 493 } // namespace v8 | 497 } // namespace v8 |
| 494 | 498 |
| 495 #endif // V8_IC_H_ | 499 #endif // V8_IC_H_ |
| OLD | NEW |