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

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

Issue 2647493002: [ic] Clean up handler boilerplate (Closed)
Patch Set: rebased Created 3 years, 11 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 V(InternalArrayNoArgumentConstructor) \ 95 V(InternalArrayNoArgumentConstructor) \
96 V(InternalArraySingleArgumentConstructor) \ 96 V(InternalArraySingleArgumentConstructor) \
97 V(ElementsTransitionAndStore) \ 97 V(ElementsTransitionAndStore) \
98 V(KeyedLoadSloppyArguments) \ 98 V(KeyedLoadSloppyArguments) \
99 V(KeyedStoreSloppyArguments) \ 99 V(KeyedStoreSloppyArguments) \
100 V(LoadScriptContextField) \ 100 V(LoadScriptContextField) \
101 V(StoreScriptContextField) \ 101 V(StoreScriptContextField) \
102 V(NumberToString) \ 102 V(NumberToString) \
103 V(StringAdd) \ 103 V(StringAdd) \
104 V(GetProperty) \ 104 V(GetProperty) \
105 V(LoadICProtoArray) \
106 V(StoreFastElement) \ 105 V(StoreFastElement) \
107 V(StoreGlobal) \ 106 V(StoreGlobal) \
108 V(StoreInterceptor) \ 107 V(StoreInterceptor) \
109 V(LoadApiGetter) \ 108 V(LoadApiGetter) \
110 V(LoadIndexedInterceptor) \ 109 V(LoadIndexedInterceptor) \
111 V(LoadField) \
112 V(GrowArrayElements) 110 V(GrowArrayElements)
113 111
114 // List of code stubs only used on ARM 32 bits platforms. 112 // List of code stubs only used on ARM 32 bits platforms.
115 #if V8_TARGET_ARCH_ARM 113 #if V8_TARGET_ARCH_ARM
116 #define CODE_STUB_LIST_ARM(V) V(DirectCEntry) 114 #define CODE_STUB_LIST_ARM(V) V(DirectCEntry)
117 115
118 #else 116 #else
119 #define CODE_STUB_LIST_ARM(V) 117 #define CODE_STUB_LIST_ARM(V)
120 #endif 118 #endif
121 119
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 explicit LoadIndexedStringStub(Isolate* isolate) 970 explicit LoadIndexedStringStub(Isolate* isolate)
973 : PlatformCodeStub(isolate) {} 971 : PlatformCodeStub(isolate) {}
974 972
975 Code::Kind GetCodeKind() const override { return Code::HANDLER; } 973 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
976 ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; } 974 ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; }
977 975
978 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); 976 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
979 DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub); 977 DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub);
980 }; 978 };
981 979
982
983 class HandlerStub : public HydrogenCodeStub {
984 public:
985 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
986 ExtraICState GetExtraICState() const override { return kind(); }
987
988 void InitializeDescriptor(CodeStubDescriptor* descriptor) override;
989
990 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
991
992 protected:
993 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
994
995 virtual Code::Kind kind() const = 0;
996
997 DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub);
998 };
999
1000 class LoadFieldStub : public TurboFanCodeStub {
1001 public:
1002 explicit LoadFieldStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
1003
1004 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
1005 ExtraICState GetExtraICState() const override { return GetCodeKind(); }
1006
1007 private:
1008 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadField);
1009 DEFINE_TURBOFAN_CODE_STUB(LoadField, TurboFanCodeStub);
1010 };
1011
1012 class KeyedLoadSloppyArgumentsStub : public TurboFanCodeStub { 980 class KeyedLoadSloppyArgumentsStub : public TurboFanCodeStub {
1013 public: 981 public:
1014 explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate) 982 explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate)
1015 : TurboFanCodeStub(isolate) {} 983 : TurboFanCodeStub(isolate) {}
1016 984
1017 Code::Kind GetCodeKind() const override { return Code::HANDLER; } 985 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
1018 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } 986 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
1019 987
1020 protected: 988 protected:
1021 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); 989 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 1610
1643 protected: 1611 protected:
1644 CallICState state() const { 1612 CallICState state() const {
1645 return CallICState(static_cast<ExtraICState>(minor_key_)); 1613 return CallICState(static_cast<ExtraICState>(minor_key_));
1646 } 1614 }
1647 1615
1648 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); 1616 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback);
1649 DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub); 1617 DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub);
1650 }; 1618 };
1651 1619
1652 class LoadICProtoArrayStub : public TurboFanCodeStub {
1653 public:
1654 explicit LoadICProtoArrayStub(Isolate* isolate,
1655 bool throw_reference_error_if_nonexistent)
1656 : TurboFanCodeStub(isolate) {
1657 minor_key_ = ThrowReferenceErrorIfNonexistentBits::encode(
1658 throw_reference_error_if_nonexistent);
1659 }
1660
1661 bool throw_reference_error_if_nonexistent() const {
1662 return ThrowReferenceErrorIfNonexistentBits::decode(minor_key_);
1663 }
1664
1665 ExtraICState GetExtraICState() const final {
1666 return static_cast<ExtraICState>(minor_key_);
1667 }
1668
1669 private:
1670 class ThrowReferenceErrorIfNonexistentBits : public BitField<bool, 0, 1> {};
1671
1672 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadICProtoArray);
1673 DEFINE_TURBOFAN_CODE_STUB(LoadICProtoArray, TurboFanCodeStub);
1674 };
1675
1676 class DoubleToIStub : public PlatformCodeStub { 1620 class DoubleToIStub : public PlatformCodeStub {
1677 public: 1621 public:
1678 DoubleToIStub(Isolate* isolate, Register source, Register destination, 1622 DoubleToIStub(Isolate* isolate, Register source, Register destination,
1679 int offset, bool is_truncating, bool skip_fastpath = false) 1623 int offset, bool is_truncating, bool skip_fastpath = false)
1680 : PlatformCodeStub(isolate) { 1624 : PlatformCodeStub(isolate) {
1681 minor_key_ = SourceRegisterBits::encode(source.code()) | 1625 minor_key_ = SourceRegisterBits::encode(source.code()) |
1682 DestinationRegisterBits::encode(destination.code()) | 1626 DestinationRegisterBits::encode(destination.code()) |
1683 OffsetBits::encode(offset) | 1627 OffsetBits::encode(offset) |
1684 IsTruncatingBits::encode(is_truncating) | 1628 IsTruncatingBits::encode(is_truncating) |
1685 SkipFastPathBits::encode(skip_fastpath) | 1629 SkipFastPathBits::encode(skip_fastpath) |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 #undef DEFINE_PLATFORM_CODE_STUB 2109 #undef DEFINE_PLATFORM_CODE_STUB
2166 #undef DEFINE_HANDLER_CODE_STUB 2110 #undef DEFINE_HANDLER_CODE_STUB
2167 #undef DEFINE_HYDROGEN_CODE_STUB 2111 #undef DEFINE_HYDROGEN_CODE_STUB
2168 #undef DEFINE_CODE_STUB 2112 #undef DEFINE_CODE_STUB
2169 #undef DEFINE_CODE_STUB_BASE 2113 #undef DEFINE_CODE_STUB_BASE
2170 2114
2171 } // namespace internal 2115 } // namespace internal
2172 } // namespace v8 2116 } // namespace v8
2173 2117
2174 #endif // V8_CODE_STUBS_H_ 2118 #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