Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/code-stubs.h

Issue 1722193002: [compiler] Drop the CompareNilIC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-factory.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 V(VectorKeyedStoreIC) \ 60 V(VectorKeyedStoreIC) \
61 /* HydrogenCodeStubs */ \ 61 /* HydrogenCodeStubs */ \
62 V(AllocateHeapNumber) \ 62 V(AllocateHeapNumber) \
63 V(AllocateMutableHeapNumber) \ 63 V(AllocateMutableHeapNumber) \
64 V(AllocateInNewSpace) \ 64 V(AllocateInNewSpace) \
65 V(ArrayNArgumentsConstructor) \ 65 V(ArrayNArgumentsConstructor) \
66 V(ArrayNoArgumentConstructor) \ 66 V(ArrayNoArgumentConstructor) \
67 V(ArraySingleArgumentConstructor) \ 67 V(ArraySingleArgumentConstructor) \
68 V(BinaryOpIC) \ 68 V(BinaryOpIC) \
69 V(BinaryOpWithAllocationSite) \ 69 V(BinaryOpWithAllocationSite) \
70 V(CompareNilIC) \
71 V(CreateAllocationSite) \ 70 V(CreateAllocationSite) \
72 V(CreateWeakCell) \ 71 V(CreateWeakCell) \
73 V(ElementsTransitionAndStore) \ 72 V(ElementsTransitionAndStore) \
74 V(FastCloneRegExp) \ 73 V(FastCloneRegExp) \
75 V(FastCloneShallowArray) \ 74 V(FastCloneShallowArray) \
76 V(FastCloneShallowObject) \ 75 V(FastCloneShallowObject) \
77 V(FastNewClosure) \ 76 V(FastNewClosure) \
78 V(FastNewContext) \ 77 V(FastNewContext) \
79 V(FastNewObject) \ 78 V(FastNewObject) \
80 V(FastNewRestParameter) \ 79 V(FastNewRestParameter) \
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 class RightStateBits : public BitField<CompareICState::State, 7, 4> {}; 1693 class RightStateBits : public BitField<CompareICState::State, 7, 4> {};
1695 class StateBits : public BitField<CompareICState::State, 11, 4> {}; 1694 class StateBits : public BitField<CompareICState::State, 11, 4> {};
1696 1695
1697 Handle<Map> known_map_; 1696 Handle<Map> known_map_;
1698 1697
1699 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); 1698 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp);
1700 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); 1699 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub);
1701 }; 1700 };
1702 1701
1703 1702
1704 class CompareNilICStub : public HydrogenCodeStub {
1705 public:
1706 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
1707 Type* GetInputType(Zone* zone, Handle<Map> map);
1708
1709 CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) {
1710 set_sub_minor_key(NilValueBits::encode(nil));
1711 }
1712
1713 CompareNilICStub(Isolate* isolate, ExtraICState ic_state,
1714 InitializationState init_state = INITIALIZED)
1715 : HydrogenCodeStub(isolate, init_state) {
1716 set_sub_minor_key(ic_state);
1717 }
1718
1719 static Handle<Code> GetUninitialized(Isolate* isolate,
1720 NilValue nil) {
1721 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode();
1722 }
1723
1724 InlineCacheState GetICState() const override {
1725 State state = this->state();
1726 if (state.Contains(GENERIC)) {
1727 return MEGAMORPHIC;
1728 } else if (state.Contains(MONOMORPHIC_MAP)) {
1729 return MONOMORPHIC;
1730 } else {
1731 return PREMONOMORPHIC;
1732 }
1733 }
1734
1735 Code::Kind GetCodeKind() const override { return Code::COMPARE_NIL_IC; }
1736
1737 ExtraICState GetExtraICState() const override { return sub_minor_key(); }
1738
1739 void UpdateStatus(Handle<Object> object);
1740
1741 bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); }
1742
1743 NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); }
1744
1745 void ClearState() {
1746 set_sub_minor_key(TypesBits::update(sub_minor_key(), 0));
1747 }
1748
1749 void PrintState(std::ostream& os) const override; // NOLINT
1750 void PrintBaseName(std::ostream& os) const override; // NOLINT
1751
1752 private:
1753 CompareNilICStub(Isolate* isolate, NilValue nil,
1754 InitializationState init_state)
1755 : HydrogenCodeStub(isolate, init_state) {
1756 set_sub_minor_key(NilValueBits::encode(nil));
1757 }
1758
1759 enum CompareNilType {
1760 UNDEFINED,
1761 NULL_TYPE,
1762 MONOMORPHIC_MAP,
1763 GENERIC,
1764 NUMBER_OF_TYPES
1765 };
1766
1767 // At most 6 different types can be distinguished, because the Code object
1768 // only has room for a single byte to hold a set and there are two more
1769 // boolean flags we need to store. :-P
1770 STATIC_ASSERT(NUMBER_OF_TYPES <= 6);
1771
1772 class State : public EnumSet<CompareNilType, byte> {
1773 public:
1774 State() : EnumSet<CompareNilType, byte>(0) { }
1775 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { }
1776 };
1777 friend std::ostream& operator<<(std::ostream& os, const State& s);
1778
1779 State state() const { return State(TypesBits::decode(sub_minor_key())); }
1780
1781 class NilValueBits : public BitField<NilValue, 0, 1> {};
1782 class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {};
1783
1784 friend class CompareNilIC;
1785
1786 DEFINE_CALL_INTERFACE_DESCRIPTOR(CompareNil);
1787 DEFINE_HYDROGEN_CODE_STUB(CompareNilIC, HydrogenCodeStub);
1788 };
1789
1790
1791 std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s);
1792
1793
1794 class CEntryStub : public PlatformCodeStub { 1703 class CEntryStub : public PlatformCodeStub {
1795 public: 1704 public:
1796 CEntryStub(Isolate* isolate, int result_size, 1705 CEntryStub(Isolate* isolate, int result_size,
1797 SaveFPRegsMode save_doubles = kDontSaveFPRegs, 1706 SaveFPRegsMode save_doubles = kDontSaveFPRegs,
1798 ArgvMode argv_mode = kArgvOnStack) 1707 ArgvMode argv_mode = kArgvOnStack)
1799 : PlatformCodeStub(isolate) { 1708 : PlatformCodeStub(isolate) {
1800 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs) | 1709 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs) |
1801 ArgvMode::encode(argv_mode == kArgvInRegister); 1710 ArgvMode::encode(argv_mode == kArgvInRegister);
1802 DCHECK(result_size == 1 || result_size == 2 || result_size == 3); 1711 DCHECK(result_size == 1 || result_size == 2 || result_size == 3);
1803 minor_key_ = ResultSizeBits::update(minor_key_, result_size); 1712 minor_key_ = ResultSizeBits::update(minor_key_, result_size);
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 #undef DEFINE_HYDROGEN_CODE_STUB 2875 #undef DEFINE_HYDROGEN_CODE_STUB
2967 #undef DEFINE_CODE_STUB 2876 #undef DEFINE_CODE_STUB
2968 #undef DEFINE_CODE_STUB_BASE 2877 #undef DEFINE_CODE_STUB_BASE
2969 2878
2970 extern Representation RepresentationFromType(Type* type); 2879 extern Representation RepresentationFromType(Type* type);
2971 2880
2972 } // namespace internal 2881 } // namespace internal
2973 } // namespace v8 2882 } // namespace v8
2974 2883
2975 #endif // V8_CODE_STUBS_H_ 2884 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/code-factory.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698