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

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

Issue 551043005: Added CallInterfaceDescriptors to all code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ia32/code-stubs-ia32.h » ('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/codegen.h" 10 #include "src/codegen.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // GC. This means that we must be statically sure that no GC can occur while 173 // GC. This means that we must be statically sure that no GC can occur while
174 // they are running. If that is the case they should override this to return 174 // they are running. If that is the case they should override this to return
175 // true, which will cause an assertion if we try to call something that can 175 // true, which will cause an assertion if we try to call something that can
176 // GC or if we try to put a stack frame on top of the junk, which would not 176 // GC or if we try to put a stack frame on top of the junk, which would not
177 // result in a traversable stack. 177 // result in a traversable stack.
178 virtual bool SometimesSetsUpAFrame() { return true; } 178 virtual bool SometimesSetsUpAFrame() { return true; }
179 179
180 // Lookup the code in the (possibly custom) cache. 180 // Lookup the code in the (possibly custom) cache.
181 bool FindCodeInCache(Code** code_out); 181 bool FindCodeInCache(Code** code_out);
182 182
183 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() { 183 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() = 0;
184 UNREACHABLE(); // Default returns an uninitialized descriptor.
185 return CallInterfaceDescriptor();
186 }
187 184
188 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {} 185 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {}
189 186
190 static void InitializeDescriptor(Isolate* isolate, uint32_t key, 187 static void InitializeDescriptor(Isolate* isolate, uint32_t key,
191 CodeStubDescriptor* desc); 188 CodeStubDescriptor* desc);
192 189
193 // Returns information for computing the number key. 190 // Returns information for computing the number key.
194 virtual Major MajorKey() const = 0; 191 virtual Major MajorKey() const = 0;
195 uint32_t MinorKey() const { return minor_key_; } 192 uint32_t MinorKey() const { return minor_key_; }
196 193
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 public: \ 304 public: \
308 virtual Handle<Code> GenerateCode() OVERRIDE; \ 305 virtual Handle<Code> GenerateCode() OVERRIDE; \
309 DEFINE_CODE_STUB(NAME, SUPER) 306 DEFINE_CODE_STUB(NAME, SUPER)
310 307
311 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ 308 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
312 public: \ 309 public: \
313 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \ 310 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
314 return NAME##Descriptor(isolate()); \ 311 return NAME##Descriptor(isolate()); \
315 } 312 }
316 313
314 // There are some code stubs we just can't describe right now with a
315 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro.
316 // An attempt to retrieve a descriptor will fail.
317 #define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \
318 public: \
319 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
320 UNREACHABLE(); \
321 return CallInterfaceDescriptor(); \
322 }
323
317 324
318 class PlatformCodeStub : public CodeStub { 325 class PlatformCodeStub : public CodeStub {
319 public: 326 public:
320 // Retrieve the code for the stub. Generate the code if needed. 327 // Retrieve the code for the stub. Generate the code if needed.
321 virtual Handle<Code> GenerateCode() OVERRIDE; 328 virtual Handle<Code> GenerateCode() OVERRIDE;
322 329
323 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 330 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
324 331
325 protected: 332 protected:
326 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {} 333 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {}
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 kReturnTrueFalseObject = 1 << 2 670 kReturnTrueFalseObject = 1 << 2
664 }; 671 };
665 672
666 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { 673 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) {
667 minor_key_ = FlagBits::encode(flags); 674 minor_key_ = FlagBits::encode(flags);
668 } 675 }
669 676
670 static Register left() { return InstanceofDescriptor::left(); } 677 static Register left() { return InstanceofDescriptor::left(); }
671 static Register right() { return InstanceofDescriptor::right(); } 678 static Register right() { return InstanceofDescriptor::right(); }
672 679
680 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
681 if (HasArgsInRegisters()) {
682 return InstanceofDescriptor(isolate());
683 }
684 return ContextOnlyDescriptor(isolate());
685 }
686
673 private: 687 private:
674 Flags flags() const { return FlagBits::decode(minor_key_); } 688 Flags flags() const { return FlagBits::decode(minor_key_); }
675 689
676 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } 690 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; }
677 691
678 bool HasCallSiteInlineCheck() const { 692 bool HasCallSiteInlineCheck() const {
679 return (flags() & kCallSiteInlineCheck) != 0; 693 return (flags() & kCallSiteInlineCheck) != 0;
680 } 694 }
681 695
682 bool ReturnTrueFalseObject() const { 696 bool ReturnTrueFalseObject() const {
683 return (flags() & kReturnTrueFalseObject) != 0; 697 return (flags() & kReturnTrueFalseObject) != 0;
684 } 698 }
685 699
686 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 700 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
687 701
688 class FlagBits : public BitField<Flags, 0, 3> {}; 702 class FlagBits : public BitField<Flags, 0, 3> {};
689 703
690 DEFINE_CALL_INTERFACE_DESCRIPTOR(Instanceof);
691 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub); 704 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub);
692 }; 705 };
693 706
694 707
695 enum AllocationSiteOverrideMode { 708 enum AllocationSiteOverrideMode {
696 DONT_OVERRIDE, 709 DONT_OVERRIDE,
697 DISABLE_ALLOCATION_SITES, 710 DISABLE_ALLOCATION_SITES,
698 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES 711 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES
699 }; 712 };
700 713
(...skipping 11 matching lines...) Expand all
712 return ArgumentCountBits::decode(minor_key_); 725 return ArgumentCountBits::decode(minor_key_);
713 } 726 }
714 727
715 void GenerateDispatchToArrayStub(MacroAssembler* masm, 728 void GenerateDispatchToArrayStub(MacroAssembler* masm,
716 AllocationSiteOverrideMode mode); 729 AllocationSiteOverrideMode mode);
717 730
718 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 731 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
719 732
720 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; 733 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};
721 734
735 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor);
722 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub); 736 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub);
723 }; 737 };
724 738
725 739
726 class InternalArrayConstructorStub: public PlatformCodeStub { 740 class InternalArrayConstructorStub: public PlatformCodeStub {
727 public: 741 public:
728 explicit InternalArrayConstructorStub(Isolate* isolate); 742 explicit InternalArrayConstructorStub(Isolate* isolate);
729 743
730 private: 744 private:
731 void GenerateCase(MacroAssembler* masm, ElementsKind kind); 745 void GenerateCase(MacroAssembler* masm, ElementsKind kind);
732 746
747 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor);
733 DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub); 748 DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub);
734 }; 749 };
735 750
736 751
737 class MathPowStub: public PlatformCodeStub { 752 class MathPowStub: public PlatformCodeStub {
738 public: 753 public:
739 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; 754 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK };
740 755
741 MathPowStub(Isolate* isolate, ExponentType exponent_type) 756 MathPowStub(Isolate* isolate, ExponentType exponent_type)
742 : PlatformCodeStub(isolate) { 757 : PlatformCodeStub(isolate) {
743 minor_key_ = ExponentTypeBits::encode(exponent_type); 758 minor_key_ = ExponentTypeBits::encode(exponent_type);
744 } 759 }
745 760
761 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
762 if (exponent_type() == TAGGED) {
763 return MathPowTaggedDescriptor(isolate());
764 } else if (exponent_type() == INTEGER) {
765 return MathPowIntegerDescriptor(isolate());
766 }
767 // A CallInterfaceDescriptor doesn't specify double registers (yet).
768 return ContextOnlyDescriptor(isolate());
769 }
770
746 private: 771 private:
747 ExponentType exponent_type() const { 772 ExponentType exponent_type() const {
748 return ExponentTypeBits::decode(minor_key_); 773 return ExponentTypeBits::decode(minor_key_);
749 } 774 }
750 775
751 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; 776 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {};
752 777
753 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub); 778 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub);
754 }; 779 };
755 780
(...skipping 26 matching lines...) Expand all
782 CallIC::State state() const { 807 CallIC::State state() const {
783 return CallIC::State(static_cast<ExtraICState>(minor_key_)); 808 return CallIC::State(static_cast<ExtraICState>(minor_key_));
784 } 809 }
785 810
786 // Code generation helpers. 811 // Code generation helpers.
787 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); 812 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id);
788 813
789 private: 814 private:
790 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 815 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
791 816
817 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback);
792 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); 818 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub);
793 }; 819 };
794 820
795 821
796 class CallIC_ArrayStub: public CallICStub { 822 class CallIC_ArrayStub: public CallICStub {
797 public: 823 public:
798 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) 824 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in)
799 : CallICStub(isolate, state_in) {} 825 : CallICStub(isolate, state_in) {}
800 826
801 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 827 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
802 return MONOMORPHIC; 828 return MONOMORPHIC;
803 } 829 }
804 830
805 private: 831 private:
806 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 832 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
807 833
808 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub); 834 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub);
809 }; 835 };
810 836
811 837
812 // TODO(verwaest): Translate to hydrogen code stub. 838 // TODO(verwaest): Translate to hydrogen code stub.
813 class FunctionPrototypeStub : public PlatformCodeStub { 839 class FunctionPrototypeStub : public PlatformCodeStub {
814 public: 840 public:
815 explicit FunctionPrototypeStub(Isolate* isolate) 841 explicit FunctionPrototypeStub(Isolate* isolate)
816 : PlatformCodeStub(isolate) {} 842 : PlatformCodeStub(isolate) {}
817 843
818 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 844 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
819 845
846 // TODO(mvstanton): only the receiver register is accessed. When this is
847 // translated to a hydrogen code stub, a new CallInterfaceDescriptor
848 // should be created that just uses that register for more efficient code.
849 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
820 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); 850 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub);
821 }; 851 };
822 852
823 853
824 class HandlerStub : public HydrogenCodeStub { 854 class HandlerStub : public HydrogenCodeStub {
825 public: 855 public:
826 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 856 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
827 virtual ExtraICState GetExtraICState() const { return kind(); } 857 virtual ExtraICState GetExtraICState() const { return kind(); }
828 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } 858 virtual InlineCacheState GetICState() const { return MONOMORPHIC; }
829 859
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 bool call_data_undefined() const { 1032 bool call_data_undefined() const {
1003 return CallDataUndefinedBits::decode(minor_key_); 1033 return CallDataUndefinedBits::decode(minor_key_);
1004 } 1034 }
1005 int argc() const { return ArgumentBits::decode(minor_key_); } 1035 int argc() const { return ArgumentBits::decode(minor_key_); }
1006 1036
1007 class IsStoreBits: public BitField<bool, 0, 1> {}; 1037 class IsStoreBits: public BitField<bool, 0, 1> {};
1008 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; 1038 class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
1009 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; 1039 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {};
1010 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); 1040 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
1011 1041
1042 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction);
1012 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); 1043 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub);
1013 }; 1044 };
1014 1045
1015 1046
1016 class CallApiGetterStub : public PlatformCodeStub { 1047 class CallApiGetterStub : public PlatformCodeStub {
1017 public: 1048 public:
1018 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 1049 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
1019 1050
1051 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter);
1020 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); 1052 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub);
1021 }; 1053 };
1022 1054
1023 1055
1024 class BinaryOpICStub : public HydrogenCodeStub { 1056 class BinaryOpICStub : public HydrogenCodeStub {
1025 public: 1057 public:
1026 BinaryOpICStub(Isolate* isolate, Token::Value op, 1058 BinaryOpICStub(Isolate* isolate, Token::Value op,
1027 OverwriteMode mode = NO_OVERWRITE) 1059 OverwriteMode mode = NO_OVERWRITE)
1028 : HydrogenCodeStub(isolate, UNINITIALIZED) { 1060 : HydrogenCodeStub(isolate, UNINITIALIZED) {
1029 BinaryOpIC::State state(isolate, op, mode); 1061 BinaryOpIC::State state(isolate, op, mode);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 1133 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
1102 1134
1103 private: 1135 private:
1104 BinaryOpIC::State state() const { 1136 BinaryOpIC::State state() const {
1105 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); 1137 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_));
1106 } 1138 }
1107 1139
1108 static void GenerateAheadOfTime(Isolate* isolate, 1140 static void GenerateAheadOfTime(Isolate* isolate,
1109 const BinaryOpIC::State& state); 1141 const BinaryOpIC::State& state);
1110 1142
1143 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite);
1111 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); 1144 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub);
1112 }; 1145 };
1113 1146
1114 1147
1115 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { 1148 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub {
1116 public: 1149 public:
1117 BinaryOpWithAllocationSiteStub(Isolate* isolate, 1150 BinaryOpWithAllocationSiteStub(Isolate* isolate,
1118 Token::Value op, 1151 Token::Value op,
1119 OverwriteMode mode) 1152 OverwriteMode mode)
1120 : BinaryOpICStub(isolate, op, mode) {} 1153 : BinaryOpICStub(isolate, op, mode) {}
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 virtual bool FindCodeInSpecialCache(Code** code_out); 1256 virtual bool FindCodeInSpecialCache(Code** code_out);
1224 virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; } 1257 virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; }
1225 1258
1226 class OpBits : public BitField<int, 0, 3> {}; 1259 class OpBits : public BitField<int, 0, 3> {};
1227 class LeftStateBits : public BitField<CompareIC::State, 3, 4> {}; 1260 class LeftStateBits : public BitField<CompareIC::State, 3, 4> {};
1228 class RightStateBits : public BitField<CompareIC::State, 7, 4> {}; 1261 class RightStateBits : public BitField<CompareIC::State, 7, 4> {};
1229 class StateBits : public BitField<CompareIC::State, 11, 4> {}; 1262 class StateBits : public BitField<CompareIC::State, 11, 4> {};
1230 1263
1231 Handle<Map> known_map_; 1264 Handle<Map> known_map_;
1232 1265
1266 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp);
1233 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); 1267 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub);
1234 }; 1268 };
1235 1269
1236 1270
1237 class CompareNilICStub : public HydrogenCodeStub { 1271 class CompareNilICStub : public HydrogenCodeStub {
1238 public: 1272 public:
1239 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>()); 1273 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
1240 Type* GetInputType(Zone* zone, Handle<Map> map); 1274 Type* GetInputType(Zone* zone, Handle<Map> map);
1241 1275
1242 CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) { 1276 CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } 1380 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
1347 #ifdef _WIN64 1381 #ifdef _WIN64
1348 int result_size() const { return ResultSizeBits::decode(minor_key_); } 1382 int result_size() const { return ResultSizeBits::decode(minor_key_); }
1349 #endif // _WIN64 1383 #endif // _WIN64
1350 1384
1351 bool NeedsImmovableCode(); 1385 bool NeedsImmovableCode();
1352 1386
1353 class SaveDoublesBits : public BitField<bool, 0, 1> {}; 1387 class SaveDoublesBits : public BitField<bool, 0, 1> {};
1354 class ResultSizeBits : public BitField<int, 1, 3> {}; 1388 class ResultSizeBits : public BitField<int, 1, 3> {};
1355 1389
1390 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
1356 DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub); 1391 DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub);
1357 }; 1392 };
1358 1393
1359 1394
1360 class JSEntryStub : public PlatformCodeStub { 1395 class JSEntryStub : public PlatformCodeStub {
1361 public: 1396 public:
1362 JSEntryStub(Isolate* isolate, StackFrame::Type type) 1397 JSEntryStub(Isolate* isolate, StackFrame::Type type)
1363 : PlatformCodeStub(isolate) { 1398 : PlatformCodeStub(isolate) {
1364 DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT); 1399 DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT);
1365 minor_key_ = StackFrameTypeBits::encode(type); 1400 minor_key_ = StackFrameTypeBits::encode(type);
1366 } 1401 }
1367 1402
1368 private: 1403 private:
1369 virtual void FinishCode(Handle<Code> code); 1404 virtual void FinishCode(Handle<Code> code);
1370 1405
1371 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT 1406 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
1372 os << (type() == StackFrame::ENTRY ? "JSEntryStub" 1407 os << (type() == StackFrame::ENTRY ? "JSEntryStub"
1373 : "JSConstructEntryStub"); 1408 : "JSConstructEntryStub");
1374 } 1409 }
1375 1410
1376 StackFrame::Type type() const { 1411 StackFrame::Type type() const {
1377 return StackFrameTypeBits::decode(minor_key_); 1412 return StackFrameTypeBits::decode(minor_key_);
1378 } 1413 }
1379 1414
1380 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; 1415 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {};
1381 1416
1382 int handler_offset_; 1417 int handler_offset_;
1383 1418
1419 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
1384 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); 1420 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub);
1385 }; 1421 };
1386 1422
1387 1423
1388 class ArgumentsAccessStub: public PlatformCodeStub { 1424 class ArgumentsAccessStub: public PlatformCodeStub {
1389 public: 1425 public:
1390 enum Type { 1426 enum Type {
1391 READ_ELEMENT, 1427 READ_ELEMENT,
1392 NEW_SLOPPY_FAST, 1428 NEW_SLOPPY_FAST,
1393 NEW_SLOPPY_SLOW, 1429 NEW_SLOPPY_SLOW,
1394 NEW_STRICT 1430 NEW_STRICT
1395 }; 1431 };
1396 1432
1397 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { 1433 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) {
1398 minor_key_ = TypeBits::encode(type); 1434 minor_key_ = TypeBits::encode(type);
1399 } 1435 }
1400 1436
1437 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
1438 if (type() == READ_ELEMENT) {
1439 return ArgumentsAccessReadDescriptor(isolate());
1440 }
1441 return ContextOnlyDescriptor(isolate());
1442 }
1443
1401 private: 1444 private:
1402 Type type() const { return TypeBits::decode(minor_key_); } 1445 Type type() const { return TypeBits::decode(minor_key_); }
1403 1446
1404 void GenerateReadElement(MacroAssembler* masm); 1447 void GenerateReadElement(MacroAssembler* masm);
1405 void GenerateNewStrict(MacroAssembler* masm); 1448 void GenerateNewStrict(MacroAssembler* masm);
1406 void GenerateNewSloppyFast(MacroAssembler* masm); 1449 void GenerateNewSloppyFast(MacroAssembler* masm);
1407 void GenerateNewSloppySlow(MacroAssembler* masm); 1450 void GenerateNewSloppySlow(MacroAssembler* masm);
1408 1451
1409 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 1452 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
1410 1453
1411 class TypeBits : public BitField<Type, 0, 2> {}; 1454 class TypeBits : public BitField<Type, 0, 2> {};
1412 1455
1413 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); 1456 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub);
1414 }; 1457 };
1415 1458
1416 1459
1417 class RegExpExecStub: public PlatformCodeStub { 1460 class RegExpExecStub: public PlatformCodeStub {
1418 public: 1461 public:
1419 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } 1462 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
1420 1463
1464 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly);
1421 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); 1465 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub);
1422 }; 1466 };
1423 1467
1424 1468
1425 class RegExpConstructResultStub FINAL : public HydrogenCodeStub { 1469 class RegExpConstructResultStub FINAL : public HydrogenCodeStub {
1426 public: 1470 public:
1427 explicit RegExpConstructResultStub(Isolate* isolate) 1471 explicit RegExpConstructResultStub(Isolate* isolate)
1428 : HydrogenCodeStub(isolate) { } 1472 : HydrogenCodeStub(isolate) { }
1429 1473
1430 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1474 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 1753
1710 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 1754 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
1711 return static_cast<ExtraICState>(minor_key_); 1755 return static_cast<ExtraICState>(minor_key_);
1712 } 1756 }
1713 1757
1714 private: 1758 private:
1715 LoadIC::State state() const { 1759 LoadIC::State state() const {
1716 return LoadIC::State(static_cast<ExtraICState>(minor_key_)); 1760 return LoadIC::State(static_cast<ExtraICState>(minor_key_));
1717 } 1761 }
1718 1762
1763 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline);
1719 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); 1764 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub);
1720 }; 1765 };
1721 1766
1722 1767
1723 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { 1768 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub {
1724 public: 1769 public:
1725 explicit KeyedLoadICTrampolineStub(Isolate* isolate) 1770 explicit KeyedLoadICTrampolineStub(Isolate* isolate)
1726 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {} 1771 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {}
1727 1772
1728 virtual Code::Kind GetCodeKind() const OVERRIDE { 1773 virtual Code::Kind GetCodeKind() const OVERRIDE {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 kBitsPerRegisterNumber> {}; // NOLINT 1874 kBitsPerRegisterNumber> {}; // NOLINT
1830 class IsTruncatingBits: 1875 class IsTruncatingBits:
1831 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT 1876 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT
1832 class OffsetBits: 1877 class OffsetBits:
1833 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT 1878 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT
1834 class SkipFastPathBits: 1879 class SkipFastPathBits:
1835 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT 1880 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT
1836 class SSE3Bits: 1881 class SSE3Bits:
1837 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT 1882 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT
1838 1883
1884 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
1839 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); 1885 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub);
1840 }; 1886 };
1841 1887
1842 1888
1843 class LoadFastElementStub : public HydrogenCodeStub { 1889 class LoadFastElementStub : public HydrogenCodeStub {
1844 public: 1890 public:
1845 LoadFastElementStub(Isolate* isolate, bool is_js_array, 1891 LoadFastElementStub(Isolate* isolate, bool is_js_array,
1846 ElementsKind elements_kind) 1892 ElementsKind elements_kind)
1847 : HydrogenCodeStub(isolate) { 1893 : HydrogenCodeStub(isolate) {
1848 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | 1894 set_sub_minor_key(ElementsKindBits::encode(elements_kind) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 minor_key_ = ElementsKindBits::encode(elements_kind); 2141 minor_key_ = ElementsKindBits::encode(elements_kind);
2096 } 2142 }
2097 2143
2098 private: 2144 private:
2099 ElementsKind elements_kind() const { 2145 ElementsKind elements_kind() const {
2100 return ElementsKindBits::decode(minor_key_); 2146 return ElementsKindBits::decode(minor_key_);
2101 } 2147 }
2102 2148
2103 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; 2149 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
2104 2150
2151 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store);
2105 DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub); 2152 DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub);
2106 }; 2153 };
2107 2154
2108 2155
2109 class ToBooleanStub: public HydrogenCodeStub { 2156 class ToBooleanStub: public HydrogenCodeStub {
2110 public: 2157 public:
2111 enum Type { 2158 enum Type {
2112 UNDEFINED, 2159 UNDEFINED,
2113 BOOLEAN, 2160 BOOLEAN,
2114 NULL_TYPE, 2161 NULL_TYPE,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 DEFINE_CALL_INTERFACE_DESCRIPTOR(ElementTransitionAndStore); 2292 DEFINE_CALL_INTERFACE_DESCRIPTOR(ElementTransitionAndStore);
2246 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); 2293 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub);
2247 }; 2294 };
2248 2295
2249 2296
2250 class StoreArrayLiteralElementStub : public PlatformCodeStub { 2297 class StoreArrayLiteralElementStub : public PlatformCodeStub {
2251 public: 2298 public:
2252 explicit StoreArrayLiteralElementStub(Isolate* isolate) 2299 explicit StoreArrayLiteralElementStub(Isolate* isolate)
2253 : PlatformCodeStub(isolate) { } 2300 : PlatformCodeStub(isolate) { }
2254 2301
2302 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreArrayLiteralElement);
2255 DEFINE_PLATFORM_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub); 2303 DEFINE_PLATFORM_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub);
2256 }; 2304 };
2257 2305
2258 2306
2259 class StubFailureTrampolineStub : public PlatformCodeStub { 2307 class StubFailureTrampolineStub : public PlatformCodeStub {
2260 public: 2308 public:
2261 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) 2309 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode)
2262 : PlatformCodeStub(isolate) { 2310 : PlatformCodeStub(isolate) {
2263 minor_key_ = FunctionModeField::encode(function_mode); 2311 minor_key_ = FunctionModeField::encode(function_mode);
2264 } 2312 }
2265 2313
2266 static void GenerateAheadOfTime(Isolate* isolate); 2314 static void GenerateAheadOfTime(Isolate* isolate);
2267 2315
2268 private: 2316 private:
2269 StubFunctionMode function_mode() const { 2317 StubFunctionMode function_mode() const {
2270 return FunctionModeField::decode(minor_key_); 2318 return FunctionModeField::decode(minor_key_);
2271 } 2319 }
2272 2320
2273 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; 2321 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {};
2274 2322
2323 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
2275 DEFINE_PLATFORM_CODE_STUB(StubFailureTrampoline, PlatformCodeStub); 2324 DEFINE_PLATFORM_CODE_STUB(StubFailureTrampoline, PlatformCodeStub);
2276 }; 2325 };
2277 2326
2278 2327
2279 class ProfileEntryHookStub : public PlatformCodeStub { 2328 class ProfileEntryHookStub : public PlatformCodeStub {
2280 public: 2329 public:
2281 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2330 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2282 2331
2283 // The profile entry hook function is not allowed to cause a GC. 2332 // The profile entry hook function is not allowed to cause a GC.
2284 virtual bool SometimesSetsUpAFrame() { return false; } 2333 virtual bool SometimesSetsUpAFrame() { return false; }
2285 2334
2286 // Generates a call to the entry hook if it's enabled. 2335 // Generates a call to the entry hook if it's enabled.
2287 static void MaybeCallEntryHook(MacroAssembler* masm); 2336 static void MaybeCallEntryHook(MacroAssembler* masm);
2288 2337
2289 private: 2338 private:
2290 static void EntryHookTrampoline(intptr_t function, 2339 static void EntryHookTrampoline(intptr_t function,
2291 intptr_t stack_pointer, 2340 intptr_t stack_pointer,
2292 Isolate* isolate); 2341 Isolate* isolate);
2293 2342
2343 // ProfileEntryHookStub is called at the start of a function, so it has the
2344 // same register set.
2345 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction)
2294 DEFINE_PLATFORM_CODE_STUB(ProfileEntryHook, PlatformCodeStub); 2346 DEFINE_PLATFORM_CODE_STUB(ProfileEntryHook, PlatformCodeStub);
2295 }; 2347 };
2296 2348
2297 2349
2298 class StoreBufferOverflowStub : public PlatformCodeStub { 2350 class StoreBufferOverflowStub : public PlatformCodeStub {
2299 public: 2351 public:
2300 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) 2352 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp)
2301 : PlatformCodeStub(isolate) { 2353 : PlatformCodeStub(isolate) {
2302 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs); 2354 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs);
2303 } 2355 }
2304 2356
2305 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); 2357 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
2306 virtual bool SometimesSetsUpAFrame() { return false; } 2358 virtual bool SometimesSetsUpAFrame() { return false; }
2307 2359
2308 private: 2360 private:
2309 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } 2361 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
2310 2362
2311 class SaveDoublesBits : public BitField<bool, 0, 1> {}; 2363 class SaveDoublesBits : public BitField<bool, 0, 1> {};
2312 2364
2365 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
2313 DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); 2366 DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub);
2314 }; 2367 };
2315 2368
2316 2369
2317 class SubStringStub : public PlatformCodeStub { 2370 class SubStringStub : public PlatformCodeStub {
2318 public: 2371 public:
2319 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2372 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2320 2373
2374 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly);
2321 DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub); 2375 DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub);
2322 }; 2376 };
2323 2377
2324 2378
2325 class StringCompareStub : public PlatformCodeStub { 2379 class StringCompareStub : public PlatformCodeStub {
2326 public: 2380 public:
2327 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2381 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2328 2382
2383 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly);
2329 DEFINE_PLATFORM_CODE_STUB(StringCompare, PlatformCodeStub); 2384 DEFINE_PLATFORM_CODE_STUB(StringCompare, PlatformCodeStub);
2330 }; 2385 };
2331 2386
2332 2387
2333 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR 2388 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR
2334 #undef DEFINE_PLATFORM_CODE_STUB 2389 #undef DEFINE_PLATFORM_CODE_STUB
2335 #undef DEFINE_HANDLER_CODE_STUB 2390 #undef DEFINE_HANDLER_CODE_STUB
2336 #undef DEFINE_HYDROGEN_CODE_STUB 2391 #undef DEFINE_HYDROGEN_CODE_STUB
2337 #undef DEFINE_CODE_STUB 2392 #undef DEFINE_CODE_STUB
2338 #undef DEFINE_CODE_STUB_BASE 2393 #undef DEFINE_CODE_STUB_BASE
2339 } } // namespace v8::internal 2394 } } // namespace v8::internal
2340 2395
2341 #endif // V8_CODE_STUBS_H_ 2396 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ia32/code-stubs-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698