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_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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 }; | 957 }; |
958 | 958 |
959 | 959 |
960 class CallICStub: public PlatformCodeStub { | 960 class CallICStub: public PlatformCodeStub { |
961 public: | 961 public: |
962 CallICStub(Isolate* isolate, const CallICState& state) | 962 CallICStub(Isolate* isolate, const CallICState& state) |
963 : PlatformCodeStub(isolate) { | 963 : PlatformCodeStub(isolate) { |
964 minor_key_ = state.GetExtraICState(); | 964 minor_key_ = state.GetExtraICState(); |
965 } | 965 } |
966 | 966 |
967 static int ExtractArgcFromMinorKey(int minor_key) { | |
968 CallICState state(static_cast<ExtraICState>(minor_key)); | |
969 return state.arg_count(); | |
970 } | |
971 | |
972 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 967 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
973 | 968 |
974 InlineCacheState GetICState() const override { return DEFAULT; } | 969 InlineCacheState GetICState() const override { return DEFAULT; } |
975 | 970 |
976 ExtraICState GetExtraICState() const final { | 971 ExtraICState GetExtraICState() const final { |
977 return static_cast<ExtraICState>(minor_key_); | 972 return static_cast<ExtraICState>(minor_key_); |
978 } | 973 } |
979 | 974 |
980 protected: | 975 protected: |
981 bool CallAsMethod() const { | 976 bool CallAsMethod() const { |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 | 1852 |
1858 | 1853 |
1859 class CallFunctionStub: public PlatformCodeStub { | 1854 class CallFunctionStub: public PlatformCodeStub { |
1860 public: | 1855 public: |
1861 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) | 1856 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) |
1862 : PlatformCodeStub(isolate) { | 1857 : PlatformCodeStub(isolate) { |
1863 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); | 1858 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); |
1864 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); | 1859 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); |
1865 } | 1860 } |
1866 | 1861 |
1867 static int ExtractArgcFromMinorKey(int minor_key) { | |
1868 return ArgcBits::decode(minor_key); | |
1869 } | |
1870 | |
1871 private: | 1862 private: |
1872 int argc() const { return ArgcBits::decode(minor_key_); } | 1863 int argc() const { return ArgcBits::decode(minor_key_); } |
1873 int flags() const { return FlagBits::decode(minor_key_); } | 1864 int flags() const { return FlagBits::decode(minor_key_); } |
1874 | 1865 |
1875 bool CallAsMethod() const { | 1866 bool CallAsMethod() const { |
1876 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; | 1867 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; |
1877 } | 1868 } |
1878 | 1869 |
1879 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } | 1870 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } |
1880 | 1871 |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2986 #undef DEFINE_PLATFORM_CODE_STUB | 2977 #undef DEFINE_PLATFORM_CODE_STUB |
2987 #undef DEFINE_HANDLER_CODE_STUB | 2978 #undef DEFINE_HANDLER_CODE_STUB |
2988 #undef DEFINE_HYDROGEN_CODE_STUB | 2979 #undef DEFINE_HYDROGEN_CODE_STUB |
2989 #undef DEFINE_CODE_STUB | 2980 #undef DEFINE_CODE_STUB |
2990 #undef DEFINE_CODE_STUB_BASE | 2981 #undef DEFINE_CODE_STUB_BASE |
2991 | 2982 |
2992 extern Representation RepresentationFromType(Type* type); | 2983 extern Representation RepresentationFromType(Type* type); |
2993 } } // namespace v8::internal | 2984 } } // namespace v8::internal |
2994 | 2985 |
2995 #endif // V8_CODE_STUBS_H_ | 2986 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |