Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 // ---------------------------------------------------------------------------- | 38 // ---------------------------------------------------------------------------- |
| 39 // Static helper functions | 39 // Static helper functions |
| 40 | 40 |
| 41 // Generate a MemOperand for loading a field from an object. | 41 // Generate a MemOperand for loading a field from an object. |
| 42 inline MemOperand FieldMemOperand(Register object, int offset) { | 42 inline MemOperand FieldMemOperand(Register object, int offset) { |
| 43 return MemOperand(object, offset - kHeapObjectTag); | 43 return MemOperand(object, offset - kHeapObjectTag); |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 inline Operand SmiUntagOperand(Register object) { | |
| 48 return Operand(object, ASR, kSmiTagSize); | |
| 49 } | |
| 50 | |
| 51 | |
| 52 | |
| 53 // Give alias names to registers | 47 // Give alias names to registers |
| 54 const Register cp = { 8 }; // JavaScript context pointer | 48 const Register cp = { 8 }; // JavaScript context pointer |
| 55 const Register kRootRegister = { 10 }; // Roots array pointer. | 49 const Register kRootRegister = { 10 }; // Roots array pointer. |
| 56 | 50 |
| 57 // Flags used for AllocateHeapNumber | 51 // Flags used for AllocateHeapNumber |
| 58 enum TaggingMode { | 52 enum TaggingMode { |
| 59 // Tag the result. | 53 // Tag the result. |
| 60 TAG_RESULT, | 54 TAG_RESULT, |
| 61 // Don't tag | 55 // Don't tag |
| 62 DONT_TAG_RESULT | 56 DONT_TAG_RESULT |
| 63 }; | 57 }; |
| 64 | 58 |
| 65 // Flags used for the ObjectToDoubleVFPRegister function. | |
| 66 enum ObjectToDoubleFlags { | |
| 67 // No special flags. | |
| 68 NO_OBJECT_TO_DOUBLE_FLAGS = 0, | |
| 69 // Object is known to be a non smi. | |
| 70 OBJECT_NOT_SMI = 1 << 0, | |
| 71 // Don't load NaNs or infinities, branch to the non number case instead. | |
| 72 AVOID_NANS_AND_INFINITIES = 1 << 1 | |
| 73 }; | |
| 74 | |
| 75 | 59 |
| 76 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; | 60 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; |
| 77 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; | 61 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; |
| 78 enum LinkRegisterStatus { kLRHasNotBeenSaved, kLRHasBeenSaved }; | 62 enum LinkRegisterStatus { kLRHasNotBeenSaved, kLRHasBeenSaved }; |
| 79 | 63 |
| 80 | 64 |
| 81 #ifdef DEBUG | 65 #ifdef DEBUG |
| 82 bool AreAliased(Register reg1, | 66 bool AreAliased(Register reg1, |
| 83 Register reg2, | 67 Register reg2, |
| 84 Register reg3 = no_reg, | 68 Register reg3 = no_reg, |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 967 // Picks out an array index from the hash field. | 951 // Picks out an array index from the hash field. |
| 968 // Register use: | 952 // Register use: |
| 969 // hash - holds the index's hash. Clobbered. | 953 // hash - holds the index's hash. Clobbered. |
| 970 // index - holds the overwritten index on exit. | 954 // index - holds the overwritten index on exit. |
| 971 void IndexFromHash(Register hash, Register index); | 955 void IndexFromHash(Register hash, Register index); |
| 972 | 956 |
| 973 // Get the number of least significant bits from a register | 957 // Get the number of least significant bits from a register |
| 974 void GetLeastBitsFromSmi(Register dst, Register src, int num_least_bits); | 958 void GetLeastBitsFromSmi(Register dst, Register src, int num_least_bits); |
| 975 void GetLeastBitsFromInt32(Register dst, Register src, int mun_least_bits); | 959 void GetLeastBitsFromInt32(Register dst, Register src, int mun_least_bits); |
| 976 | 960 |
| 977 // Uses VFP instructions to Convert a Smi to a double. | 961 // Load the value of a smi object into a double register. |
| 978 void IntegerToDoubleConversionWithVFP3(Register inReg, | 962 // The register value must be between d0 and d15. |
| 979 Register outHighReg, | 963 void SmiToDouble(DwVfpRegister value, Register smi); |
| 980 Register outLowReg); | |
| 981 | |
| 982 // Load the value of a number object into a VFP double register. If the object | |
| 983 // is not a number a jump to the label not_number is performed and the VFP | |
| 984 // double register is unchanged. | |
| 985 void ObjectToDoubleVFPRegister( | |
| 986 Register object, | |
| 987 DwVfpRegister value, | |
| 988 Register scratch1, | |
| 989 Register scratch2, | |
| 990 Register heap_number_map, | |
| 991 SwVfpRegister scratch3, | |
| 992 Label* not_number, | |
| 993 ObjectToDoubleFlags flags = NO_OBJECT_TO_DOUBLE_FLAGS); | |
| 994 | |
| 995 // Load the value of a smi object into a VFP double register. The register | |
| 996 // scratch1 can be the same register as smi in which case smi will hold the | |
| 997 // untagged value afterwards. | |
| 998 void SmiToDoubleVFPRegister(Register smi, | |
| 999 DwVfpRegister value, | |
| 1000 Register scratch1, | |
| 1001 SwVfpRegister scratch2); | |
| 1002 | 964 |
| 1003 // Check if a double can be exactly represented as a signed 32-bit integer. | 965 // Check if a double can be exactly represented as a signed 32-bit integer. |
| 1004 // Z flag set to one if true. | 966 // Z flag set to one if true. |
| 1005 void TestDoubleIsInt32(DwVfpRegister double_input, | 967 void TestDoubleIsInt32(DwVfpRegister double_input, |
| 1006 DwVfpRegister double_scratch); | 968 DwVfpRegister double_scratch); |
| 1007 | 969 |
| 1008 // Try to convert a double to a signed 32-bit integer. | 970 // Try to convert a double to a signed 32-bit integer. |
| 1009 // Z flag set to one and result assigned if the conversion is exact. | 971 // Z flag set to one and result assigned if the conversion is exact. |
| 1010 void TryDoubleToInt32Exact(Register result, | 972 void TryDoubleToInt32Exact(Register result, |
| 1011 DwVfpRegister double_input, | 973 DwVfpRegister double_input, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1221 void SmiTag(Register reg, SBit s = LeaveCC) { | 1183 void SmiTag(Register reg, SBit s = LeaveCC) { |
| 1222 add(reg, reg, Operand(reg), s); | 1184 add(reg, reg, Operand(reg), s); |
| 1223 } | 1185 } |
| 1224 void SmiTag(Register dst, Register src, SBit s = LeaveCC) { | 1186 void SmiTag(Register dst, Register src, SBit s = LeaveCC) { |
| 1225 add(dst, src, Operand(src), s); | 1187 add(dst, src, Operand(src), s); |
| 1226 } | 1188 } |
| 1227 | 1189 |
| 1228 // Try to convert int32 to smi. If the value is to large, preserve | 1190 // Try to convert int32 to smi. If the value is to large, preserve |
| 1229 // the original value and jump to not_a_smi. Destroys scratch and | 1191 // the original value and jump to not_a_smi. Destroys scratch and |
| 1230 // sets flags. | 1192 // sets flags. |
| 1231 void TrySmiTag(Register reg, Label* not_a_smi, Register scratch) { | 1193 void TrySmiTag(Register reg, Label* not_a_smi) { |
| 1232 mov(scratch, reg); | 1194 TrySmiTag(reg, reg, not_a_smi); |
| 1233 SmiTag(scratch, SetCC); | 1195 } |
| 1196 void TrySmiTag(Register reg, Register src, Label* not_a_smi) { | |
|
ulan
2013/05/17 09:57:14
What do you think about passing explicit scratch r
Rodolph Perfetta
2013/05/17 11:44:55
If these macro are used in crankshaft then you may
| |
| 1197 SmiTag(ip, src, SetCC); | |
| 1234 b(vs, not_a_smi); | 1198 b(vs, not_a_smi); |
| 1235 mov(reg, scratch); | 1199 mov(reg, ip); |
| 1236 } | 1200 } |
| 1237 | 1201 |
| 1202 | |
| 1238 void SmiUntag(Register reg, SBit s = LeaveCC) { | 1203 void SmiUntag(Register reg, SBit s = LeaveCC) { |
| 1239 mov(reg, Operand(reg, ASR, kSmiTagSize), s); | 1204 mov(reg, Operand::SmiUntag(reg), s); |
| 1240 } | 1205 } |
| 1241 void SmiUntag(Register dst, Register src, SBit s = LeaveCC) { | 1206 void SmiUntag(Register dst, Register src, SBit s = LeaveCC) { |
| 1242 mov(dst, Operand(src, ASR, kSmiTagSize), s); | 1207 mov(dst, Operand::SmiUntag(src), s); |
| 1243 } | 1208 } |
| 1244 | 1209 |
| 1245 // Untag the source value into destination and jump if source is a smi. | 1210 // Untag the source value into destination and jump if source is a smi. |
| 1246 // Souce and destination can be the same register. | 1211 // Souce and destination can be the same register. |
| 1247 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); | 1212 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); |
| 1248 | 1213 |
| 1249 // Untag the source value into destination and jump if source is not a smi. | 1214 // Untag the source value into destination and jump if source is not a smi. |
| 1250 // Souce and destination can be the same register. | 1215 // Souce and destination can be the same register. |
| 1251 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); | 1216 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); |
| 1252 | 1217 |
| 1218 // Test if the register contains a smi (Z == 0 (eq) if true). | |
| 1219 inline void SmiTst(Register value) { | |
| 1220 tst(value, Operand(kSmiTagMask)); | |
| 1221 } | |
| 1222 inline void NonNegativeSmiTst(Register value) { | |
| 1223 tst(value, Operand(kSmiTagMask | kSmiSignMask)); | |
| 1224 } | |
| 1253 // Jump if the register contains a smi. | 1225 // Jump if the register contains a smi. |
| 1254 inline void JumpIfSmi(Register value, Label* smi_label) { | 1226 inline void JumpIfSmi(Register value, Label* smi_label) { |
| 1255 tst(value, Operand(kSmiTagMask)); | 1227 tst(value, Operand(kSmiTagMask)); |
| 1256 b(eq, smi_label); | 1228 b(eq, smi_label); |
| 1257 } | 1229 } |
| 1258 // Jump if either of the registers contain a non-smi. | 1230 // Jump if either of the registers contain a non-smi. |
| 1259 inline void JumpIfNotSmi(Register value, Label* not_smi_label) { | 1231 inline void JumpIfNotSmi(Register value, Label* not_smi_label) { |
| 1260 tst(value, Operand(kSmiTagMask)); | 1232 tst(value, Operand(kSmiTagMask)); |
| 1261 b(ne, not_smi_label); | 1233 b(ne, not_smi_label); |
| 1262 } | 1234 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1474 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1446 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1475 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1447 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1476 #else | 1448 #else |
| 1477 #define ACCESS_MASM(masm) masm-> | 1449 #define ACCESS_MASM(masm) masm-> |
| 1478 #endif | 1450 #endif |
| 1479 | 1451 |
| 1480 | 1452 |
| 1481 } } // namespace v8::internal | 1453 } } // namespace v8::internal |
| 1482 | 1454 |
| 1483 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1455 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |