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