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

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

Issue 6894003: Better support for 'polymorphic' JS and external arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with latest Created 9 years, 7 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 V(RevertToNumber) \ 59 V(RevertToNumber) \
60 V(ToBoolean) \ 60 V(ToBoolean) \
61 V(ToNumber) \ 61 V(ToNumber) \
62 V(CounterOp) \ 62 V(CounterOp) \
63 V(ArgumentsAccess) \ 63 V(ArgumentsAccess) \
64 V(RegExpExec) \ 64 V(RegExpExec) \
65 V(RegExpConstructResult) \ 65 V(RegExpConstructResult) \
66 V(NumberToString) \ 66 V(NumberToString) \
67 V(CEntry) \ 67 V(CEntry) \
68 V(JSEntry) \ 68 V(JSEntry) \
69 V(ObjectKeyedLoad) \
70 V(JSArrayKeyedLoad) \
71 V(ObjectKeyedStore) \
72 V(JSArrayKeyedStore) \
73 V(ExternalByteArrayLoad) \
74 V(ExternalUnsignedByteArrayLoad) \
75 V(ExternalShortArrayLoad) \
76 V(ExternalUnsignedShortArrayLoad) \
77 V(ExternalIntArrayLoad) \
78 V(ExternalUnsignedIntArrayLoad) \
79 V(ExternalFloatArrayLoad) \
80 V(ExternalDoubleArrayLoad) \
81 V(ExternalPixelArrayLoad) \
82 V(ExternalByteArrayStore) \
83 V(ExternalUnsignedByteArrayStore) \
84 V(ExternalShortArrayStore) \
85 V(ExternalUnsignedShortArrayStore) \
86 V(ExternalIntArrayStore) \
87 V(ExternalUnsignedIntArrayStore) \
88 V(ExternalFloatArrayStore) \
89 V(ExternalDoubleArrayStore) \
90 V(ExternalPixelArrayStore) \
69 V(DebuggerStatement) \ 91 V(DebuggerStatement) \
70 V(StringDictionaryNegativeLookup) 92 V(StringDictionaryNegativeLookup)
71 93
72 // List of code stubs only used on ARM platforms. 94 // List of code stubs only used on ARM platforms.
73 #ifdef V8_TARGET_ARCH_ARM 95 #ifdef V8_TARGET_ARCH_ARM
74 #define CODE_STUB_LIST_ARM(V) \ 96 #define CODE_STUB_LIST_ARM(V) \
75 V(GetProperty) \ 97 V(GetProperty) \
76 V(SetProperty) \ 98 V(SetProperty) \
77 V(InvokeBuiltin) \ 99 V(InvokeBuiltin) \
78 V(RegExpCEntry) \ 100 V(RegExpCEntry) \
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 masm_->set_allow_stub_calls(previous_allow_); 936 masm_->set_allow_stub_calls(previous_allow_);
915 } 937 }
916 938
917 private: 939 private:
918 MacroAssembler* masm_; 940 MacroAssembler* masm_;
919 bool previous_allow_; 941 bool previous_allow_;
920 942
921 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); 943 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope);
922 }; 944 };
923 945
946 #ifdef DEBUG
947 #define DECLARE_ARRAY_STUB_PRINT(name) void Print() { PrintF(#name); }
948 #else
949 #define DECLARE_ARRAY_STUB_PRINT(name)
950 #endif
951
952
953 class KeyedLoadStub : public CodeStub {
954 public:
955 explicit KeyedLoadStub(bool is_js_array)
956 : is_js_array_(is_js_array) {
957 }
958
959 void Generate(MacroAssembler* masm);
960 private:
961 bool is_js_array_;
962 };
963
964
965 class ObjectKeyedLoadStub: public KeyedLoadStub {
966 public:
967 ObjectKeyedLoadStub() : KeyedLoadStub(false) { }
968
969 private:
970 Major MajorKey() { return ObjectKeyedLoad; }
971 int MinorKey() { return 0; }
972
973 const char* GetName() { return "ObjectKeyedLoadStub"; }
974
975 DECLARE_ARRAY_STUB_PRINT(ObjectKeyedLoadStub)
976 };
977
978
979 class JSArrayKeyedLoadStub: public KeyedLoadStub {
980 public:
981 JSArrayKeyedLoadStub() : KeyedLoadStub(true) { }
982
983 private:
984 Major MajorKey() { return JSArrayKeyedLoad; }
985 int MinorKey() { return 0; }
986
987 const char* GetName() { return "JSArrayKeyedLoadStub"; }
988
989 DECLARE_ARRAY_STUB_PRINT(JSArrayKeyedLoadStub)
990 };
991
992
993 class KeyedStoreStub : public CodeStub {
Mads Ager (chromium) 2011/05/10 13:38:06 Why not just have this one and have a minor key fo
danno 2011/05/11 14:20:19 Yes, that's a really good idea. Should have though
994 public:
995 explicit KeyedStoreStub(bool is_js_array)
996 : is_js_array_(is_js_array) { }
997
998 void Generate(MacroAssembler* masm);
999 private:
1000 bool is_js_array_;
1001 };
1002
1003
1004 class ObjectKeyedStoreStub: public KeyedStoreStub {
1005 public:
1006 ObjectKeyedStoreStub() : KeyedStoreStub(false) { }
1007
1008 private:
1009 Major MajorKey() { return ObjectKeyedStore; }
1010 int MinorKey() { return 0; }
1011
1012 const char* GetName() { return "ObjectKeyedStoreStub"; }
1013
1014 DECLARE_ARRAY_STUB_PRINT(ObjectKeyedStoreStub)
1015 };
1016
1017
1018 class JSArrayKeyedStoreStub: public KeyedStoreStub {
1019 public:
1020 JSArrayKeyedStoreStub() : KeyedStoreStub(true) { }
1021
1022 private:
1023 Major MajorKey() { return JSArrayKeyedStore; }
1024 int MinorKey() { return 0; }
1025
1026 const char* GetName() { return "JSArrayKeyedStoreStub"; }
1027
1028 DECLARE_ARRAY_STUB_PRINT(JSArrayKeyedStoreStub)
1029 };
1030
1031
1032 class ExternalArrayStub : public CodeStub {
1033 public:
1034 explicit ExternalArrayStub(ExternalArrayType array_type)
1035 : array_type_(array_type) { }
1036
1037 Major MajorKey() {
Mads Ager (chromium) 2011/05/10 13:38:06 Just don't implement Major and Minor key?
danno 2011/05/11 14:20:19 Done.
1038 UNREACHABLE();
1039 return static_cast<Major>(0);
1040 }
1041 int MinorKey() {
1042 UNREACHABLE();
1043 return 0;
1044 }
1045
1046 protected:
1047 ExternalArrayType array_type_;
1048 };
1049
1050
1051 class ExternalArrayLoadStub : public ExternalArrayStub {
1052 public:
1053 explicit ExternalArrayLoadStub(ExternalArrayType array_type)
1054 : ExternalArrayStub(array_type) { }
1055
1056 void Generate(MacroAssembler* masm);
1057 };
1058
1059
1060 class ExternalArrayStoreStub : public ExternalArrayStub {
1061 public:
1062 explicit ExternalArrayStoreStub(ExternalArrayType array_type)
1063 : ExternalArrayStub(array_type) { }
1064
1065 void Generate(MacroAssembler* masm);
1066 };
1067
1068
1069 #define DECLARE_EXTERNAL_ARRAY_STUB(op, type) \
Mads Ager (chromium) 2011/05/10 13:38:06 Do you really need all of these different types he
danno 2011/05/11 14:20:19 Done.
1070 class External##type##Array##op##Stub : public ExternalArray##op##Stub {\
1071 public: \
1072 External##type##Array##op##Stub() \
1073 : ExternalArray##op##Stub(k##External##type##Array) { } \
1074 \
1075 private: \
1076 Major MajorKey() { return External##type##Array##op; } \
1077 int MinorKey() { return 0; } \
1078 \
1079 const char* GetName() { return "External" #type "Array" #op; } \
1080 \
1081 DECLARE_ARRAY_STUB_PRINT(External##type##Array##op##Stub) \
1082 }
1083
1084
1085 DECLARE_EXTERNAL_ARRAY_STUB(Load, Byte);
1086 DECLARE_EXTERNAL_ARRAY_STUB(Load, UnsignedByte);
1087 DECLARE_EXTERNAL_ARRAY_STUB(Load, Short);
1088 DECLARE_EXTERNAL_ARRAY_STUB(Load, UnsignedShort);
1089 DECLARE_EXTERNAL_ARRAY_STUB(Load, Int);
1090 DECLARE_EXTERNAL_ARRAY_STUB(Load, UnsignedInt);
1091 DECLARE_EXTERNAL_ARRAY_STUB(Load, Float);
1092 DECLARE_EXTERNAL_ARRAY_STUB(Load, Double);
1093 DECLARE_EXTERNAL_ARRAY_STUB(Load, Pixel);
1094
1095 DECLARE_EXTERNAL_ARRAY_STUB(Store, Byte);
1096 DECLARE_EXTERNAL_ARRAY_STUB(Store, UnsignedByte);
1097 DECLARE_EXTERNAL_ARRAY_STUB(Store, Short);
1098 DECLARE_EXTERNAL_ARRAY_STUB(Store, UnsignedShort);
1099 DECLARE_EXTERNAL_ARRAY_STUB(Store, Int);
1100 DECLARE_EXTERNAL_ARRAY_STUB(Store, UnsignedInt);
1101 DECLARE_EXTERNAL_ARRAY_STUB(Store, Float);
1102 DECLARE_EXTERNAL_ARRAY_STUB(Store, Double);
1103 DECLARE_EXTERNAL_ARRAY_STUB(Store, Pixel);
1104
1105
924 } } // namespace v8::internal 1106 } } // namespace v8::internal
925 1107
926 #endif // V8_CODE_STUBS_H_ 1108 #endif // V8_CODE_STUBS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698