| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \ | 363 NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \ |
| 364 \ | 364 \ |
| 365 private: \ | 365 private: \ |
| 366 DISALLOW_COPY_AND_ASSIGN(NAME) | 366 DISALLOW_COPY_AND_ASSIGN(NAME) |
| 367 | 367 |
| 368 | 368 |
| 369 #define DEFINE_CODE_STUB(NAME, SUPER) \ | 369 #define DEFINE_CODE_STUB(NAME, SUPER) \ |
| 370 public: \ | 370 public: \ |
| 371 inline Major MajorKey() const override { return NAME; }; \ | 371 inline Major MajorKey() const override { return NAME; }; \ |
| 372 \ | 372 \ |
| 373 protected: \ | |
| 374 DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER) | 373 DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER) |
| 375 | 374 |
| 376 | 375 |
| 377 #define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \ | 376 #define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \ |
| 378 private: \ | 377 private: \ |
| 379 void Generate(MacroAssembler* masm) override; \ | 378 void Generate(MacroAssembler* masm) override; \ |
| 380 DEFINE_CODE_STUB(NAME, SUPER) | 379 DEFINE_CODE_STUB(NAME, SUPER) |
| 381 | 380 |
| 382 | 381 |
| 383 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ | 382 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ |
| 384 public: \ | 383 public: \ |
| 385 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 384 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
| 386 Handle<Code> GenerateCode() override; \ | 385 Handle<Code> GenerateCode() override; \ |
| 387 DEFINE_CODE_STUB(NAME, SUPER) | 386 DEFINE_CODE_STUB(NAME, SUPER) |
| 388 | 387 |
| 389 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ | 388 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ |
| 390 public: \ | 389 public: \ |
| 391 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ | 390 void GenerateAssembly(compiler::CodeAssemblerState* state) const override; \ |
| 392 DEFINE_CODE_STUB(NAME, SUPER) | 391 DEFINE_CODE_STUB(NAME, SUPER) |
| 393 | 392 |
| 394 #define DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(NAME, SUPER) \ | 393 #define DEFINE_TURBOFAN_BINARY_OP_CODE_STUB_WITH_FEEDBACK(NAME, SUPER) \ |
| 395 public: \ | 394 public: \ |
| 396 static compiler::Node* Generate(CodeStubAssembler* assembler, \ | 395 static compiler::Node* Generate( \ |
| 397 compiler::Node* left, compiler::Node* right, \ | 396 CodeStubAssembler* assembler, compiler::Node* left, \ |
| 398 compiler::Node* context); \ | 397 compiler::Node* right, compiler::Node* slot_id, \ |
| 399 void GenerateAssembly(CodeStubAssembler* assembler) const override { \ | 398 compiler::Node* type_feedback_vector, compiler::Node* context); \ |
| 400 assembler->Return(Generate(assembler, assembler->Parameter(0), \ | 399 void GenerateAssembly(compiler::CodeAssemblerState* state) const override; \ |
| 401 assembler->Parameter(1), \ | |
| 402 assembler->Parameter(2))); \ | |
| 403 } \ | |
| 404 DEFINE_CODE_STUB(NAME, SUPER) | 400 DEFINE_CODE_STUB(NAME, SUPER) |
| 405 | 401 |
| 406 #define DEFINE_TURBOFAN_BINARY_OP_CODE_STUB_WITH_FEEDBACK(NAME, SUPER) \ | 402 #define DEFINE_TURBOFAN_UNARY_OP_CODE_STUB_WITH_FEEDBACK(NAME, SUPER) \ |
| 407 public: \ | 403 public: \ |
| 408 static compiler::Node* Generate( \ | 404 static compiler::Node* Generate( \ |
| 409 CodeStubAssembler* assembler, compiler::Node* left, \ | 405 CodeStubAssembler* assembler, compiler::Node* value, \ |
| 410 compiler::Node* right, compiler::Node* slot_id, \ | 406 compiler::Node* context, compiler::Node* type_feedback_vector, \ |
| 411 compiler::Node* type_feedback_vector, compiler::Node* context); \ | 407 compiler::Node* slot_id); \ |
| 412 void GenerateAssembly(CodeStubAssembler* assembler) const override { \ | 408 void GenerateAssembly(compiler::CodeAssemblerState* state) const override; \ |
| 413 assembler->Return( \ | |
| 414 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1), \ | |
| 415 assembler->Parameter(2), assembler->Parameter(3), \ | |
| 416 assembler->Parameter(4))); \ | |
| 417 } \ | |
| 418 DEFINE_CODE_STUB(NAME, SUPER) | |
| 419 | |
| 420 #define DEFINE_TURBOFAN_UNARY_OP_CODE_STUB(NAME, SUPER) \ | |
| 421 public: \ | |
| 422 static compiler::Node* Generate(CodeStubAssembler* assembler, \ | |
| 423 compiler::Node* value, \ | |
| 424 compiler::Node* context); \ | |
| 425 void GenerateAssembly(CodeStubAssembler* assembler) const override { \ | |
| 426 assembler->Return(Generate(assembler, assembler->Parameter(0), \ | |
| 427 assembler->Parameter(1))); \ | |
| 428 } \ | |
| 429 DEFINE_CODE_STUB(NAME, SUPER) | |
| 430 | |
| 431 #define DEFINE_TURBOFAN_UNARY_OP_CODE_STUB_WITH_FEEDBACK(NAME, SUPER) \ | |
| 432 public: \ | |
| 433 static compiler::Node* Generate( \ | |
| 434 CodeStubAssembler* assembler, compiler::Node* value, \ | |
| 435 compiler::Node* context, compiler::Node* type_feedback_vector, \ | |
| 436 compiler::Node* slot_id); \ | |
| 437 void GenerateAssembly(CodeStubAssembler* assembler) const override { \ | |
| 438 assembler->Return( \ | |
| 439 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1), \ | |
| 440 assembler->Parameter(2), assembler->Parameter(3))); \ | |
| 441 } \ | |
| 442 DEFINE_CODE_STUB(NAME, SUPER) | 409 DEFINE_CODE_STUB(NAME, SUPER) |
| 443 | 410 |
| 444 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 411 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
| 445 public: \ | 412 public: \ |
| 446 Handle<Code> GenerateCode() override; \ | 413 Handle<Code> GenerateCode() override; \ |
| 447 DEFINE_CODE_STUB(NAME, SUPER) | 414 DEFINE_CODE_STUB(NAME, SUPER) |
| 448 | 415 |
| 449 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 416 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
| 450 public: \ | 417 public: \ |
| 451 typedef NAME##Descriptor Descriptor; \ | 418 typedef NAME##Descriptor Descriptor; \ |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 // Retrieve the code for the stub. Generate the code if needed. | 598 // Retrieve the code for the stub. Generate the code if needed. |
| 632 Handle<Code> GenerateCode() override; | 599 Handle<Code> GenerateCode() override; |
| 633 | 600 |
| 634 int GetStackParameterCount() const override { | 601 int GetStackParameterCount() const override { |
| 635 return GetCallInterfaceDescriptor().GetStackParameterCount(); | 602 return GetCallInterfaceDescriptor().GetStackParameterCount(); |
| 636 } | 603 } |
| 637 | 604 |
| 638 protected: | 605 protected: |
| 639 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} | 606 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} |
| 640 | 607 |
| 641 virtual void GenerateAssembly(CodeStubAssembler* assembler) const = 0; | 608 virtual void GenerateAssembly(compiler::CodeAssemblerState* state) const = 0; |
| 642 | 609 |
| 643 private: | 610 private: |
| 644 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); | 611 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); |
| 645 }; | 612 }; |
| 646 | 613 |
| 647 | 614 |
| 648 // Helper interface to prepare to/restore after making runtime calls. | 615 // Helper interface to prepare to/restore after making runtime calls. |
| 649 class RuntimeCallHelper { | 616 class RuntimeCallHelper { |
| 650 public: | 617 public: |
| 651 virtual ~RuntimeCallHelper() {} | 618 virtual ~RuntimeCallHelper() {} |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 explicit DecStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 754 explicit DecStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 788 | 755 |
| 789 DEFINE_CALL_INTERFACE_DESCRIPTOR(CountOp); | 756 DEFINE_CALL_INTERFACE_DESCRIPTOR(CountOp); |
| 790 DEFINE_TURBOFAN_UNARY_OP_CODE_STUB_WITH_FEEDBACK(Dec, TurboFanCodeStub); | 757 DEFINE_TURBOFAN_UNARY_OP_CODE_STUB_WITH_FEEDBACK(Dec, TurboFanCodeStub); |
| 791 }; | 758 }; |
| 792 | 759 |
| 793 class StoreInterceptorStub : public TurboFanCodeStub { | 760 class StoreInterceptorStub : public TurboFanCodeStub { |
| 794 public: | 761 public: |
| 795 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 762 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 796 | 763 |
| 797 void GenerateAssembly(CodeStubAssembler* assember) const override; | |
| 798 | |
| 799 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 764 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 800 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } | 765 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
| 801 | 766 |
| 802 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 767 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
| 803 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); | 768 DEFINE_TURBOFAN_CODE_STUB(StoreInterceptor, TurboFanCodeStub); |
| 804 }; | 769 }; |
| 805 | 770 |
| 806 class LoadIndexedInterceptorStub : public TurboFanCodeStub { | 771 class LoadIndexedInterceptorStub : public TurboFanCodeStub { |
| 807 public: | 772 public: |
| 808 explicit LoadIndexedInterceptorStub(Isolate* isolate) | 773 explicit LoadIndexedInterceptorStub(Isolate* isolate) |
| 809 : TurboFanCodeStub(isolate) {} | 774 : TurboFanCodeStub(isolate) {} |
| 810 | 775 |
| 811 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 776 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 812 ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; } | 777 ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; } |
| 813 | 778 |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 : HydrogenCodeStub(isolate) {} | 1933 : HydrogenCodeStub(isolate) {} |
| 1969 | 1934 |
| 1970 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 1935 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
| 1971 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); | 1936 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); |
| 1972 }; | 1937 }; |
| 1973 | 1938 |
| 1974 class LoadICTrampolineStub : public TurboFanCodeStub { | 1939 class LoadICTrampolineStub : public TurboFanCodeStub { |
| 1975 public: | 1940 public: |
| 1976 explicit LoadICTrampolineStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 1941 explicit LoadICTrampolineStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 1977 | 1942 |
| 1978 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 1979 | |
| 1980 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 1943 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
| 1981 | 1944 |
| 1982 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1945 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
| 1983 DEFINE_CODE_STUB(LoadICTrampoline, TurboFanCodeStub); | 1946 DEFINE_TURBOFAN_CODE_STUB(LoadICTrampoline, TurboFanCodeStub); |
| 1984 }; | 1947 }; |
| 1985 | 1948 |
| 1986 class LoadGlobalICTrampolineStub : public TurboFanCodeStub { | 1949 class LoadGlobalICTrampolineStub : public TurboFanCodeStub { |
| 1987 public: | 1950 public: |
| 1988 explicit LoadGlobalICTrampolineStub(Isolate* isolate, | 1951 explicit LoadGlobalICTrampolineStub(Isolate* isolate, |
| 1989 const LoadGlobalICState& state) | 1952 const LoadGlobalICState& state) |
| 1990 : TurboFanCodeStub(isolate) { | 1953 : TurboFanCodeStub(isolate) { |
| 1991 minor_key_ = state.GetExtraICState(); | 1954 minor_key_ = state.GetExtraICState(); |
| 1992 } | 1955 } |
| 1993 | 1956 |
| 1994 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 1995 | |
| 1996 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } | 1957 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } |
| 1997 | 1958 |
| 1998 ExtraICState GetExtraICState() const final { | 1959 ExtraICState GetExtraICState() const final { |
| 1999 return static_cast<ExtraICState>(minor_key_); | 1960 return static_cast<ExtraICState>(minor_key_); |
| 2000 } | 1961 } |
| 2001 | 1962 |
| 2002 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobal); | 1963 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobal); |
| 2003 DEFINE_CODE_STUB(LoadGlobalICTrampoline, TurboFanCodeStub); | 1964 DEFINE_TURBOFAN_CODE_STUB(LoadGlobalICTrampoline, TurboFanCodeStub); |
| 2004 }; | 1965 }; |
| 2005 | 1966 |
| 2006 class KeyedLoadICTrampolineTFStub : public LoadICTrampolineStub { | 1967 class KeyedLoadICTrampolineTFStub : public LoadICTrampolineStub { |
| 2007 public: | 1968 public: |
| 2008 explicit KeyedLoadICTrampolineTFStub(Isolate* isolate) | 1969 explicit KeyedLoadICTrampolineTFStub(Isolate* isolate) |
| 2009 : LoadICTrampolineStub(isolate) {} | 1970 : LoadICTrampolineStub(isolate) {} |
| 2010 | 1971 |
| 2011 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2012 | |
| 2013 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 1972 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
| 2014 | 1973 |
| 2015 DEFINE_CODE_STUB(KeyedLoadICTrampolineTF, LoadICTrampolineStub); | 1974 DEFINE_TURBOFAN_CODE_STUB(KeyedLoadICTrampolineTF, LoadICTrampolineStub); |
| 2016 }; | 1975 }; |
| 2017 | 1976 |
| 2018 class StoreICTrampolineStub : public TurboFanCodeStub { | 1977 class StoreICTrampolineStub : public TurboFanCodeStub { |
| 2019 public: | 1978 public: |
| 2020 StoreICTrampolineStub(Isolate* isolate, const StoreICState& state) | 1979 StoreICTrampolineStub(Isolate* isolate, const StoreICState& state) |
| 2021 : TurboFanCodeStub(isolate) { | 1980 : TurboFanCodeStub(isolate) { |
| 2022 minor_key_ = state.GetExtraICState(); | 1981 minor_key_ = state.GetExtraICState(); |
| 2023 } | 1982 } |
| 2024 | 1983 |
| 2025 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2026 | |
| 2027 Code::Kind GetCodeKind() const override { return Code::STORE_IC; } | 1984 Code::Kind GetCodeKind() const override { return Code::STORE_IC; } |
| 2028 | 1985 |
| 2029 ExtraICState GetExtraICState() const final { | 1986 ExtraICState GetExtraICState() const final { |
| 2030 return static_cast<ExtraICState>(minor_key_); | 1987 return static_cast<ExtraICState>(minor_key_); |
| 2031 } | 1988 } |
| 2032 | 1989 |
| 2033 protected: | 1990 protected: |
| 2034 StoreICState state() const { return StoreICState(GetExtraICState()); } | 1991 StoreICState state() const { return StoreICState(GetExtraICState()); } |
| 2035 | 1992 |
| 2036 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); | 1993 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); |
| 2037 DEFINE_CODE_STUB(StoreICTrampoline, TurboFanCodeStub); | 1994 DEFINE_TURBOFAN_CODE_STUB(StoreICTrampoline, TurboFanCodeStub); |
| 2038 }; | 1995 }; |
| 2039 | 1996 |
| 2040 class KeyedStoreICTrampolineStub : public PlatformCodeStub { | 1997 class KeyedStoreICTrampolineStub : public PlatformCodeStub { |
| 2041 public: | 1998 public: |
| 2042 KeyedStoreICTrampolineStub(Isolate* isolate, const StoreICState& state) | 1999 KeyedStoreICTrampolineStub(Isolate* isolate, const StoreICState& state) |
| 2043 : PlatformCodeStub(isolate) { | 2000 : PlatformCodeStub(isolate) { |
| 2044 minor_key_ = state.GetExtraICState(); | 2001 minor_key_ = state.GetExtraICState(); |
| 2045 } | 2002 } |
| 2046 | 2003 |
| 2047 Code::Kind GetCodeKind() const override { return Code::KEYED_STORE_IC; } | 2004 Code::Kind GetCodeKind() const override { return Code::KEYED_STORE_IC; } |
| 2048 | 2005 |
| 2049 ExtraICState GetExtraICState() const final { | 2006 ExtraICState GetExtraICState() const final { |
| 2050 return static_cast<ExtraICState>(minor_key_); | 2007 return static_cast<ExtraICState>(minor_key_); |
| 2051 } | 2008 } |
| 2052 | 2009 |
| 2053 protected: | 2010 protected: |
| 2054 StoreICState state() const { return StoreICState(GetExtraICState()); } | 2011 StoreICState state() const { return StoreICState(GetExtraICState()); } |
| 2055 | 2012 |
| 2056 private: | 2013 private: |
| 2057 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); | 2014 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); |
| 2058 DEFINE_PLATFORM_CODE_STUB(KeyedStoreICTrampoline, PlatformCodeStub); | 2015 DEFINE_PLATFORM_CODE_STUB(KeyedStoreICTrampoline, PlatformCodeStub); |
| 2059 }; | 2016 }; |
| 2060 | 2017 |
| 2061 class KeyedStoreICTrampolineTFStub : public StoreICTrampolineStub { | 2018 class KeyedStoreICTrampolineTFStub : public StoreICTrampolineStub { |
| 2062 public: | 2019 public: |
| 2063 KeyedStoreICTrampolineTFStub(Isolate* isolate, const StoreICState& state) | 2020 KeyedStoreICTrampolineTFStub(Isolate* isolate, const StoreICState& state) |
| 2064 : StoreICTrampolineStub(isolate, state) {} | 2021 : StoreICTrampolineStub(isolate, state) {} |
| 2065 | 2022 |
| 2066 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2067 | |
| 2068 Code::Kind GetCodeKind() const override { return Code::KEYED_STORE_IC; } | 2023 Code::Kind GetCodeKind() const override { return Code::KEYED_STORE_IC; } |
| 2069 | 2024 |
| 2070 DEFINE_CODE_STUB(KeyedStoreICTrampolineTF, StoreICTrampolineStub); | 2025 DEFINE_TURBOFAN_CODE_STUB(KeyedStoreICTrampolineTF, StoreICTrampolineStub); |
| 2071 }; | 2026 }; |
| 2072 | 2027 |
| 2073 class CallICTrampolineStub : public PlatformCodeStub { | 2028 class CallICTrampolineStub : public PlatformCodeStub { |
| 2074 public: | 2029 public: |
| 2075 CallICTrampolineStub(Isolate* isolate, const CallICState& state) | 2030 CallICTrampolineStub(Isolate* isolate, const CallICState& state) |
| 2076 : PlatformCodeStub(isolate) { | 2031 : PlatformCodeStub(isolate) { |
| 2077 minor_key_ = state.GetExtraICState(); | 2032 minor_key_ = state.GetExtraICState(); |
| 2078 } | 2033 } |
| 2079 | 2034 |
| 2080 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 2035 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
| 2081 | 2036 |
| 2082 ExtraICState GetExtraICState() const final { | 2037 ExtraICState GetExtraICState() const final { |
| 2083 return static_cast<ExtraICState>(minor_key_); | 2038 return static_cast<ExtraICState>(minor_key_); |
| 2084 } | 2039 } |
| 2085 | 2040 |
| 2086 protected: | 2041 protected: |
| 2087 CallICState state() const { | 2042 CallICState state() const { |
| 2088 return CallICState(static_cast<ExtraICState>(minor_key_)); | 2043 return CallICState(static_cast<ExtraICState>(minor_key_)); |
| 2089 } | 2044 } |
| 2090 | 2045 |
| 2091 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); | 2046 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); |
| 2092 DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub); | 2047 DEFINE_PLATFORM_CODE_STUB(CallICTrampoline, PlatformCodeStub); |
| 2093 }; | 2048 }; |
| 2094 | 2049 |
| 2095 class LoadICStub : public TurboFanCodeStub { | 2050 class LoadICStub : public TurboFanCodeStub { |
| 2096 public: | 2051 public: |
| 2097 explicit LoadICStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 2052 explicit LoadICStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 2098 | 2053 |
| 2099 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2100 | |
| 2101 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2054 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
| 2102 | 2055 |
| 2103 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 2056 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
| 2104 DEFINE_CODE_STUB(LoadIC, TurboFanCodeStub); | 2057 DEFINE_TURBOFAN_CODE_STUB(LoadIC, TurboFanCodeStub); |
| 2105 }; | 2058 }; |
| 2106 | 2059 |
| 2107 class LoadICProtoArrayStub : public TurboFanCodeStub { | 2060 class LoadICProtoArrayStub : public TurboFanCodeStub { |
| 2108 public: | 2061 public: |
| 2109 explicit LoadICProtoArrayStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 2062 explicit LoadICProtoArrayStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 2110 | 2063 |
| 2111 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2112 | |
| 2113 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadICProtoArray); | 2064 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadICProtoArray); |
| 2114 DEFINE_CODE_STUB(LoadICProtoArray, TurboFanCodeStub); | 2065 DEFINE_TURBOFAN_CODE_STUB(LoadICProtoArray, TurboFanCodeStub); |
| 2115 }; | 2066 }; |
| 2116 | 2067 |
| 2117 class LoadGlobalICStub : public TurboFanCodeStub { | 2068 class LoadGlobalICStub : public TurboFanCodeStub { |
| 2118 public: | 2069 public: |
| 2119 explicit LoadGlobalICStub(Isolate* isolate, const LoadGlobalICState& state) | 2070 explicit LoadGlobalICStub(Isolate* isolate, const LoadGlobalICState& state) |
| 2120 : TurboFanCodeStub(isolate) { | 2071 : TurboFanCodeStub(isolate) { |
| 2121 minor_key_ = state.GetExtraICState(); | 2072 minor_key_ = state.GetExtraICState(); |
| 2122 } | 2073 } |
| 2123 | 2074 |
| 2124 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2125 | |
| 2126 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } | 2075 Code::Kind GetCodeKind() const override { return Code::LOAD_GLOBAL_IC; } |
| 2127 | 2076 |
| 2128 ExtraICState GetExtraICState() const final { | 2077 ExtraICState GetExtraICState() const final { |
| 2129 return static_cast<ExtraICState>(minor_key_); | 2078 return static_cast<ExtraICState>(minor_key_); |
| 2130 } | 2079 } |
| 2131 | 2080 |
| 2132 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalWithVector); | 2081 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalWithVector); |
| 2133 DEFINE_CODE_STUB(LoadGlobalIC, TurboFanCodeStub); | 2082 DEFINE_TURBOFAN_CODE_STUB(LoadGlobalIC, TurboFanCodeStub); |
| 2134 }; | 2083 }; |
| 2135 | 2084 |
| 2136 class KeyedLoadICTFStub : public LoadICStub { | 2085 class KeyedLoadICTFStub : public LoadICStub { |
| 2137 public: | 2086 public: |
| 2138 explicit KeyedLoadICTFStub(Isolate* isolate) : LoadICStub(isolate) {} | 2087 explicit KeyedLoadICTFStub(Isolate* isolate) : LoadICStub(isolate) {} |
| 2139 | 2088 |
| 2140 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2141 | |
| 2142 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 2089 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
| 2143 | 2090 |
| 2144 DEFINE_CODE_STUB(KeyedLoadICTF, LoadICStub); | 2091 DEFINE_TURBOFAN_CODE_STUB(KeyedLoadICTF, LoadICStub); |
| 2145 }; | 2092 }; |
| 2146 | 2093 |
| 2147 class StoreICStub : public TurboFanCodeStub { | 2094 class StoreICStub : public TurboFanCodeStub { |
| 2148 public: | 2095 public: |
| 2149 StoreICStub(Isolate* isolate, const StoreICState& state) | 2096 StoreICStub(Isolate* isolate, const StoreICState& state) |
| 2150 : TurboFanCodeStub(isolate) { | 2097 : TurboFanCodeStub(isolate) { |
| 2151 minor_key_ = state.GetExtraICState(); | 2098 minor_key_ = state.GetExtraICState(); |
| 2152 } | 2099 } |
| 2153 | 2100 |
| 2154 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2155 | |
| 2156 Code::Kind GetCodeKind() const override { return Code::STORE_IC; } | 2101 Code::Kind GetCodeKind() const override { return Code::STORE_IC; } |
| 2157 ExtraICState GetExtraICState() const final { | 2102 ExtraICState GetExtraICState() const final { |
| 2158 return static_cast<ExtraICState>(minor_key_); | 2103 return static_cast<ExtraICState>(minor_key_); |
| 2159 } | 2104 } |
| 2160 | 2105 |
| 2161 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 2106 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
| 2162 DEFINE_CODE_STUB(StoreIC, TurboFanCodeStub); | 2107 DEFINE_TURBOFAN_CODE_STUB(StoreIC, TurboFanCodeStub); |
| 2163 }; | 2108 }; |
| 2164 | 2109 |
| 2165 class KeyedStoreICStub : public PlatformCodeStub { | 2110 class KeyedStoreICStub : public PlatformCodeStub { |
| 2166 public: | 2111 public: |
| 2167 KeyedStoreICStub(Isolate* isolate, const StoreICState& state) | 2112 KeyedStoreICStub(Isolate* isolate, const StoreICState& state) |
| 2168 : PlatformCodeStub(isolate) { | 2113 : PlatformCodeStub(isolate) { |
| 2169 minor_key_ = state.GetExtraICState(); | 2114 minor_key_ = state.GetExtraICState(); |
| 2170 } | 2115 } |
| 2171 | 2116 |
| 2172 void GenerateForTrampoline(MacroAssembler* masm); | 2117 void GenerateForTrampoline(MacroAssembler* masm); |
| 2173 | 2118 |
| 2174 Code::Kind GetCodeKind() const final { return Code::KEYED_STORE_IC; } | 2119 Code::Kind GetCodeKind() const final { return Code::KEYED_STORE_IC; } |
| 2175 | 2120 |
| 2176 ExtraICState GetExtraICState() const final { | 2121 ExtraICState GetExtraICState() const final { |
| 2177 return static_cast<ExtraICState>(minor_key_); | 2122 return static_cast<ExtraICState>(minor_key_); |
| 2178 } | 2123 } |
| 2179 | 2124 |
| 2180 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 2125 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
| 2181 DEFINE_PLATFORM_CODE_STUB(KeyedStoreIC, PlatformCodeStub); | 2126 DEFINE_PLATFORM_CODE_STUB(KeyedStoreIC, PlatformCodeStub); |
| 2182 | 2127 |
| 2183 protected: | 2128 protected: |
| 2184 void GenerateImpl(MacroAssembler* masm, bool in_frame); | 2129 void GenerateImpl(MacroAssembler* masm, bool in_frame); |
| 2185 }; | 2130 }; |
| 2186 | 2131 |
| 2187 class KeyedStoreICTFStub : public StoreICStub { | 2132 class KeyedStoreICTFStub : public StoreICStub { |
| 2188 public: | 2133 public: |
| 2189 KeyedStoreICTFStub(Isolate* isolate, const StoreICState& state) | 2134 KeyedStoreICTFStub(Isolate* isolate, const StoreICState& state) |
| 2190 : StoreICStub(isolate, state) {} | 2135 : StoreICStub(isolate, state) {} |
| 2191 | 2136 |
| 2192 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2193 | |
| 2194 Code::Kind GetCodeKind() const override { return Code::KEYED_STORE_IC; } | 2137 Code::Kind GetCodeKind() const override { return Code::KEYED_STORE_IC; } |
| 2195 | 2138 |
| 2196 DEFINE_CODE_STUB(KeyedStoreICTF, StoreICStub); | 2139 DEFINE_TURBOFAN_CODE_STUB(KeyedStoreICTF, StoreICStub); |
| 2197 }; | 2140 }; |
| 2198 | 2141 |
| 2199 class DoubleToIStub : public PlatformCodeStub { | 2142 class DoubleToIStub : public PlatformCodeStub { |
| 2200 public: | 2143 public: |
| 2201 DoubleToIStub(Isolate* isolate, Register source, Register destination, | 2144 DoubleToIStub(Isolate* isolate, Register source, Register destination, |
| 2202 int offset, bool is_truncating, bool skip_fastpath = false) | 2145 int offset, bool is_truncating, bool skip_fastpath = false) |
| 2203 : PlatformCodeStub(isolate) { | 2146 : PlatformCodeStub(isolate) { |
| 2204 minor_key_ = SourceRegisterBits::encode(source.code()) | | 2147 minor_key_ = SourceRegisterBits::encode(source.code()) | |
| 2205 DestinationRegisterBits::encode(destination.code()) | | 2148 DestinationRegisterBits::encode(destination.code()) | |
| 2206 OffsetBits::encode(offset) | | 2149 OffsetBits::encode(offset) | |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind); | 2334 DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind); |
| 2392 DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); | 2335 DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); |
| 2393 }; | 2336 }; |
| 2394 | 2337 |
| 2395 class AllocateHeapNumberStub : public TurboFanCodeStub { | 2338 class AllocateHeapNumberStub : public TurboFanCodeStub { |
| 2396 public: | 2339 public: |
| 2397 explicit AllocateHeapNumberStub(Isolate* isolate) | 2340 explicit AllocateHeapNumberStub(Isolate* isolate) |
| 2398 : TurboFanCodeStub(isolate) {} | 2341 : TurboFanCodeStub(isolate) {} |
| 2399 | 2342 |
| 2400 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; | 2343 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; |
| 2401 void GenerateAssembly(CodeStubAssembler* assembler) const override; | |
| 2402 | 2344 |
| 2403 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateHeapNumber); | 2345 DEFINE_CALL_INTERFACE_DESCRIPTOR(AllocateHeapNumber); |
| 2404 DEFINE_CODE_STUB(AllocateHeapNumber, TurboFanCodeStub); | 2346 DEFINE_TURBOFAN_CODE_STUB(AllocateHeapNumber, TurboFanCodeStub); |
| 2405 }; | 2347 }; |
| 2406 | 2348 |
| 2407 #define SIMD128_ALLOC_STUB(TYPE, Type, type, lane_count, lane_type) \ | 2349 #define SIMD128_ALLOC_STUB(TYPE, Type, type, lane_count, lane_type) \ |
| 2408 class Allocate##Type##Stub : public TurboFanCodeStub { \ | 2350 class Allocate##Type##Stub : public TurboFanCodeStub { \ |
| 2409 public: \ | 2351 public: \ |
| 2410 explicit Allocate##Type##Stub(Isolate* isolate) \ | 2352 explicit Allocate##Type##Stub(Isolate* isolate) \ |
| 2411 : TurboFanCodeStub(isolate) {} \ | 2353 : TurboFanCodeStub(isolate) {} \ |
| 2412 \ | 2354 \ |
| 2413 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 2355 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
| 2414 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ | 2356 void GenerateAssembly(compiler::CodeAssemblerState* state) const override; \ |
| 2415 \ | 2357 \ |
| 2416 DEFINE_CALL_INTERFACE_DESCRIPTOR(Allocate##Type); \ | 2358 DEFINE_CALL_INTERFACE_DESCRIPTOR(Allocate##Type); \ |
| 2417 DEFINE_CODE_STUB(Allocate##Type, TurboFanCodeStub); \ | 2359 DEFINE_CODE_STUB(Allocate##Type, TurboFanCodeStub); \ |
| 2418 }; | 2360 }; |
| 2419 SIMD128_TYPES(SIMD128_ALLOC_STUB) | 2361 SIMD128_TYPES(SIMD128_ALLOC_STUB) |
| 2420 #undef SIMD128_ALLOC_STUB | 2362 #undef SIMD128_ALLOC_STUB |
| 2421 | 2363 |
| 2422 class CommonArrayConstructorStub : public TurboFanCodeStub { | 2364 class CommonArrayConstructorStub : public TurboFanCodeStub { |
| 2423 protected: | 2365 protected: |
| 2424 CommonArrayConstructorStub(Isolate* isolate, ElementsKind kind, | 2366 CommonArrayConstructorStub(Isolate* isolate, ElementsKind kind, |
| 2425 AllocationSiteOverrideMode override_mode) | 2367 AllocationSiteOverrideMode override_mode) |
| 2426 : TurboFanCodeStub(isolate) { | 2368 : TurboFanCodeStub(isolate) { |
| 2427 // It only makes sense to override local allocation site behavior | 2369 // It only makes sense to override local allocation site behavior |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2706 }; | 2648 }; |
| 2707 | 2649 |
| 2708 class SubStringStub : public TurboFanCodeStub { | 2650 class SubStringStub : public TurboFanCodeStub { |
| 2709 public: | 2651 public: |
| 2710 explicit SubStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 2652 explicit SubStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 2711 | 2653 |
| 2712 static compiler::Node* Generate(CodeStubAssembler* assembler, | 2654 static compiler::Node* Generate(CodeStubAssembler* assembler, |
| 2713 compiler::Node* string, compiler::Node* from, | 2655 compiler::Node* string, compiler::Node* from, |
| 2714 compiler::Node* to, compiler::Node* context); | 2656 compiler::Node* to, compiler::Node* context); |
| 2715 | 2657 |
| 2716 void GenerateAssembly(CodeStubAssembler* assembler) const override { | |
| 2717 assembler->Return(Generate(assembler, | |
| 2718 assembler->Parameter(Descriptor::kString), | |
| 2719 assembler->Parameter(Descriptor::kFrom), | |
| 2720 assembler->Parameter(Descriptor::kTo), | |
| 2721 assembler->Parameter(Descriptor::kContext))); | |
| 2722 } | |
| 2723 | |
| 2724 DEFINE_CALL_INTERFACE_DESCRIPTOR(SubString); | 2658 DEFINE_CALL_INTERFACE_DESCRIPTOR(SubString); |
| 2725 DEFINE_CODE_STUB(SubString, TurboFanCodeStub); | 2659 DEFINE_TURBOFAN_CODE_STUB(SubString, TurboFanCodeStub); |
| 2726 }; | 2660 }; |
| 2727 | 2661 |
| 2728 | 2662 |
| 2729 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2663 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
| 2730 #undef DEFINE_PLATFORM_CODE_STUB | 2664 #undef DEFINE_PLATFORM_CODE_STUB |
| 2731 #undef DEFINE_HANDLER_CODE_STUB | 2665 #undef DEFINE_HANDLER_CODE_STUB |
| 2732 #undef DEFINE_HYDROGEN_CODE_STUB | 2666 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2733 #undef DEFINE_CODE_STUB | 2667 #undef DEFINE_CODE_STUB |
| 2734 #undef DEFINE_CODE_STUB_BASE | 2668 #undef DEFINE_CODE_STUB_BASE |
| 2735 | 2669 |
| 2736 } // namespace internal | 2670 } // namespace internal |
| 2737 } // namespace v8 | 2671 } // namespace v8 |
| 2738 | 2672 |
| 2739 #endif // V8_CODE_STUBS_H_ | 2673 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |