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/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 static MaybeHandle<Code> GetCode(Isolate* isolate, uint32_t key); | 283 static MaybeHandle<Code> GetCode(Isolate* isolate, uint32_t key); |
284 | 284 |
285 // Returns information for computing the number key. | 285 // Returns information for computing the number key. |
286 virtual Major MajorKey() const = 0; | 286 virtual Major MajorKey() const = 0; |
287 uint32_t MinorKey() const { return minor_key_; } | 287 uint32_t MinorKey() const { return minor_key_; } |
288 | 288 |
289 // BinaryOpStub needs to override this. | 289 // BinaryOpStub needs to override this. |
290 virtual Code::Kind GetCodeKind() const; | 290 virtual Code::Kind GetCodeKind() const; |
291 | 291 |
292 virtual InlineCacheState GetICState() const { return UNINITIALIZED; } | |
293 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; } | 292 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; } |
294 | 293 |
295 Code::Flags GetCodeFlags() const; | 294 Code::Flags GetCodeFlags() const; |
296 | 295 |
297 friend std::ostream& operator<<(std::ostream& os, const CodeStub& s) { | 296 friend std::ostream& operator<<(std::ostream& os, const CodeStub& s) { |
298 s.PrintName(os); | 297 s.PrintName(os); |
299 return os; | 298 return os; |
300 } | 299 } |
301 | 300 |
302 Isolate* isolate() const { return isolate_; } | 301 Isolate* isolate() const { return isolate_; } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 683 |
685 void AfterCall(MacroAssembler* masm) const override {} | 684 void AfterCall(MacroAssembler* masm) const override {} |
686 }; | 685 }; |
687 | 686 |
688 | 687 |
689 class StringLengthStub : public TurboFanCodeStub { | 688 class StringLengthStub : public TurboFanCodeStub { |
690 public: | 689 public: |
691 explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 690 explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
692 | 691 |
693 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 692 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
694 InlineCacheState GetICState() const override { return MONOMORPHIC; } | |
695 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } | 693 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } |
696 | 694 |
697 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 695 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
698 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); | 696 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); |
699 }; | 697 }; |
700 | 698 |
701 class AddStub final : public TurboFanCodeStub { | 699 class AddStub final : public TurboFanCodeStub { |
702 public: | 700 public: |
703 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 701 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
704 | 702 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 }; | 951 }; |
954 | 952 |
955 class StoreInterceptorStub : public TurboFanCodeStub { | 953 class StoreInterceptorStub : public TurboFanCodeStub { |
956 public: | 954 public: |
957 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 955 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
958 | 956 |
959 void GenerateAssembly(CodeStubAssembler* assember) const override; | 957 void GenerateAssembly(CodeStubAssembler* assember) const override; |
960 | 958 |
961 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 959 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
962 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } | 960 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
963 InlineCacheState GetICState() const override { return MONOMORPHIC; } | |
964 | 961 |
965 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); | 962 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); |
966 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); | 963 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); |
967 }; | 964 }; |
968 | 965 |
969 class LoadIndexedInterceptorStub : public TurboFanCodeStub { | 966 class LoadIndexedInterceptorStub : public TurboFanCodeStub { |
970 public: | 967 public: |
971 explicit LoadIndexedInterceptorStub(Isolate* isolate) | 968 explicit LoadIndexedInterceptorStub(Isolate* isolate) |
972 : TurboFanCodeStub(isolate) {} | 969 : TurboFanCodeStub(isolate) {} |
973 | 970 |
974 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 971 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
975 ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; } | 972 ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; } |
976 InlineCacheState GetICState() const override { return MONOMORPHIC; } | |
977 | 973 |
978 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 974 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
979 DEFINE_TURBOFAN_CODE_STUB(LoadIndexedInterceptor, TurboFanCodeStub); | 975 DEFINE_TURBOFAN_CODE_STUB(LoadIndexedInterceptor, TurboFanCodeStub); |
980 }; | 976 }; |
981 | 977 |
982 // ES6 section 12.10.3 "in" operator evaluation. | 978 // ES6 section 12.10.3 "in" operator evaluation. |
983 class HasPropertyStub : public TurboFanCodeStub { | 979 class HasPropertyStub : public TurboFanCodeStub { |
984 public: | 980 public: |
985 explicit HasPropertyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 981 explicit HasPropertyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
986 | 982 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 | 1350 |
1355 class CallICStub: public PlatformCodeStub { | 1351 class CallICStub: public PlatformCodeStub { |
1356 public: | 1352 public: |
1357 CallICStub(Isolate* isolate, const CallICState& state) | 1353 CallICStub(Isolate* isolate, const CallICState& state) |
1358 : PlatformCodeStub(isolate) { | 1354 : PlatformCodeStub(isolate) { |
1359 minor_key_ = state.GetExtraICState(); | 1355 minor_key_ = state.GetExtraICState(); |
1360 } | 1356 } |
1361 | 1357 |
1362 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 1358 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
1363 | 1359 |
1364 InlineCacheState GetICState() const override { return GENERIC; } | |
1365 | |
1366 ExtraICState GetExtraICState() const final { | 1360 ExtraICState GetExtraICState() const final { |
1367 return static_cast<ExtraICState>(minor_key_); | 1361 return static_cast<ExtraICState>(minor_key_); |
1368 } | 1362 } |
1369 | 1363 |
1370 protected: | 1364 protected: |
1371 int arg_count() const { return state().argc(); } | 1365 int arg_count() const { return state().argc(); } |
1372 ConvertReceiverMode convert_mode() const { return state().convert_mode(); } | 1366 ConvertReceiverMode convert_mode() const { return state().convert_mode(); } |
1373 TailCallMode tail_call_mode() const { return state().tail_call_mode(); } | 1367 TailCallMode tail_call_mode() const { return state().tail_call_mode(); } |
1374 | 1368 |
1375 CallICState state() const { | 1369 CallICState state() const { return CallICState(GetExtraICState()); } |
1376 return CallICState(static_cast<ExtraICState>(minor_key_)); | |
1377 } | |
1378 | 1370 |
1379 // Code generation helpers. | 1371 // Code generation helpers. |
1380 void GenerateMiss(MacroAssembler* masm); | 1372 void GenerateMiss(MacroAssembler* masm); |
1381 void HandleArrayCase(MacroAssembler* masm, Label* miss); | 1373 void HandleArrayCase(MacroAssembler* masm, Label* miss); |
1382 | 1374 |
1383 private: | 1375 private: |
1384 void PrintState(std::ostream& os) const override; // NOLINT | 1376 void PrintState(std::ostream& os) const override; // NOLINT |
1385 | 1377 |
1386 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); | 1378 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); |
1387 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); | 1379 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); |
(...skipping 28 matching lines...) Expand all Loading... |
1416 | 1408 |
1417 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1409 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
1418 DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub); | 1410 DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub); |
1419 }; | 1411 }; |
1420 | 1412 |
1421 | 1413 |
1422 class HandlerStub : public HydrogenCodeStub { | 1414 class HandlerStub : public HydrogenCodeStub { |
1423 public: | 1415 public: |
1424 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 1416 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
1425 ExtraICState GetExtraICState() const override { return kind(); } | 1417 ExtraICState GetExtraICState() const override { return kind(); } |
1426 InlineCacheState GetICState() const override { return MONOMORPHIC; } | |
1427 | 1418 |
1428 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; | 1419 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; |
1429 | 1420 |
1430 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override; | 1421 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override; |
1431 | 1422 |
1432 protected: | 1423 protected: |
1433 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1424 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
1434 | 1425 |
1435 virtual Code::Kind kind() const = 0; | 1426 virtual Code::Kind kind() const = 0; |
1436 | 1427 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 : TurboFanCodeStub(isolate) { | 1508 : TurboFanCodeStub(isolate) { |
1518 // If that's not true, we need to ensure that the receiver is actually a | 1509 // If that's not true, we need to ensure that the receiver is actually a |
1519 // JSReceiver. http://crbug.com/609134 | 1510 // JSReceiver. http://crbug.com/609134 |
1520 DCHECK(receiver_is_holder); | 1511 DCHECK(receiver_is_holder); |
1521 minor_key_ = IndexBits::encode(index) | | 1512 minor_key_ = IndexBits::encode(index) | |
1522 ReceiverIsHolderBits::encode(receiver_is_holder); | 1513 ReceiverIsHolderBits::encode(receiver_is_holder); |
1523 } | 1514 } |
1524 | 1515 |
1525 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 1516 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
1526 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } | 1517 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } |
1527 InlineCacheState GetICState() const override { return MONOMORPHIC; } | |
1528 | 1518 |
1529 int index() const { return IndexBits::decode(minor_key_); } | 1519 int index() const { return IndexBits::decode(minor_key_); } |
1530 bool receiver_is_holder() const { | 1520 bool receiver_is_holder() const { |
1531 return ReceiverIsHolderBits::decode(minor_key_); | 1521 return ReceiverIsHolderBits::decode(minor_key_); |
1532 } | 1522 } |
1533 | 1523 |
1534 private: | 1524 private: |
1535 class ReceiverIsHolderBits : public BitField<bool, 0, 1> {}; | 1525 class ReceiverIsHolderBits : public BitField<bool, 0, 1> {}; |
1536 class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {}; | 1526 class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {}; |
1537 | 1527 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 | 1847 |
1858 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) | 1848 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) |
1859 : HydrogenCodeStub(isolate) { | 1849 : HydrogenCodeStub(isolate) { |
1860 set_sub_minor_key(state.GetExtraICState()); | 1850 set_sub_minor_key(state.GetExtraICState()); |
1861 } | 1851 } |
1862 | 1852 |
1863 static void GenerateAheadOfTime(Isolate* isolate); | 1853 static void GenerateAheadOfTime(Isolate* isolate); |
1864 | 1854 |
1865 Code::Kind GetCodeKind() const override { return Code::BINARY_OP_IC; } | 1855 Code::Kind GetCodeKind() const override { return Code::BINARY_OP_IC; } |
1866 | 1856 |
1867 InlineCacheState GetICState() const final { return state().GetICState(); } | |
1868 | |
1869 ExtraICState GetExtraICState() const final { | 1857 ExtraICState GetExtraICState() const final { |
1870 return static_cast<ExtraICState>(sub_minor_key()); | 1858 return static_cast<ExtraICState>(sub_minor_key()); |
1871 } | 1859 } |
1872 | 1860 |
1873 BinaryOpICState state() const { | 1861 BinaryOpICState state() const { |
1874 return BinaryOpICState(isolate(), GetExtraICState()); | 1862 return BinaryOpICState(isolate(), GetExtraICState()); |
1875 } | 1863 } |
1876 | 1864 |
1877 void PrintState(std::ostream& os) const final; // NOLINT | 1865 void PrintState(std::ostream& os) const final; // NOLINT |
1878 | 1866 |
(...skipping 23 matching lines...) Expand all Loading... |
1902 static void GenerateAheadOfTime(Isolate* isolate); | 1890 static void GenerateAheadOfTime(Isolate* isolate); |
1903 | 1891 |
1904 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { | 1892 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { |
1905 Code::FindAndReplacePattern pattern; | 1893 Code::FindAndReplacePattern pattern; |
1906 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); | 1894 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); |
1907 return CodeStub::GetCodeCopy(pattern); | 1895 return CodeStub::GetCodeCopy(pattern); |
1908 } | 1896 } |
1909 | 1897 |
1910 Code::Kind GetCodeKind() const override { return Code::BINARY_OP_IC; } | 1898 Code::Kind GetCodeKind() const override { return Code::BINARY_OP_IC; } |
1911 | 1899 |
1912 InlineCacheState GetICState() const override { return state().GetICState(); } | |
1913 | |
1914 ExtraICState GetExtraICState() const override { | 1900 ExtraICState GetExtraICState() const override { |
1915 return static_cast<ExtraICState>(minor_key_); | 1901 return static_cast<ExtraICState>(minor_key_); |
1916 } | 1902 } |
1917 | 1903 |
1918 void PrintState(std::ostream& os) const override; // NOLINT | 1904 void PrintState(std::ostream& os) const override; // NOLINT |
1919 | 1905 |
1920 private: | 1906 private: |
1921 BinaryOpICState state() const { | 1907 BinaryOpICState state() const { |
1922 return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_)); | 1908 return BinaryOpICState(isolate(), GetExtraICState()); |
1923 } | 1909 } |
1924 | 1910 |
1925 static void GenerateAheadOfTime(Isolate* isolate, | 1911 static void GenerateAheadOfTime(Isolate* isolate, |
1926 const BinaryOpICState& state); | 1912 const BinaryOpICState& state); |
1927 | 1913 |
1928 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); | 1914 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); |
1929 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); | 1915 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); |
1930 }; | 1916 }; |
1931 | 1917 |
1932 | 1918 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1967 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
1982 }; | 1968 }; |
1983 | 1969 |
1984 | 1970 |
1985 class CompareICStub : public PlatformCodeStub { | 1971 class CompareICStub : public PlatformCodeStub { |
1986 public: | 1972 public: |
1987 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left, | 1973 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left, |
1988 CompareICState::State right, CompareICState::State state) | 1974 CompareICState::State right, CompareICState::State state) |
1989 : PlatformCodeStub(isolate) { | 1975 : PlatformCodeStub(isolate) { |
1990 DCHECK(Token::IsCompareOp(op)); | 1976 DCHECK(Token::IsCompareOp(op)); |
| 1977 DCHECK(OpBits::is_valid(op - Token::EQ)); |
1991 minor_key_ = OpBits::encode(op - Token::EQ) | | 1978 minor_key_ = OpBits::encode(op - Token::EQ) | |
1992 LeftStateBits::encode(left) | RightStateBits::encode(right) | | 1979 LeftStateBits::encode(left) | RightStateBits::encode(right) | |
1993 StateBits::encode(state); | 1980 StateBits::encode(state); |
1994 } | 1981 } |
| 1982 CompareICStub(Isolate* isolate, ExtraICState extra_ic_state) |
| 1983 : PlatformCodeStub(isolate) { |
| 1984 minor_key_ = extra_ic_state; |
| 1985 } |
1995 | 1986 |
1996 void set_known_map(Handle<Map> map) { known_map_ = map; } | 1987 void set_known_map(Handle<Map> map) { known_map_ = map; } |
1997 | 1988 |
1998 InlineCacheState GetICState() const override; | 1989 InlineCacheState GetICState() const; |
1999 | 1990 |
2000 Token::Value op() const { | 1991 Token::Value op() const { |
2001 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); | 1992 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); |
2002 } | 1993 } |
2003 | 1994 |
2004 CompareICState::State left() const { | 1995 CompareICState::State left() const { |
2005 return LeftStateBits::decode(minor_key_); | 1996 return LeftStateBits::decode(minor_key_); |
2006 } | 1997 } |
2007 CompareICState::State right() const { | 1998 CompareICState::State right() const { |
2008 return RightStateBits::decode(minor_key_); | 1999 return RightStateBits::decode(minor_key_); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2328 | 2319 |
2329 | 2320 |
2330 class KeyedLoadGenericStub : public HydrogenCodeStub { | 2321 class KeyedLoadGenericStub : public HydrogenCodeStub { |
2331 public: | 2322 public: |
2332 explicit KeyedLoadGenericStub(Isolate* isolate, const LoadICState& state) | 2323 explicit KeyedLoadGenericStub(Isolate* isolate, const LoadICState& state) |
2333 : HydrogenCodeStub(isolate) { | 2324 : HydrogenCodeStub(isolate) { |
2334 minor_key_ = state.GetExtraICState(); | 2325 minor_key_ = state.GetExtraICState(); |
2335 } | 2326 } |
2336 | 2327 |
2337 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 2328 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
2338 InlineCacheState GetICState() const override { return GENERIC; } | |
2339 | 2329 |
2340 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 2330 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
2341 | 2331 |
2342 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); | 2332 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); |
2343 }; | 2333 }; |
2344 | 2334 |
2345 | 2335 |
2346 class LoadICTrampolineStub : public PlatformCodeStub { | 2336 class LoadICTrampolineStub : public PlatformCodeStub { |
2347 public: | 2337 public: |
2348 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) | 2338 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) |
2349 : PlatformCodeStub(isolate) { | 2339 : PlatformCodeStub(isolate) { |
2350 minor_key_ = state.GetExtraICState(); | 2340 minor_key_ = state.GetExtraICState(); |
2351 } | 2341 } |
2352 | 2342 |
2353 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2343 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2354 | 2344 |
2355 InlineCacheState GetICState() const final { return GENERIC; } | |
2356 | |
2357 ExtraICState GetExtraICState() const final { | 2345 ExtraICState GetExtraICState() const final { |
2358 return static_cast<ExtraICState>(minor_key_); | 2346 return static_cast<ExtraICState>(minor_key_); |
2359 } | 2347 } |
2360 | 2348 |
2361 protected: | 2349 protected: |
2362 LoadICState state() const { | 2350 LoadICState state() const { |
2363 return LoadICState(static_cast<ExtraICState>(minor_key_)); | 2351 return LoadICState(static_cast<ExtraICState>(minor_key_)); |
2364 } | 2352 } |
2365 | 2353 |
2366 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 2354 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
2367 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); | 2355 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); |
2368 }; | 2356 }; |
2369 | 2357 |
2370 class LoadICTrampolineTFStub : public TurboFanCodeStub { | 2358 class LoadICTrampolineTFStub : public TurboFanCodeStub { |
2371 public: | 2359 public: |
2372 LoadICTrampolineTFStub(Isolate* isolate, const LoadICState& state) | 2360 LoadICTrampolineTFStub(Isolate* isolate, const LoadICState& state) |
2373 : TurboFanCodeStub(isolate) { | 2361 : TurboFanCodeStub(isolate) { |
2374 minor_key_ = state.GetExtraICState(); | 2362 minor_key_ = state.GetExtraICState(); |
2375 } | 2363 } |
2376 | 2364 |
2377 void GenerateAssembly(CodeStubAssembler* assembler) const override; | 2365 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
2378 | 2366 |
2379 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2367 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2380 | 2368 |
2381 InlineCacheState GetICState() const final { return GENERIC; } | |
2382 | |
2383 ExtraICState GetExtraICState() const final { | 2369 ExtraICState GetExtraICState() const final { |
2384 return static_cast<ExtraICState>(minor_key_); | 2370 return static_cast<ExtraICState>(minor_key_); |
2385 } | 2371 } |
2386 | 2372 |
2387 protected: | 2373 protected: |
2388 LoadICState state() const { | 2374 LoadICState state() const { |
2389 return LoadICState(static_cast<ExtraICState>(minor_key_)); | 2375 return LoadICState(static_cast<ExtraICState>(minor_key_)); |
2390 } | 2376 } |
2391 | 2377 |
2392 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 2378 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
(...skipping 13 matching lines...) Expand all Loading... |
2406 | 2392 |
2407 class VectorStoreICTrampolineStub : public PlatformCodeStub { | 2393 class VectorStoreICTrampolineStub : public PlatformCodeStub { |
2408 public: | 2394 public: |
2409 VectorStoreICTrampolineStub(Isolate* isolate, const StoreICState& state) | 2395 VectorStoreICTrampolineStub(Isolate* isolate, const StoreICState& state) |
2410 : PlatformCodeStub(isolate) { | 2396 : PlatformCodeStub(isolate) { |
2411 minor_key_ = state.GetExtraICState(); | 2397 minor_key_ = state.GetExtraICState(); |
2412 } | 2398 } |
2413 | 2399 |
2414 Code::Kind GetCodeKind() const override { return Code::STORE_IC; } | 2400 Code::Kind GetCodeKind() const override { return Code::STORE_IC; } |
2415 | 2401 |
2416 InlineCacheState GetICState() const final { return GENERIC; } | |
2417 | |
2418 ExtraICState GetExtraICState() const final { | 2402 ExtraICState GetExtraICState() const final { |
2419 return static_cast<ExtraICState>(minor_key_); | 2403 return static_cast<ExtraICState>(minor_key_); |
2420 } | 2404 } |
2421 | 2405 |
2422 protected: | 2406 protected: |
2423 StoreICState state() const { | 2407 StoreICState state() const { |
2424 return StoreICState(static_cast<ExtraICState>(minor_key_)); | 2408 return StoreICState(static_cast<ExtraICState>(minor_key_)); |
2425 } | 2409 } |
2426 | 2410 |
2427 private: | 2411 private: |
(...skipping 16 matching lines...) Expand all Loading... |
2444 | 2428 |
2445 class CallICTrampolineStub : public PlatformCodeStub { | 2429 class CallICTrampolineStub : public PlatformCodeStub { |
2446 public: | 2430 public: |
2447 CallICTrampolineStub(Isolate* isolate, const CallICState& state) | 2431 CallICTrampolineStub(Isolate* isolate, const CallICState& state) |
2448 : PlatformCodeStub(isolate) { | 2432 : PlatformCodeStub(isolate) { |
2449 minor_key_ = state.GetExtraICState(); | 2433 minor_key_ = state.GetExtraICState(); |
2450 } | 2434 } |
2451 | 2435 |
2452 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 2436 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
2453 | 2437 |
2454 InlineCacheState GetICState() const final { return GENERIC; } | |
2455 | |
2456 ExtraICState GetExtraICState() const final { | 2438 ExtraICState GetExtraICState() const final { |
2457 return static_cast<ExtraICState>(minor_key_); | 2439 return static_cast<ExtraICState>(minor_key_); |
2458 } | 2440 } |
2459 | 2441 |
2460 protected: | 2442 protected: |
2461 CallICState state() const { | 2443 CallICState state() const { |
2462 return CallICState(static_cast<ExtraICState>(minor_key_)); | 2444 return CallICState(static_cast<ExtraICState>(minor_key_)); |
2463 } | 2445 } |
2464 | 2446 |
2465 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); | 2447 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); |
2466 DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub); | 2448 DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub); |
2467 }; | 2449 }; |
2468 | 2450 |
2469 | 2451 |
2470 class LoadICStub : public PlatformCodeStub { | 2452 class LoadICStub : public PlatformCodeStub { |
2471 public: | 2453 public: |
2472 explicit LoadICStub(Isolate* isolate, const LoadICState& state) | 2454 explicit LoadICStub(Isolate* isolate, const LoadICState& state) |
2473 : PlatformCodeStub(isolate) { | 2455 : PlatformCodeStub(isolate) { |
2474 minor_key_ = state.GetExtraICState(); | 2456 minor_key_ = state.GetExtraICState(); |
2475 } | 2457 } |
2476 | 2458 |
2477 void GenerateForTrampoline(MacroAssembler* masm); | 2459 void GenerateForTrampoline(MacroAssembler* masm); |
2478 | 2460 |
2479 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2461 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2480 InlineCacheState GetICState() const final { return GENERIC; } | 2462 |
2481 ExtraICState GetExtraICState() const final { | 2463 ExtraICState GetExtraICState() const final { |
2482 return static_cast<ExtraICState>(minor_key_); | 2464 return static_cast<ExtraICState>(minor_key_); |
2483 } | 2465 } |
2484 | 2466 |
2485 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 2467 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2486 DEFINE_PLATFORM_CODE_STUB(LoadIC, PlatformCodeStub); | 2468 DEFINE_PLATFORM_CODE_STUB(LoadIC, PlatformCodeStub); |
2487 | 2469 |
2488 protected: | 2470 protected: |
2489 void GenerateImpl(MacroAssembler* masm, bool in_frame); | 2471 void GenerateImpl(MacroAssembler* masm, bool in_frame); |
2490 }; | 2472 }; |
2491 | 2473 |
2492 class LoadICTFStub : public TurboFanCodeStub { | 2474 class LoadICTFStub : public TurboFanCodeStub { |
2493 public: | 2475 public: |
2494 explicit LoadICTFStub(Isolate* isolate, const LoadICState& state) | 2476 explicit LoadICTFStub(Isolate* isolate, const LoadICState& state) |
2495 : TurboFanCodeStub(isolate) { | 2477 : TurboFanCodeStub(isolate) { |
2496 minor_key_ = state.GetExtraICState(); | 2478 minor_key_ = state.GetExtraICState(); |
2497 } | 2479 } |
2498 | 2480 |
2499 void GenerateAssembly(CodeStubAssembler* assembler) const override; | 2481 void GenerateAssembly(CodeStubAssembler* assembler) const override; |
2500 | 2482 |
2501 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2483 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2502 InlineCacheState GetICState() const final { return GENERIC; } | 2484 |
2503 ExtraICState GetExtraICState() const final { | 2485 ExtraICState GetExtraICState() const final { |
2504 return static_cast<ExtraICState>(minor_key_); | 2486 return static_cast<ExtraICState>(minor_key_); |
2505 } | 2487 } |
2506 | 2488 |
2507 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 2489 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2508 DEFINE_CODE_STUB(LoadICTF, TurboFanCodeStub); | 2490 DEFINE_CODE_STUB(LoadICTF, TurboFanCodeStub); |
2509 }; | 2491 }; |
2510 | 2492 |
2511 class KeyedLoadICStub : public PlatformCodeStub { | 2493 class KeyedLoadICStub : public PlatformCodeStub { |
2512 public: | 2494 public: |
2513 explicit KeyedLoadICStub(Isolate* isolate, const LoadICState& state) | 2495 explicit KeyedLoadICStub(Isolate* isolate, const LoadICState& state) |
2514 : PlatformCodeStub(isolate) { | 2496 : PlatformCodeStub(isolate) { |
2515 minor_key_ = state.GetExtraICState(); | 2497 minor_key_ = state.GetExtraICState(); |
2516 } | 2498 } |
2517 | 2499 |
2518 void GenerateForTrampoline(MacroAssembler* masm); | 2500 void GenerateForTrampoline(MacroAssembler* masm); |
2519 | 2501 |
2520 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 2502 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
2521 InlineCacheState GetICState() const final { return GENERIC; } | 2503 |
2522 ExtraICState GetExtraICState() const final { | 2504 ExtraICState GetExtraICState() const final { |
2523 return static_cast<ExtraICState>(minor_key_); | 2505 return static_cast<ExtraICState>(minor_key_); |
2524 } | 2506 } |
2525 | 2507 |
2526 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 2508 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2527 DEFINE_PLATFORM_CODE_STUB(KeyedLoadIC, PlatformCodeStub); | 2509 DEFINE_PLATFORM_CODE_STUB(KeyedLoadIC, PlatformCodeStub); |
2528 | 2510 |
2529 protected: | 2511 protected: |
2530 void GenerateImpl(MacroAssembler* masm, bool in_frame); | 2512 void GenerateImpl(MacroAssembler* masm, bool in_frame); |
2531 }; | 2513 }; |
2532 | 2514 |
2533 | 2515 |
2534 class VectorStoreICStub : public PlatformCodeStub { | 2516 class VectorStoreICStub : public PlatformCodeStub { |
2535 public: | 2517 public: |
2536 VectorStoreICStub(Isolate* isolate, const StoreICState& state) | 2518 VectorStoreICStub(Isolate* isolate, const StoreICState& state) |
2537 : PlatformCodeStub(isolate) { | 2519 : PlatformCodeStub(isolate) { |
2538 minor_key_ = state.GetExtraICState(); | 2520 minor_key_ = state.GetExtraICState(); |
2539 } | 2521 } |
2540 | 2522 |
2541 void GenerateForTrampoline(MacroAssembler* masm); | 2523 void GenerateForTrampoline(MacroAssembler* masm); |
2542 | 2524 |
2543 Code::Kind GetCodeKind() const final { return Code::STORE_IC; } | 2525 Code::Kind GetCodeKind() const final { return Code::STORE_IC; } |
2544 InlineCacheState GetICState() const final { return GENERIC; } | 2526 |
2545 ExtraICState GetExtraICState() const final { | 2527 ExtraICState GetExtraICState() const final { |
2546 return static_cast<ExtraICState>(minor_key_); | 2528 return static_cast<ExtraICState>(minor_key_); |
2547 } | 2529 } |
2548 | 2530 |
2549 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreIC); | 2531 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreIC); |
2550 DEFINE_PLATFORM_CODE_STUB(VectorStoreIC, PlatformCodeStub); | 2532 DEFINE_PLATFORM_CODE_STUB(VectorStoreIC, PlatformCodeStub); |
2551 | 2533 |
2552 protected: | 2534 protected: |
2553 void GenerateImpl(MacroAssembler* masm, bool in_frame); | 2535 void GenerateImpl(MacroAssembler* masm, bool in_frame); |
2554 }; | 2536 }; |
2555 | 2537 |
2556 | 2538 |
2557 class VectorKeyedStoreICStub : public PlatformCodeStub { | 2539 class VectorKeyedStoreICStub : public PlatformCodeStub { |
2558 public: | 2540 public: |
2559 VectorKeyedStoreICStub(Isolate* isolate, const StoreICState& state) | 2541 VectorKeyedStoreICStub(Isolate* isolate, const StoreICState& state) |
2560 : PlatformCodeStub(isolate) { | 2542 : PlatformCodeStub(isolate) { |
2561 minor_key_ = state.GetExtraICState(); | 2543 minor_key_ = state.GetExtraICState(); |
2562 } | 2544 } |
2563 | 2545 |
2564 void GenerateForTrampoline(MacroAssembler* masm); | 2546 void GenerateForTrampoline(MacroAssembler* masm); |
2565 | 2547 |
2566 Code::Kind GetCodeKind() const final { return Code::KEYED_STORE_IC; } | 2548 Code::Kind GetCodeKind() const final { return Code::KEYED_STORE_IC; } |
2567 InlineCacheState GetICState() const final { return GENERIC; } | 2549 |
2568 ExtraICState GetExtraICState() const final { | 2550 ExtraICState GetExtraICState() const final { |
2569 return static_cast<ExtraICState>(minor_key_); | 2551 return static_cast<ExtraICState>(minor_key_); |
2570 } | 2552 } |
2571 | 2553 |
2572 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreIC); | 2554 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreIC); |
2573 DEFINE_PLATFORM_CODE_STUB(VectorKeyedStoreIC, PlatformCodeStub); | 2555 DEFINE_PLATFORM_CODE_STUB(VectorKeyedStoreIC, PlatformCodeStub); |
2574 | 2556 |
2575 protected: | 2557 protected: |
2576 void GenerateImpl(MacroAssembler* masm, bool in_frame); | 2558 void GenerateImpl(MacroAssembler* masm, bool in_frame); |
2577 }; | 2559 }; |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3085 void PrintState(std::ostream& os) const override; // NOLINT | 3067 void PrintState(std::ostream& os) const override; // NOLINT |
3086 | 3068 |
3087 bool SometimesSetsUpAFrame() override { return false; } | 3069 bool SometimesSetsUpAFrame() override { return false; } |
3088 | 3070 |
3089 static Handle<Code> GetUninitialized(Isolate* isolate) { | 3071 static Handle<Code> GetUninitialized(Isolate* isolate) { |
3090 return ToBooleanICStub(isolate, UNINITIALIZED).GetCode(); | 3072 return ToBooleanICStub(isolate, UNINITIALIZED).GetCode(); |
3091 } | 3073 } |
3092 | 3074 |
3093 ExtraICState GetExtraICState() const override { return types().ToIntegral(); } | 3075 ExtraICState GetExtraICState() const override { return types().ToIntegral(); } |
3094 | 3076 |
3095 InlineCacheState GetICState() const override { | 3077 InlineCacheState GetICState() const { |
3096 if (types().IsEmpty()) { | 3078 if (types().IsEmpty()) { |
3097 return ::v8::internal::UNINITIALIZED; | 3079 return ::v8::internal::UNINITIALIZED; |
3098 } else { | 3080 } else { |
3099 return MONOMORPHIC; | 3081 return MONOMORPHIC; |
3100 } | 3082 } |
3101 } | 3083 } |
3102 | 3084 |
3103 private: | 3085 private: |
3104 ToBooleanICStub(Isolate* isolate, InitializationState init_state) | 3086 ToBooleanICStub(Isolate* isolate, InitializationState init_state) |
3105 : HydrogenCodeStub(isolate, init_state) {} | 3087 : HydrogenCodeStub(isolate, init_state) {} |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3244 #undef DEFINE_HYDROGEN_CODE_STUB | 3226 #undef DEFINE_HYDROGEN_CODE_STUB |
3245 #undef DEFINE_CODE_STUB | 3227 #undef DEFINE_CODE_STUB |
3246 #undef DEFINE_CODE_STUB_BASE | 3228 #undef DEFINE_CODE_STUB_BASE |
3247 | 3229 |
3248 extern Representation RepresentationFromType(Type* type); | 3230 extern Representation RepresentationFromType(Type* type); |
3249 | 3231 |
3250 } // namespace internal | 3232 } // namespace internal |
3251 } // namespace v8 | 3233 } // namespace v8 |
3252 | 3234 |
3253 #endif // V8_CODE_STUBS_H_ | 3235 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |