OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 void SmiCompareInteger32(const Operand& dst, Register src); | 258 void SmiCompareInteger32(const Operand& dst, Register src); |
259 // Sets sign and zero flags depending on value of smi in register. | 259 // Sets sign and zero flags depending on value of smi in register. |
260 void SmiTest(Register src); | 260 void SmiTest(Register src); |
261 | 261 |
262 // Functions performing a check on a known or potential smi. Returns | 262 // Functions performing a check on a known or potential smi. Returns |
263 // a condition that is satisfied if the check is successful. | 263 // a condition that is satisfied if the check is successful. |
264 | 264 |
265 // Is the value a tagged smi. | 265 // Is the value a tagged smi. |
266 Condition CheckSmi(Register src); | 266 Condition CheckSmi(Register src); |
267 | 267 |
268 // Is the value a positive tagged smi. | 268 // Is the value a non-negative tagged smi. |
269 Condition CheckPositiveSmi(Register src); | 269 Condition CheckNonNegativeSmi(Register src); |
270 | 270 |
271 // Are both values tagged smis. | 271 // Are both values tagged smis. |
272 Condition CheckBothSmi(Register first, Register second); | 272 Condition CheckBothSmi(Register first, Register second); |
273 | 273 |
274 // Are both values tagged smis. | 274 // Are both values non-negative tagged smis. |
275 Condition CheckBothPositiveSmi(Register first, Register second); | 275 Condition CheckBothNonNegativeSmi(Register first, Register second); |
276 | 276 |
277 // Are either value a tagged smi. | 277 // Are either value a tagged smi. |
278 Condition CheckEitherSmi(Register first, | 278 Condition CheckEitherSmi(Register first, |
279 Register second, | 279 Register second, |
280 Register scratch = kScratchRegister); | 280 Register scratch = kScratchRegister); |
281 | 281 |
282 // Is the value the minimum smi value (since we are using | 282 // Is the value the minimum smi value (since we are using |
283 // two's complement numbers, negating the value is known to yield | 283 // two's complement numbers, negating the value is known to yield |
284 // a non-smi value). | 284 // a non-smi value). |
285 Condition CheckIsMinSmi(Register src); | 285 Condition CheckIsMinSmi(Register src); |
(...skipping 18 matching lines...) Expand all Loading... |
304 void JumpIfUIntNotValidSmiValue(Register src, LabelType* on_invalid); | 304 void JumpIfUIntNotValidSmiValue(Register src, LabelType* on_invalid); |
305 | 305 |
306 // Jump to label if the value is a tagged smi. | 306 // Jump to label if the value is a tagged smi. |
307 template <typename LabelType> | 307 template <typename LabelType> |
308 void JumpIfSmi(Register src, LabelType* on_smi); | 308 void JumpIfSmi(Register src, LabelType* on_smi); |
309 | 309 |
310 // Jump to label if the value is not a tagged smi. | 310 // Jump to label if the value is not a tagged smi. |
311 template <typename LabelType> | 311 template <typename LabelType> |
312 void JumpIfNotSmi(Register src, LabelType* on_not_smi); | 312 void JumpIfNotSmi(Register src, LabelType* on_not_smi); |
313 | 313 |
314 // Jump to label if the value is not a positive tagged smi. | 314 // Jump to label if the value is not a non-negative tagged smi. |
315 template <typename LabelType> | 315 template <typename LabelType> |
316 void JumpIfNotPositiveSmi(Register src, LabelType* on_not_smi); | 316 void JumpUnlessNonNegativeSmi(Register src, LabelType* on_not_smi); |
317 | 317 |
318 // Jump to label if the value, which must be a tagged smi, has value equal | 318 // Jump to label if the value, which must be a tagged smi, has value equal |
319 // to the constant. | 319 // to the constant. |
320 template <typename LabelType> | 320 template <typename LabelType> |
321 void JumpIfSmiEqualsConstant(Register src, | 321 void JumpIfSmiEqualsConstant(Register src, |
322 Smi* constant, | 322 Smi* constant, |
323 LabelType* on_equals); | 323 LabelType* on_equals); |
324 | 324 |
325 // Jump if either or both register are not smi values. | 325 // Jump if either or both register are not smi values. |
326 template <typename LabelType> | 326 template <typename LabelType> |
327 void JumpIfNotBothSmi(Register src1, | 327 void JumpIfNotBothSmi(Register src1, |
328 Register src2, | 328 Register src2, |
329 LabelType* on_not_both_smi); | 329 LabelType* on_not_both_smi); |
330 | 330 |
331 // Jump if either or both register are not positive smi values. | 331 // Jump if either or both register are not non-negative smi values. |
332 template <typename LabelType> | 332 template <typename LabelType> |
333 void JumpIfNotBothPositiveSmi(Register src1, Register src2, | 333 void JumpUnlessBothNonNegativeSmi(Register src1, Register src2, |
334 LabelType* on_not_both_smi); | 334 LabelType* on_not_both_smi); |
335 | 335 |
336 // Operations on tagged smi values. | 336 // Operations on tagged smi values. |
337 | 337 |
338 // Smis represent a subset of integers. The subset is always equivalent to | 338 // Smis represent a subset of integers. The subset is always equivalent to |
339 // a two's complement interpretation of a fixed number of bits. | 339 // a two's complement interpretation of a fixed number of bits. |
340 | 340 |
341 // Optimistically adds an integer constant to a supposed smi. | 341 // Optimistically adds an integer constant to a supposed smi. |
342 // If the src is not a smi, or the result is not a smi, jump to | 342 // If the src is not a smi, or the result is not a smi, jump to |
343 // the label. | 343 // the label. |
344 template <typename LabelType> | 344 template <typename LabelType> |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 | 1456 |
1457 | 1457 |
1458 template <typename LabelType> | 1458 template <typename LabelType> |
1459 void MacroAssembler::JumpIfNotSmi(Register src, LabelType* on_not_smi) { | 1459 void MacroAssembler::JumpIfNotSmi(Register src, LabelType* on_not_smi) { |
1460 Condition smi = CheckSmi(src); | 1460 Condition smi = CheckSmi(src); |
1461 j(NegateCondition(smi), on_not_smi); | 1461 j(NegateCondition(smi), on_not_smi); |
1462 } | 1462 } |
1463 | 1463 |
1464 | 1464 |
1465 template <typename LabelType> | 1465 template <typename LabelType> |
1466 void MacroAssembler::JumpIfNotPositiveSmi(Register src, | 1466 void MacroAssembler::JumpUnlessNonNegativeSmi( |
1467 LabelType* on_not_positive_smi) { | 1467 Register src, LabelType* on_not_smi_or_negative) { |
1468 Condition positive_smi = CheckPositiveSmi(src); | 1468 Condition non_negative_smi = CheckNonNegativeSmi(src); |
1469 j(NegateCondition(positive_smi), on_not_positive_smi); | 1469 j(NegateCondition(non_negative_smi), on_not_smi_or_negative); |
1470 } | 1470 } |
1471 | 1471 |
1472 | 1472 |
1473 template <typename LabelType> | 1473 template <typename LabelType> |
1474 void MacroAssembler::JumpIfSmiEqualsConstant(Register src, | 1474 void MacroAssembler::JumpIfSmiEqualsConstant(Register src, |
1475 Smi* constant, | 1475 Smi* constant, |
1476 LabelType* on_equals) { | 1476 LabelType* on_equals) { |
1477 SmiCompare(src, constant); | 1477 SmiCompare(src, constant); |
1478 j(equal, on_equals); | 1478 j(equal, on_equals); |
1479 } | 1479 } |
(...skipping 18 matching lines...) Expand all Loading... |
1498 template <typename LabelType> | 1498 template <typename LabelType> |
1499 void MacroAssembler::JumpIfNotBothSmi(Register src1, | 1499 void MacroAssembler::JumpIfNotBothSmi(Register src1, |
1500 Register src2, | 1500 Register src2, |
1501 LabelType* on_not_both_smi) { | 1501 LabelType* on_not_both_smi) { |
1502 Condition both_smi = CheckBothSmi(src1, src2); | 1502 Condition both_smi = CheckBothSmi(src1, src2); |
1503 j(NegateCondition(both_smi), on_not_both_smi); | 1503 j(NegateCondition(both_smi), on_not_both_smi); |
1504 } | 1504 } |
1505 | 1505 |
1506 | 1506 |
1507 template <typename LabelType> | 1507 template <typename LabelType> |
1508 void MacroAssembler::JumpIfNotBothPositiveSmi(Register src1, | 1508 void MacroAssembler::JumpUnlessBothNonNegativeSmi(Register src1, |
1509 Register src2, | 1509 Register src2, |
1510 LabelType* on_not_both_smi) { | 1510 LabelType* on_not_both_smi) { |
1511 Condition both_smi = CheckBothPositiveSmi(src1, src2); | 1511 Condition both_smi = CheckBothNonNegativeSmi(src1, src2); |
1512 j(NegateCondition(both_smi), on_not_both_smi); | 1512 j(NegateCondition(both_smi), on_not_both_smi); |
1513 } | 1513 } |
1514 | 1514 |
1515 | 1515 |
1516 template <typename LabelType> | 1516 template <typename LabelType> |
1517 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first_object, | 1517 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first_object, |
1518 Register second_object, | 1518 Register second_object, |
1519 Register scratch1, | 1519 Register scratch1, |
1520 Register scratch2, | 1520 Register scratch2, |
1521 LabelType* on_fail) { | 1521 LabelType* on_fail) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 Jump(adaptor, RelocInfo::CODE_TARGET); | 1690 Jump(adaptor, RelocInfo::CODE_TARGET); |
1691 } | 1691 } |
1692 bind(&invoke); | 1692 bind(&invoke); |
1693 } | 1693 } |
1694 } | 1694 } |
1695 | 1695 |
1696 | 1696 |
1697 } } // namespace v8::internal | 1697 } } // namespace v8::internal |
1698 | 1698 |
1699 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1699 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |