Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 3603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3614 // We want the smi-tagged index in key. kArrayIndexValueMask has zeros in | 3614 // We want the smi-tagged index in key. kArrayIndexValueMask has zeros in |
| 3615 // the low kHashShift bits. | 3615 // the low kHashShift bits. |
| 3616 STATIC_ASSERT(kSmiTag == 0); | 3616 STATIC_ASSERT(kSmiTag == 0); |
| 3617 Ubfx(hash, hash, String::kHashShift, String::kArrayIndexValueBits); | 3617 Ubfx(hash, hash, String::kHashShift, String::kArrayIndexValueBits); |
| 3618 SmiTag(index, hash); | 3618 SmiTag(index, hash); |
| 3619 } | 3619 } |
| 3620 | 3620 |
| 3621 | 3621 |
| 3622 void MacroAssembler::EmitSeqStringSetCharCheck(Register string, | 3622 void MacroAssembler::EmitSeqStringSetCharCheck(Register string, |
| 3623 Register index, | 3623 Register index, |
| 3624 Register scratch, | |
| 3624 uint32_t encoding_mask) { | 3625 uint32_t encoding_mask) { |
| 3625 Register scratch = __ Tmp1(); | |
| 3626 ASSERT(!AreAliased(string, index, scratch)); | 3626 ASSERT(!AreAliased(string, index, scratch)); |
| 3627 | 3627 |
| 3628 AssertSmi(index); | |
| 3629 | |
| 3630 // Check that string is an object. | 3628 // Check that string is an object. |
| 3631 ThrowIfSmi(string, kNonObject); | 3629 ThrowIfSmi(string, kNonObject); |
| 3632 | 3630 |
| 3633 // Check that string has an appropriate map. | 3631 // Check that string has an appropriate map. |
| 3634 Ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | 3632 Ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 3635 Ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 3633 Ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 3634 | |
| 3636 And(scratch, scratch, kStringRepresentationMask | kStringEncodingMask); | 3635 And(scratch, scratch, kStringRepresentationMask | kStringEncodingMask); |
| 3637 Cmp(scratch, encoding_mask); | 3636 Cmp(scratch, encoding_mask); |
| 3638 ThrowIf(ne, kUnexpectedStringType); | 3637 ThrowIf(ne, kUnexpectedStringType); |
| 3639 | 3638 |
| 3640 // Check that the index points inside the string. | 3639 // The index is assumed to be untagged coming in, tag it to compare with the |
| 3640 // string length without using a temp register, it is restored at the end of | |
| 3641 // this function. | |
| 3642 SmiTag(index); | |
| 3643 | |
| 3641 Ldr(scratch, FieldMemOperand(string, String::kLengthOffset)); | 3644 Ldr(scratch, FieldMemOperand(string, String::kLengthOffset)); |
| 3642 Cmp(index, scratch); | 3645 Cmp(index, scratch); |
|
baptiste.afsa1
2014/02/06 14:52:07
You can avoid to Tag/Untag the index by untagging
| |
| 3643 ThrowIf(ge, kIndexIsTooLarge); | 3646 ThrowIf(ge, kIndexIsTooLarge); |
| 3644 | 3647 |
| 3645 Cmp(index, Operand(Smi::FromInt(0))); | 3648 Cmp(index, Operand(Smi::FromInt(0))); |
| 3646 ThrowIf(lt, kIndexIsNegative); | 3649 ThrowIf(lt, kIndexIsNegative); |
| 3650 | |
| 3651 SmiUntag(index); | |
| 3647 } | 3652 } |
| 3648 | 3653 |
| 3649 | 3654 |
| 3650 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | 3655 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, |
| 3651 Register scratch, | 3656 Register scratch, |
| 3652 Label* miss) { | 3657 Label* miss) { |
| 3653 // TODO(jbramley): Sort out the uses of Tmp0() and Tmp1() in this function. | 3658 // TODO(jbramley): Sort out the uses of Tmp0() and Tmp1() in this function. |
| 3654 // The ARM version takes two scratch registers, and that should be enough for | 3659 // The ARM version takes two scratch registers, and that should be enough for |
| 3655 // all of the checks. | 3660 // all of the checks. |
| 3656 | 3661 |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4830 } | 4835 } |
| 4831 } | 4836 } |
| 4832 | 4837 |
| 4833 | 4838 |
| 4834 #undef __ | 4839 #undef __ |
| 4835 | 4840 |
| 4836 | 4841 |
| 4837 } } // namespace v8::internal | 4842 } } // namespace v8::internal |
| 4838 | 4843 |
| 4839 #endif // V8_TARGET_ARCH_A64 | 4844 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |