Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: src/code-stubs.h

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

Powered by Google App Engine
This is Rietveld 408576698