| 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/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" |
| 9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; | 70 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; |
| 71 } | 71 } |
| 72 | 72 |
| 73 static bool IsCleared(FeedbackNexus* nexus) { | 73 static bool IsCleared(FeedbackNexus* nexus) { |
| 74 InlineCacheState state = nexus->StateFromFeedback(); | 74 InlineCacheState state = nexus->StateFromFeedback(); |
| 75 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; | 75 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; |
| 76 } | 76 } |
| 77 | 77 |
| 78 static bool ICUseVector(Code::Kind kind) { | 78 static bool ICUseVector(Code::Kind kind) { |
| 79 return kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC || | 79 return kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC || |
| 80 kind == Code::CALL_IC || | 80 kind == Code::CALL_IC || kind == Code::STORE_IC || |
| 81 (FLAG_vector_stores && | 81 kind == Code::KEYED_STORE_IC; |
| 82 (kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC)); | |
| 83 } | 82 } |
| 84 | 83 |
| 85 protected: | 84 protected: |
| 86 // Get the call-site target; used for determining the state. | 85 // Get the call-site target; used for determining the state. |
| 87 Handle<Code> target() const { return target_; } | 86 Handle<Code> target() const { return target_; } |
| 88 | 87 |
| 89 Address fp() const { return fp_; } | 88 Address fp() const { return fp_; } |
| 90 Address pc() const { return *pc_address_; } | 89 Address pc() const { return *pc_address_; } |
| 91 Isolate* isolate() const { return isolate_; } | 90 Isolate* isolate() const { return isolate_; } |
| 92 | 91 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 524 |
| 526 class IcCheckTypeField : public BitField<IcCheckType, 6, 1> {}; | 525 class IcCheckTypeField : public BitField<IcCheckType, 6, 1> {}; |
| 527 | 526 |
| 528 static ExtraICState ComputeExtraICState(LanguageMode flag, | 527 static ExtraICState ComputeExtraICState(LanguageMode flag, |
| 529 KeyedAccessStoreMode mode) { | 528 KeyedAccessStoreMode mode) { |
| 530 return StoreICState(flag).GetExtraICState() | | 529 return StoreICState(flag).GetExtraICState() | |
| 531 ExtraICStateKeyedAccessStoreMode::encode(mode) | | 530 ExtraICStateKeyedAccessStoreMode::encode(mode) | |
| 532 IcCheckTypeField::encode(ELEMENT); | 531 IcCheckTypeField::encode(ELEMENT); |
| 533 } | 532 } |
| 534 | 533 |
| 535 static KeyedAccessStoreMode GetKeyedAccessStoreMode( | |
| 536 ExtraICState extra_state) { | |
| 537 DCHECK(!FLAG_vector_stores); | |
| 538 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); | |
| 539 } | |
| 540 | |
| 541 KeyedAccessStoreMode GetKeyedAccessStoreMode() { | 534 KeyedAccessStoreMode GetKeyedAccessStoreMode() { |
| 542 DCHECK(FLAG_vector_stores); | |
| 543 return casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode(); | 535 return casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode(); |
| 544 } | 536 } |
| 545 | 537 |
| 546 static IcCheckType GetKeyType(ExtraICState extra_state) { | |
| 547 DCHECK(!FLAG_vector_stores); | |
| 548 return IcCheckTypeField::decode(extra_state); | |
| 549 } | |
| 550 | |
| 551 KeyedStoreIC(FrameDepth depth, Isolate* isolate, | 538 KeyedStoreIC(FrameDepth depth, Isolate* isolate, |
| 552 KeyedStoreICNexus* nexus = NULL) | 539 KeyedStoreICNexus* nexus = NULL) |
| 553 : StoreIC(depth, isolate, nexus) { | 540 : StoreIC(depth, isolate, nexus) { |
| 554 DCHECK(target()->is_keyed_store_stub()); | 541 DCHECK(target()->is_keyed_store_stub()); |
| 555 } | 542 } |
| 556 | 543 |
| 557 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, | 544 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, |
| 558 Handle<Object> name, | 545 Handle<Object> name, |
| 559 Handle<Object> value); | 546 Handle<Object> value); |
| 560 | 547 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 584 |
| 598 private: | 585 private: |
| 599 inline void set_target(Code* code); | 586 inline void set_target(Code* code); |
| 600 | 587 |
| 601 static void Clear(Isolate* isolate, Address address, Code* target, | 588 static void Clear(Isolate* isolate, Address address, Code* target, |
| 602 Address constant_pool); | 589 Address constant_pool); |
| 603 | 590 |
| 604 Handle<Map> ComputeTransitionedMap(Handle<Map> map, | 591 Handle<Map> ComputeTransitionedMap(Handle<Map> map, |
| 605 KeyedAccessStoreMode store_mode); | 592 KeyedAccessStoreMode store_mode); |
| 606 | 593 |
| 607 void ValidateStoreMode(Handle<Code> stub); | |
| 608 | |
| 609 friend class IC; | 594 friend class IC; |
| 610 }; | 595 }; |
| 611 | 596 |
| 612 | 597 |
| 613 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. | 598 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. |
| 614 class BinaryOpIC : public IC { | 599 class BinaryOpIC : public IC { |
| 615 public: | 600 public: |
| 616 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} | 601 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} |
| 617 | 602 |
| 618 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, | 603 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 663 |
| 679 | 664 |
| 680 // Helper for BinaryOpIC and CompareIC. | 665 // Helper for BinaryOpIC and CompareIC. |
| 681 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 666 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 682 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 667 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
| 683 | 668 |
| 684 } // namespace internal | 669 } // namespace internal |
| 685 } // namespace v8 | 670 } // namespace v8 |
| 686 | 671 |
| 687 #endif // V8_IC_H_ | 672 #endif // V8_IC_H_ |
| OLD | NEW |