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

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

Issue 1407373007: Remove CallFunctionStub, always call through the Call builtin (also from CallIC) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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"
11 #include "src/globals.h" 11 #include "src/globals.h"
12 #include "src/ic/ic-state.h" 12 #include "src/ic/ic-state.h"
13 #include "src/interface-descriptors.h" 13 #include "src/interface-descriptors.h"
14 #include "src/macro-assembler.h" 14 #include "src/macro-assembler.h"
15 #include "src/ostreams.h" 15 #include "src/ostreams.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
20 // List of code stubs used on all platforms. 20 // List of code stubs used on all platforms.
21 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ 21 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \
22 /* PlatformCodeStubs */ \ 22 /* PlatformCodeStubs */ \
23 V(ArgumentsAccess) \ 23 V(ArgumentsAccess) \
24 V(ArrayConstructor) \ 24 V(ArrayConstructor) \
25 V(BinaryOpICWithAllocationSite) \ 25 V(BinaryOpICWithAllocationSite) \
26 V(CallApiFunction) \ 26 V(CallApiFunction) \
27 V(CallApiAccessor) \ 27 V(CallApiAccessor) \
28 V(CallApiGetter) \ 28 V(CallApiGetter) \
29 V(CallConstruct) \ 29 V(CallConstruct) \
30 V(CallFunction) \
31 V(CallIC) \ 30 V(CallIC) \
32 V(CEntry) \ 31 V(CEntry) \
33 V(CompareIC) \ 32 V(CompareIC) \
34 V(DoubleToI) \ 33 V(DoubleToI) \
35 V(FunctionPrototype) \ 34 V(FunctionPrototype) \
36 V(InstanceOf) \ 35 V(InstanceOf) \
37 V(InternalArrayConstructor) \ 36 V(InternalArrayConstructor) \
38 V(JSEntry) \ 37 V(JSEntry) \
39 V(KeyedLoadICTrampoline) \ 38 V(KeyedLoadICTrampoline) \
40 V(LoadICTrampoline) \ 39 V(LoadICTrampoline) \
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 975
977 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } 976 Code::Kind GetCodeKind() const override { return Code::CALL_IC; }
978 977
979 InlineCacheState GetICState() const override { return GENERIC; } 978 InlineCacheState GetICState() const override { return GENERIC; }
980 979
981 ExtraICState GetExtraICState() const final { 980 ExtraICState GetExtraICState() const final {
982 return static_cast<ExtraICState>(minor_key_); 981 return static_cast<ExtraICState>(minor_key_);
983 } 982 }
984 983
985 protected: 984 protected:
986 bool CallAsMethod() const {
987 return state().call_type() == CallICState::METHOD;
988 }
989
990 int arg_count() const { return state().arg_count(); } 985 int arg_count() const { return state().arg_count(); }
991 986
992 CallICState state() const { 987 CallICState state() const {
993 return CallICState(static_cast<ExtraICState>(minor_key_)); 988 return CallICState(static_cast<ExtraICState>(minor_key_));
994 } 989 }
995 990
996 // Code generation helpers. 991 // Code generation helpers.
997 void GenerateMiss(MacroAssembler* masm); 992 void GenerateMiss(MacroAssembler* masm);
998 void HandleArrayCase(MacroAssembler* masm, Label* miss); 993 void HandleArrayCase(MacroAssembler* masm, Label* miss);
999 994
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1951 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1957 static const int kLength = 0; 1952 static const int kLength = 0;
1958 static const int kIndex = 1; 1953 static const int kIndex = 1;
1959 static const int kInput = 2; 1954 static const int kInput = 2;
1960 1955
1961 DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult); 1956 DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult);
1962 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); 1957 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub);
1963 }; 1958 };
1964 1959
1965 1960
1966 // TODO(bmeurer): Deprecate the CallFunctionStub in favor of the more general
1967 // Invoke family of builtins.
1968 class CallFunctionStub: public PlatformCodeStub {
1969 public:
1970 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags)
1971 : PlatformCodeStub(isolate) {
1972 DCHECK(argc >= 0 && argc <= Code::kMaxArguments);
1973 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags);
1974 }
1975
1976 private:
1977 int argc() const { return ArgcBits::decode(minor_key_); }
1978 int flags() const { return FlagBits::decode(minor_key_); }
1979
1980 bool CallAsMethod() const {
1981 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL;
1982 }
1983
1984 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }
1985
1986 void PrintName(std::ostream& os) const override; // NOLINT
1987
1988 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1989 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
1990 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
1991 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
1992
1993 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction);
1994 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub);
1995 };
1996
1997
1998 class CallConstructStub: public PlatformCodeStub { 1961 class CallConstructStub: public PlatformCodeStub {
1999 public: 1962 public:
2000 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) 1963 CallConstructStub(Isolate* isolate, CallConstructorFlags flags)
2001 : PlatformCodeStub(isolate) { 1964 : PlatformCodeStub(isolate) {
2002 minor_key_ = FlagBits::encode(flags); 1965 minor_key_ = FlagBits::encode(flags);
2003 } 1966 }
2004 1967
2005 void FinishCode(Handle<Code> code) override { 1968 void FinishCode(Handle<Code> code) override {
2006 code->set_has_function_cache(RecordCallTarget()); 1969 code->set_has_function_cache(RecordCallTarget());
2007 } 1970 }
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 #undef DEFINE_HYDROGEN_CODE_STUB 3094 #undef DEFINE_HYDROGEN_CODE_STUB
3132 #undef DEFINE_CODE_STUB 3095 #undef DEFINE_CODE_STUB
3133 #undef DEFINE_CODE_STUB_BASE 3096 #undef DEFINE_CODE_STUB_BASE
3134 3097
3135 extern Representation RepresentationFromType(Type* type); 3098 extern Representation RepresentationFromType(Type* type);
3136 3099
3137 } // namespace internal 3100 } // namespace internal
3138 } // namespace v8 3101 } // namespace v8
3139 3102
3140 #endif // V8_CODE_STUBS_H_ 3103 #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