OLD | NEW |
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // GC. This means that we must be statically sure that no GC can occur while | 155 // GC. This means that we must be statically sure that no GC can occur while |
156 // they are running. If that is the case they should override this to return | 156 // they are running. If that is the case they should override this to return |
157 // true, which will cause an assertion if we try to call something that can | 157 // true, which will cause an assertion if we try to call something that can |
158 // GC or if we try to put a stack frame on top of the junk, which would not | 158 // GC or if we try to put a stack frame on top of the junk, which would not |
159 // result in a traversable stack. | 159 // result in a traversable stack. |
160 virtual bool SometimesSetsUpAFrame() { return true; } | 160 virtual bool SometimesSetsUpAFrame() { return true; } |
161 | 161 |
162 // Lookup the code in the (possibly custom) cache. | 162 // Lookup the code in the (possibly custom) cache. |
163 bool FindCodeInCache(Code** code_out); | 163 bool FindCodeInCache(Code** code_out); |
164 | 164 |
| 165 protected: |
| 166 static bool CanUseFPRegisters(); |
| 167 |
165 private: | 168 private: |
166 // Nonvirtual wrapper around the stub-specific Generate function. Call | 169 // Nonvirtual wrapper around the stub-specific Generate function. Call |
167 // this function to set up the macro assembler and generate the code. | 170 // this function to set up the macro assembler and generate the code. |
168 void GenerateCode(MacroAssembler* masm); | 171 void GenerateCode(MacroAssembler* masm); |
169 | 172 |
170 // Generates the assembler code for the stub. | 173 // Generates the assembler code for the stub. |
171 virtual void Generate(MacroAssembler* masm) = 0; | 174 virtual void Generate(MacroAssembler* masm) = 0; |
172 | 175 |
173 // Perform bookkeeping required after code generation when stub code is | 176 // Perform bookkeeping required after code generation when stub code is |
174 // initially generated. | 177 // initially generated. |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 }; | 994 }; |
992 | 995 |
993 | 996 |
994 class KeyedStoreElementStub : public CodeStub { | 997 class KeyedStoreElementStub : public CodeStub { |
995 public: | 998 public: |
996 KeyedStoreElementStub(bool is_js_array, | 999 KeyedStoreElementStub(bool is_js_array, |
997 ElementsKind elements_kind, | 1000 ElementsKind elements_kind, |
998 KeyedAccessGrowMode grow_mode) | 1001 KeyedAccessGrowMode grow_mode) |
999 : is_js_array_(is_js_array), | 1002 : is_js_array_(is_js_array), |
1000 elements_kind_(elements_kind), | 1003 elements_kind_(elements_kind), |
1001 grow_mode_(grow_mode) { } | 1004 grow_mode_(grow_mode), |
| 1005 fp_registers_(CanUseFPRegisters()) { } |
1002 | 1006 |
1003 Major MajorKey() { return KeyedStoreElement; } | 1007 Major MajorKey() { return KeyedStoreElement; } |
1004 int MinorKey() { | 1008 int MinorKey() { |
1005 return ElementsKindBits::encode(elements_kind_) | | 1009 return ElementsKindBits::encode(elements_kind_) | |
1006 IsJSArrayBits::encode(is_js_array_) | | 1010 IsJSArrayBits::encode(is_js_array_) | |
1007 GrowModeBits::encode(grow_mode_); | 1011 GrowModeBits::encode(grow_mode_) | |
| 1012 FPRegisters::encode(fp_registers_); |
1008 } | 1013 } |
1009 | 1014 |
1010 void Generate(MacroAssembler* masm); | 1015 void Generate(MacroAssembler* masm); |
1011 | 1016 |
1012 private: | 1017 private: |
1013 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1018 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
1014 class GrowModeBits: public BitField<KeyedAccessGrowMode, 8, 1> {}; | 1019 class GrowModeBits: public BitField<KeyedAccessGrowMode, 8, 1> {}; |
1015 class IsJSArrayBits: public BitField<bool, 9, 1> {}; | 1020 class IsJSArrayBits: public BitField<bool, 9, 1> {}; |
| 1021 class FPRegisters: public BitField<bool, 10, 1> {}; |
1016 | 1022 |
1017 bool is_js_array_; | 1023 bool is_js_array_; |
1018 ElementsKind elements_kind_; | 1024 ElementsKind elements_kind_; |
1019 KeyedAccessGrowMode grow_mode_; | 1025 KeyedAccessGrowMode grow_mode_; |
| 1026 bool fp_registers_; |
1020 | 1027 |
1021 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); | 1028 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); |
1022 }; | 1029 }; |
1023 | 1030 |
1024 | 1031 |
1025 class ToBooleanStub: public CodeStub { | 1032 class ToBooleanStub: public CodeStub { |
1026 public: | 1033 public: |
1027 enum Type { | 1034 enum Type { |
1028 UNDEFINED, | 1035 UNDEFINED, |
1029 BOOLEAN, | 1036 BOOLEAN, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 bool is_jsarray_; | 1132 bool is_jsarray_; |
1126 StrictModeFlag strict_mode_; | 1133 StrictModeFlag strict_mode_; |
1127 KeyedAccessGrowMode grow_mode_; | 1134 KeyedAccessGrowMode grow_mode_; |
1128 | 1135 |
1129 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); | 1136 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); |
1130 }; | 1137 }; |
1131 | 1138 |
1132 | 1139 |
1133 class StoreArrayLiteralElementStub : public CodeStub { | 1140 class StoreArrayLiteralElementStub : public CodeStub { |
1134 public: | 1141 public: |
1135 explicit StoreArrayLiteralElementStub() {} | 1142 StoreArrayLiteralElementStub() |
| 1143 : fp_registers_(CanUseFPRegisters()) { } |
1136 | 1144 |
1137 private: | 1145 private: |
| 1146 class FPRegisters: public BitField<bool, 0, 1> {}; |
| 1147 |
1138 Major MajorKey() { return StoreArrayLiteralElement; } | 1148 Major MajorKey() { return StoreArrayLiteralElement; } |
1139 int MinorKey() { return 0; } | 1149 int MinorKey() { return FPRegisters::encode(fp_registers_); } |
1140 | 1150 |
1141 void Generate(MacroAssembler* masm); | 1151 void Generate(MacroAssembler* masm); |
1142 | 1152 |
| 1153 bool fp_registers_; |
| 1154 |
1143 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1155 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
1144 }; | 1156 }; |
1145 | 1157 |
1146 | 1158 |
1147 class ProfileEntryHookStub : public CodeStub { | 1159 class ProfileEntryHookStub : public CodeStub { |
1148 public: | 1160 public: |
1149 explicit ProfileEntryHookStub() {} | 1161 explicit ProfileEntryHookStub() {} |
1150 | 1162 |
1151 // The profile entry hook function is not allowed to cause a GC. | 1163 // The profile entry hook function is not allowed to cause a GC. |
1152 virtual bool SometimesSetsUpAFrame() { return false; } | 1164 virtual bool SometimesSetsUpAFrame() { return false; } |
(...skipping 17 matching lines...) Expand all Loading... |
1170 | 1182 |
1171 // The current function entry hook. | 1183 // The current function entry hook. |
1172 static FunctionEntryHook entry_hook_; | 1184 static FunctionEntryHook entry_hook_; |
1173 | 1185 |
1174 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1186 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1175 }; | 1187 }; |
1176 | 1188 |
1177 } } // namespace v8::internal | 1189 } } // namespace v8::internal |
1178 | 1190 |
1179 #endif // V8_CODE_STUBS_H_ | 1191 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |