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