OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 private: | 978 private: |
979 ElementsKind elements_kind_; | 979 ElementsKind elements_kind_; |
980 | 980 |
981 DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub); | 981 DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub); |
982 }; | 982 }; |
983 | 983 |
984 | 984 |
985 class KeyedStoreElementStub : public CodeStub { | 985 class KeyedStoreElementStub : public CodeStub { |
986 public: | 986 public: |
987 KeyedStoreElementStub(bool is_js_array, | 987 KeyedStoreElementStub(bool is_js_array, |
988 ElementsKind elements_kind) | 988 ElementsKind elements_kind, |
989 : is_js_array_(is_js_array), | 989 KeyedAccessGrowMode grow_mode) |
990 elements_kind_(elements_kind) { } | 990 : is_js_array_(is_js_array), |
| 991 elements_kind_(elements_kind), |
| 992 grow_mode_(grow_mode) { } |
991 | 993 |
992 Major MajorKey() { return KeyedStoreElement; } | 994 Major MajorKey() { return KeyedStoreElement; } |
993 int MinorKey() { | 995 int MinorKey() { |
994 return (is_js_array_ ? 0 : kElementsKindCount) + elements_kind_; | 996 return ElementsKindBits::encode(elements_kind_) | |
| 997 IsJSArrayBits::encode(is_js_array_) | |
| 998 GrowModeBits::encode(grow_mode_); |
995 } | 999 } |
996 | 1000 |
997 void Generate(MacroAssembler* masm); | 1001 void Generate(MacroAssembler* masm); |
998 | 1002 |
999 private: | 1003 private: |
| 1004 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1005 class GrowModeBits: public BitField<KeyedAccessGrowMode, 8, 1> {}; |
| 1006 class IsJSArrayBits: public BitField<bool, 9, 1> {}; |
| 1007 |
1000 bool is_js_array_; | 1008 bool is_js_array_; |
1001 ElementsKind elements_kind_; | 1009 ElementsKind elements_kind_; |
| 1010 KeyedAccessGrowMode grow_mode_; |
1002 | 1011 |
1003 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); | 1012 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); |
1004 }; | 1013 }; |
1005 | 1014 |
1006 | 1015 |
1007 class ToBooleanStub: public CodeStub { | 1016 class ToBooleanStub: public CodeStub { |
1008 public: | 1017 public: |
1009 enum Type { | 1018 enum Type { |
1010 UNDEFINED, | 1019 UNDEFINED, |
1011 BOOLEAN, | 1020 BOOLEAN, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 Register tos_; | 1078 Register tos_; |
1070 Types types_; | 1079 Types types_; |
1071 }; | 1080 }; |
1072 | 1081 |
1073 | 1082 |
1074 class ElementsTransitionAndStoreStub : public CodeStub { | 1083 class ElementsTransitionAndStoreStub : public CodeStub { |
1075 public: | 1084 public: |
1076 ElementsTransitionAndStoreStub(ElementsKind from, | 1085 ElementsTransitionAndStoreStub(ElementsKind from, |
1077 ElementsKind to, | 1086 ElementsKind to, |
1078 bool is_jsarray, | 1087 bool is_jsarray, |
1079 StrictModeFlag strict_mode) | 1088 StrictModeFlag strict_mode, |
| 1089 KeyedAccessGrowMode grow_mode) |
1080 : from_(from), | 1090 : from_(from), |
1081 to_(to), | 1091 to_(to), |
1082 is_jsarray_(is_jsarray), | 1092 is_jsarray_(is_jsarray), |
1083 strict_mode_(strict_mode) {} | 1093 strict_mode_(strict_mode), |
| 1094 grow_mode_(grow_mode) {} |
1084 | 1095 |
1085 private: | 1096 private: |
1086 class FromBits: public BitField<ElementsKind, 0, 8> {}; | 1097 class FromBits: public BitField<ElementsKind, 0, 8> {}; |
1087 class ToBits: public BitField<ElementsKind, 8, 8> {}; | 1098 class ToBits: public BitField<ElementsKind, 8, 8> {}; |
1088 class IsJSArrayBits: public BitField<bool, 16, 8> {}; | 1099 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
1089 class StrictModeBits: public BitField<StrictModeFlag, 24, 8> {}; | 1100 class StrictModeBits: public BitField<StrictModeFlag, 17, 1> {}; |
| 1101 class GrowModeBits: public BitField<KeyedAccessGrowMode, 18, 1> {}; |
1090 | 1102 |
1091 Major MajorKey() { return ElementsTransitionAndStore; } | 1103 Major MajorKey() { return ElementsTransitionAndStore; } |
1092 int MinorKey() { | 1104 int MinorKey() { |
1093 return FromBits::encode(from_) | | 1105 return FromBits::encode(from_) | |
1094 ToBits::encode(to_) | | 1106 ToBits::encode(to_) | |
1095 IsJSArrayBits::encode(is_jsarray_) | | 1107 IsJSArrayBits::encode(is_jsarray_) | |
1096 StrictModeBits::encode(strict_mode_); | 1108 StrictModeBits::encode(strict_mode_) | |
| 1109 GrowModeBits::encode(grow_mode_); |
1097 } | 1110 } |
1098 | 1111 |
1099 void Generate(MacroAssembler* masm); | 1112 void Generate(MacroAssembler* masm); |
1100 | 1113 |
1101 ElementsKind from_; | 1114 ElementsKind from_; |
1102 ElementsKind to_; | 1115 ElementsKind to_; |
1103 bool is_jsarray_; | 1116 bool is_jsarray_; |
1104 StrictModeFlag strict_mode_; | 1117 StrictModeFlag strict_mode_; |
| 1118 KeyedAccessGrowMode grow_mode_; |
1105 | 1119 |
1106 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); | 1120 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); |
1107 }; | 1121 }; |
1108 | 1122 |
1109 | 1123 |
1110 class StoreArrayLiteralElementStub : public CodeStub { | 1124 class StoreArrayLiteralElementStub : public CodeStub { |
1111 public: | 1125 public: |
1112 explicit StoreArrayLiteralElementStub() {} | 1126 explicit StoreArrayLiteralElementStub() {} |
1113 | 1127 |
1114 private: | 1128 private: |
1115 Major MajorKey() { return StoreArrayLiteralElement; } | 1129 Major MajorKey() { return StoreArrayLiteralElement; } |
1116 int MinorKey() { return 0; } | 1130 int MinorKey() { return 0; } |
1117 | 1131 |
1118 void Generate(MacroAssembler* masm); | 1132 void Generate(MacroAssembler* masm); |
1119 | 1133 |
1120 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1134 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
1121 }; | 1135 }; |
1122 | 1136 |
1123 } } // namespace v8::internal | 1137 } } // namespace v8::internal |
1124 | 1138 |
1125 #endif // V8_CODE_STUBS_H_ | 1139 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |