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

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

Issue 132373011: A64: Synchronize with r17635. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/builtins.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 25 matching lines...) Expand all
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 // List of code stubs used on all platforms. 40 // List of code stubs used on all platforms.
41 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ 41 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \
42 V(CallFunction) \ 42 V(CallFunction) \
43 V(CallConstruct) \ 43 V(CallConstruct) \
44 V(BinaryOp) \ 44 V(BinaryOp) \
45 V(StringAdd) \ 45 V(StringAdd) \
46 V(NewStringAdd) \
46 V(SubString) \ 47 V(SubString) \
47 V(StringCompare) \ 48 V(StringCompare) \
48 V(Compare) \ 49 V(Compare) \
49 V(CompareIC) \ 50 V(CompareIC) \
50 V(CompareNilIC) \ 51 V(CompareNilIC) \
51 V(MathPow) \ 52 V(MathPow) \
52 V(StringLength) \ 53 V(StringLength) \
53 V(FunctionPrototype) \ 54 V(FunctionPrototype) \
54 V(StoreArrayLength) \ 55 V(StoreArrayLength) \
55 V(RecordWrite) \ 56 V(RecordWrite) \
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 555
555 void Generate(MacroAssembler* masm); 556 void Generate(MacroAssembler* masm);
556 557
557 private: 558 private:
558 int slots_; 559 int slots_;
559 560
560 Major MajorKey() { return FastNewBlockContext; } 561 Major MajorKey() { return FastNewBlockContext; }
561 int MinorKey() { return slots_; } 562 int MinorKey() { return slots_; }
562 }; 563 };
563 564
564 class StoreGlobalStub : public HydrogenCodeStub {
565 public:
566 StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) {
567 bit_field_ = StrictModeBits::encode(strict_mode) |
568 IsConstantBits::encode(is_constant);
569 }
570
571 virtual Handle<Code> GenerateCode(Isolate* isolate);
572
573 virtual void InitializeInterfaceDescriptor(
574 Isolate* isolate,
575 CodeStubInterfaceDescriptor* descriptor);
576
577 virtual Code::Kind GetCodeKind() const { return Code::STORE_IC; }
578 virtual InlineCacheState GetICState() { return MONOMORPHIC; }
579 virtual Code::ExtraICState GetExtraICState() { return bit_field_; }
580
581 bool is_constant() {
582 return IsConstantBits::decode(bit_field_);
583 }
584 void set_is_constant(bool value) {
585 bit_field_ = IsConstantBits::update(bit_field_, value);
586 }
587
588 Representation representation() {
589 return Representation::FromKind(RepresentationBits::decode(bit_field_));
590 }
591 void set_representation(Representation r) {
592 bit_field_ = RepresentationBits::update(bit_field_, r.kind());
593 }
594
595 private:
596 virtual int NotMissMinorKey() { return GetExtraICState(); }
597 Major MajorKey() { return StoreGlobal; }
598
599 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {};
600 class IsConstantBits: public BitField<bool, 1, 1> {};
601 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {};
602
603 int bit_field_;
604
605 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
606 };
607
608
609 class FastCloneShallowArrayStub : public HydrogenCodeStub { 565 class FastCloneShallowArrayStub : public HydrogenCodeStub {
610 public: 566 public:
611 // Maximum length of copied elements array. 567 // Maximum length of copied elements array.
612 static const int kMaximumClonedLength = 8; 568 static const int kMaximumClonedLength = 8;
613 enum Mode { 569 enum Mode {
614 CLONE_ELEMENTS, 570 CLONE_ELEMENTS,
615 CLONE_DOUBLE_ELEMENTS, 571 CLONE_DOUBLE_ELEMENTS,
616 COPY_ON_WRITE_ELEMENTS, 572 COPY_ON_WRITE_ELEMENTS,
617 CLONE_ANY_ELEMENTS, 573 CLONE_ANY_ELEMENTS,
618 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS 574 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 virtual CodeStub::Major MajorKey() { return StoreArrayLength; } 856 virtual CodeStub::Major MajorKey() { return StoreArrayLength; }
901 }; 857 };
902 858
903 859
904 class HICStub: public HydrogenCodeStub { 860 class HICStub: public HydrogenCodeStub {
905 public: 861 public:
906 virtual Code::Kind GetCodeKind() const { return kind(); } 862 virtual Code::Kind GetCodeKind() const { return kind(); }
907 virtual InlineCacheState GetICState() { return MONOMORPHIC; } 863 virtual InlineCacheState GetICState() { return MONOMORPHIC; }
908 864
909 protected: 865 protected:
910 HICStub() { }
911 class KindBits: public BitField<Code::Kind, 0, 4> {}; 866 class KindBits: public BitField<Code::Kind, 0, 4> {};
912 virtual Code::Kind kind() const = 0; 867 virtual Code::Kind kind() const = 0;
913 }; 868 };
914 869
915 870
916 class HandlerStub: public HICStub { 871 class HandlerStub: public HICStub {
917 public: 872 public:
918 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 873 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
919 virtual int GetStubFlags() { return kind(); } 874 virtual int GetStubFlags() { return kind(); }
920
921 protected:
922 HandlerStub() : HICStub() { }
923 }; 875 };
924 876
925 877
926 class LoadFieldStub: public HandlerStub { 878 class LoadFieldStub: public HandlerStub {
927 public: 879 public:
928 LoadFieldStub(bool inobject, int index, Representation representation) 880 LoadFieldStub(bool inobject, int index, Representation representation) {
929 : HandlerStub() {
930 Initialize(Code::LOAD_IC, inobject, index, representation); 881 Initialize(Code::LOAD_IC, inobject, index, representation);
931 } 882 }
932 883
933 virtual Handle<Code> GenerateCode(Isolate* isolate); 884 virtual Handle<Code> GenerateCode(Isolate* isolate);
934 885
935 virtual void InitializeInterfaceDescriptor( 886 virtual void InitializeInterfaceDescriptor(
936 Isolate* isolate, 887 Isolate* isolate,
937 CodeStubInterfaceDescriptor* descriptor); 888 CodeStubInterfaceDescriptor* descriptor);
938 889
939 Representation representation() { 890 Representation representation() {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 class InobjectBits: public BitField<bool, 4, 1> {}; 932 class InobjectBits: public BitField<bool, 4, 1> {};
982 class IndexBits: public BitField<int, 5, 11> {}; 933 class IndexBits: public BitField<int, 5, 11> {};
983 class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; 934 class UnboxedDoubleBits: public BitField<bool, 16, 1> {};
984 virtual CodeStub::Major MajorKey() { return LoadField; } 935 virtual CodeStub::Major MajorKey() { return LoadField; }
985 virtual int NotMissMinorKey() { return bit_field_; } 936 virtual int NotMissMinorKey() { return bit_field_; }
986 937
987 int bit_field_; 938 int bit_field_;
988 }; 939 };
989 940
990 941
942 class StoreGlobalStub : public HandlerStub {
943 public:
944 StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) {
945 bit_field_ = StrictModeBits::encode(strict_mode) |
946 IsConstantBits::encode(is_constant);
947 }
948
949 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate,
950 Map* receiver_map,
951 PropertyCell* cell) {
952 Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate);
953 // Replace the placeholder cell and global object map with the actual global
954 // cell and receiver map.
955 Map* cell_map = isolate->heap()->global_property_cell_map();
956 code->ReplaceNthObject(1, cell_map, cell);
957 code->ReplaceNthObject(1, isolate->heap()->meta_map(), receiver_map);
958 return code;
959 }
960
961 virtual Code::Kind kind() const { return Code::STORE_IC; }
962
963 virtual Handle<Code> GenerateCode(Isolate* isolate);
964
965 virtual void InitializeInterfaceDescriptor(
966 Isolate* isolate,
967 CodeStubInterfaceDescriptor* descriptor);
968
969 virtual Code::ExtraICState GetExtraICState() { return bit_field_; }
970
971 bool is_constant() {
972 return IsConstantBits::decode(bit_field_);
973 }
974 void set_is_constant(bool value) {
975 bit_field_ = IsConstantBits::update(bit_field_, value);
976 }
977
978 Representation representation() {
979 return Representation::FromKind(RepresentationBits::decode(bit_field_));
980 }
981 void set_representation(Representation r) {
982 bit_field_ = RepresentationBits::update(bit_field_, r.kind());
983 }
984
985 private:
986 virtual int NotMissMinorKey() { return GetExtraICState(); }
987 Major MajorKey() { return StoreGlobal; }
988
989 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {};
990 class IsConstantBits: public BitField<bool, 1, 1> {};
991 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {};
992
993 int bit_field_;
994
995 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
996 };
997
998
991 class KeyedLoadFieldStub: public LoadFieldStub { 999 class KeyedLoadFieldStub: public LoadFieldStub {
992 public: 1000 public:
993 KeyedLoadFieldStub(bool inobject, int index, Representation representation) 1001 KeyedLoadFieldStub(bool inobject, int index, Representation representation)
994 : LoadFieldStub() { 1002 : LoadFieldStub() {
995 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation); 1003 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation);
996 } 1004 }
997 1005
998 virtual void InitializeInterfaceDescriptor( 1006 virtual void InitializeInterfaceDescriptor(
999 Isolate* isolate, 1007 Isolate* isolate,
1000 CodeStubInterfaceDescriptor* descriptor); 1008 CodeStubInterfaceDescriptor* descriptor);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 Token::Value op_; 1181 Token::Value op_;
1174 OverwriteMode mode_; 1182 OverwriteMode mode_;
1175 1183
1176 Maybe<int> fixed_right_arg_; 1184 Maybe<int> fixed_right_arg_;
1177 State left_state_; 1185 State left_state_;
1178 State right_state_; 1186 State right_state_;
1179 State result_state_; 1187 State result_state_;
1180 }; 1188 };
1181 1189
1182 1190
1191 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub.
1192 class NewStringAddStub V8_FINAL : public HydrogenCodeStub {
1193 public:
1194 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag)
1195 : bit_field_(StringAddFlagsBits::encode(flags) |
1196 PretenureFlagBits::encode(pretenure_flag)) {}
1197
1198 StringAddFlags flags() const {
1199 return StringAddFlagsBits::decode(bit_field_);
1200 }
1201
1202 PretenureFlag pretenure_flag() const {
1203 return PretenureFlagBits::decode(bit_field_);
1204 }
1205
1206 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1207
1208 virtual void InitializeInterfaceDescriptor(
1209 Isolate* isolate,
1210 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1211
1212 static void InstallDescriptors(Isolate* isolate);
1213
1214 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1215 static const int kLeft = 0;
1216 static const int kRight = 1;
1217
1218 private:
1219 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
1220 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
1221 uint32_t bit_field_;
1222
1223 virtual Major MajorKey() V8_OVERRIDE { return NewStringAdd; }
1224 virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; }
1225
1226 virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE;
1227
1228 DISALLOW_COPY_AND_ASSIGN(NewStringAddStub);
1229 };
1230
1231
1183 class ICCompareStub: public PlatformCodeStub { 1232 class ICCompareStub: public PlatformCodeStub {
1184 public: 1233 public:
1185 ICCompareStub(Token::Value op, 1234 ICCompareStub(Token::Value op,
1186 CompareIC::State left, 1235 CompareIC::State left,
1187 CompareIC::State right, 1236 CompareIC::State right,
1188 CompareIC::State handler) 1237 CompareIC::State handler)
1189 : op_(op), 1238 : op_(op),
1190 left_(left), 1239 left_(left),
1191 right_(right), 1240 right_(right),
1192 state_(handler) { 1241 state_(handler) {
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 int MinorKey() { return 0; } 2438 int MinorKey() { return 0; }
2390 2439
2391 void Generate(MacroAssembler* masm); 2440 void Generate(MacroAssembler* masm);
2392 2441
2393 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2442 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2394 }; 2443 };
2395 2444
2396 } } // namespace v8::internal 2445 } } // namespace v8::internal
2397 2446
2398 #endif // V8_CODE_STUBS_H_ 2447 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698