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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 void MacroAssembler::JumpIfSmiEqualsConstant(Register src, | 512 void MacroAssembler::JumpIfSmiEqualsConstant(Register src, |
513 int constant, | 513 int constant, |
514 Label* on_equals) { | 514 Label* on_equals) { |
515 if (Smi::IsValid(constant)) { | 515 if (Smi::IsValid(constant)) { |
516 Condition are_equal = CheckSmiEqualsConstant(src, constant); | 516 Condition are_equal = CheckSmiEqualsConstant(src, constant); |
517 j(are_equal, on_equals); | 517 j(are_equal, on_equals); |
518 } | 518 } |
519 } | 519 } |
520 | 520 |
521 | 521 |
| 522 void MacroAssembler::JumpIfSmiGreaterEqualsConstant(Register src, |
| 523 int constant, |
| 524 Label* on_greater_equals) { |
| 525 if (Smi::IsValid(constant)) { |
| 526 Condition are_greater_equal = CheckSmiGreaterEqualsConstant(src, constant); |
| 527 j(are_greater_equal, on_greater_equals); |
| 528 } else if (constant < Smi::kMinValue){ |
| 529 jmp(on_greater_equals); |
| 530 } |
| 531 } |
| 532 |
| 533 |
522 void MacroAssembler::JumpIfNotValidSmiValue(Register src, Label* on_invalid) { | 534 void MacroAssembler::JumpIfNotValidSmiValue(Register src, Label* on_invalid) { |
523 Condition is_valid = CheckInteger32ValidSmiValue(src); | 535 Condition is_valid = CheckInteger32ValidSmiValue(src); |
524 j(ReverseCondition(is_valid), on_invalid); | 536 j(ReverseCondition(is_valid), on_invalid); |
525 } | 537 } |
526 | 538 |
527 | 539 |
528 | 540 |
529 void MacroAssembler::JumpIfNotBothSmi(Register src1, | 541 void MacroAssembler::JumpIfNotBothSmi(Register src1, |
530 Register src2, | 542 Register src2, |
531 Label* on_not_both_smi) { | 543 Label* on_not_both_smi) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 if (Smi::IsValid(constant)) { | 607 if (Smi::IsValid(constant)) { |
596 cmpl(src, Immediate(Smi::FromInt(constant))); | 608 cmpl(src, Immediate(Smi::FromInt(constant))); |
597 return zero; | 609 return zero; |
598 } | 610 } |
599 // Can't be equal. | 611 // Can't be equal. |
600 UNREACHABLE(); | 612 UNREACHABLE(); |
601 return no_condition; | 613 return no_condition; |
602 } | 614 } |
603 | 615 |
604 | 616 |
| 617 Condition MacroAssembler::CheckSmiGreaterEqualsConstant(Register src, |
| 618 int constant) { |
| 619 if (constant == 0) { |
| 620 testl(src, Immediate(static_cast<uint32_t>(0x80000000u))); |
| 621 return positive; |
| 622 } |
| 623 if (Smi::IsValid(constant)) { |
| 624 cmpl(src, Immediate(Smi::FromInt(constant))); |
| 625 return greater_equal; |
| 626 } |
| 627 // Can't be equal. |
| 628 UNREACHABLE(); |
| 629 return no_condition; |
| 630 } |
| 631 |
| 632 |
605 Condition MacroAssembler::CheckInteger32ValidSmiValue(Register src) { | 633 Condition MacroAssembler::CheckInteger32ValidSmiValue(Register src) { |
606 // A 32-bit integer value can be converted to a smi if it is in the | 634 // A 32-bit integer value can be converted to a smi if it is in the |
607 // range [-2^30 .. 2^30-1]. That is equivalent to having its 32-bit | 635 // range [-2^30 .. 2^30-1]. That is equivalent to having its 32-bit |
608 // representation have bits 30 and 31 be equal. | 636 // representation have bits 30 and 31 be equal. |
609 cmpl(src, Immediate(0xC0000000u)); | 637 cmpl(src, Immediate(0xC0000000u)); |
610 return positive; | 638 return positive; |
611 } | 639 } |
612 | 640 |
613 | 641 |
614 void MacroAssembler::SmiNeg(Register dst, | 642 void MacroAssembler::SmiNeg(Register dst, |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 // Indicate that code has changed. | 2170 // Indicate that code has changed. |
2143 CPU::FlushICache(address_, size_); | 2171 CPU::FlushICache(address_, size_); |
2144 | 2172 |
2145 // Check that the code was patched as expected. | 2173 // Check that the code was patched as expected. |
2146 ASSERT(masm_.pc_ == address_ + size_); | 2174 ASSERT(masm_.pc_ == address_ + size_); |
2147 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2175 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2148 } | 2176 } |
2149 | 2177 |
2150 | 2178 |
2151 } } // namespace v8::internal | 2179 } } // namespace v8::internal |
OLD | NEW |