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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 }; | 1006 }; |
1007 | 1007 |
1008 | 1008 |
1009 class CallICStub: public PlatformCodeStub { | 1009 class CallICStub: public PlatformCodeStub { |
1010 public: | 1010 public: |
1011 CallICStub(Isolate* isolate, const CallICState& state) | 1011 CallICStub(Isolate* isolate, const CallICState& state) |
1012 : PlatformCodeStub(isolate) { | 1012 : PlatformCodeStub(isolate) { |
1013 minor_key_ = state.GetExtraICState(); | 1013 minor_key_ = state.GetExtraICState(); |
1014 } | 1014 } |
1015 | 1015 |
1016 static int ExtractArgcFromMinorKey(int minor_key) { | |
1017 CallICState state(static_cast<ExtraICState>(minor_key)); | |
1018 return state.arg_count(); | |
1019 } | |
1020 | |
1021 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 1016 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
1022 | 1017 |
1023 InlineCacheState GetICState() const override { return DEFAULT; } | 1018 InlineCacheState GetICState() const override { return DEFAULT; } |
1024 | 1019 |
1025 ExtraICState GetExtraICState() const final { | 1020 ExtraICState GetExtraICState() const final { |
1026 return static_cast<ExtraICState>(minor_key_); | 1021 return static_cast<ExtraICState>(minor_key_); |
1027 } | 1022 } |
1028 | 1023 |
1029 protected: | 1024 protected: |
1030 bool CallAsMethod() const { | 1025 bool CallAsMethod() const { |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 | 1901 |
1907 | 1902 |
1908 class CallFunctionStub: public PlatformCodeStub { | 1903 class CallFunctionStub: public PlatformCodeStub { |
1909 public: | 1904 public: |
1910 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) | 1905 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) |
1911 : PlatformCodeStub(isolate) { | 1906 : PlatformCodeStub(isolate) { |
1912 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); | 1907 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); |
1913 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); | 1908 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); |
1914 } | 1909 } |
1915 | 1910 |
1916 static int ExtractArgcFromMinorKey(int minor_key) { | |
1917 return ArgcBits::decode(minor_key); | |
1918 } | |
1919 | |
1920 private: | 1911 private: |
1921 int argc() const { return ArgcBits::decode(minor_key_); } | 1912 int argc() const { return ArgcBits::decode(minor_key_); } |
1922 int flags() const { return FlagBits::decode(minor_key_); } | 1913 int flags() const { return FlagBits::decode(minor_key_); } |
1923 | 1914 |
1924 bool CallAsMethod() const { | 1915 bool CallAsMethod() const { |
1925 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; | 1916 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; |
1926 } | 1917 } |
1927 | 1918 |
1928 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } | 1919 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } |
1929 | 1920 |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 #undef DEFINE_PLATFORM_CODE_STUB | 3026 #undef DEFINE_PLATFORM_CODE_STUB |
3036 #undef DEFINE_HANDLER_CODE_STUB | 3027 #undef DEFINE_HANDLER_CODE_STUB |
3037 #undef DEFINE_HYDROGEN_CODE_STUB | 3028 #undef DEFINE_HYDROGEN_CODE_STUB |
3038 #undef DEFINE_CODE_STUB | 3029 #undef DEFINE_CODE_STUB |
3039 #undef DEFINE_CODE_STUB_BASE | 3030 #undef DEFINE_CODE_STUB_BASE |
3040 | 3031 |
3041 extern Representation RepresentationFromType(Type* type); | 3032 extern Representation RepresentationFromType(Type* type); |
3042 } } // namespace v8::internal | 3033 } } // namespace v8::internal |
3043 | 3034 |
3044 #endif // V8_CODE_STUBS_H_ | 3035 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |