| 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 3601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3612 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 3612 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
| 3613 (1 << String::kArrayIndexValueBits)); | 3613 (1 << String::kArrayIndexValueBits)); |
| 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( |
| 3623 Register index, | 3623 Register string, |
| 3624 uint32_t encoding_mask) { | 3624 Register index, |
| 3625 Register scratch = __ Tmp1(); | 3625 SeqStringSetCharCheckIndexType index_type, |
| 3626 Register scratch, |
| 3627 uint32_t encoding_mask) { |
| 3626 ASSERT(!AreAliased(string, index, scratch)); | 3628 ASSERT(!AreAliased(string, index, scratch)); |
| 3627 | 3629 |
| 3628 AssertSmi(index); | 3630 if (index_type == kIndexIsSmi) { |
| 3631 AssertSmi(index); |
| 3632 } |
| 3629 | 3633 |
| 3630 // Check that string is an object. | 3634 // Check that string is an object. |
| 3631 ThrowIfSmi(string, kNonObject); | 3635 ThrowIfSmi(string, kNonObject); |
| 3632 | 3636 |
| 3633 // Check that string has an appropriate map. | 3637 // Check that string has an appropriate map. |
| 3634 Ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | 3638 Ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 3635 Ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 3639 Ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 3640 |
| 3636 And(scratch, scratch, kStringRepresentationMask | kStringEncodingMask); | 3641 And(scratch, scratch, kStringRepresentationMask | kStringEncodingMask); |
| 3637 Cmp(scratch, encoding_mask); | 3642 Cmp(scratch, encoding_mask); |
| 3638 ThrowIf(ne, kUnexpectedStringType); | 3643 ThrowIf(ne, kUnexpectedStringType); |
| 3639 | 3644 |
| 3640 // Check that the index points inside the string. | |
| 3641 Ldr(scratch, FieldMemOperand(string, String::kLengthOffset)); | 3645 Ldr(scratch, FieldMemOperand(string, String::kLengthOffset)); |
| 3642 Cmp(index, scratch); | 3646 Cmp(index, index_type == kIndexIsSmi ? scratch : Operand::UntagSmi(scratch)); |
| 3643 ThrowIf(ge, kIndexIsTooLarge); | 3647 ThrowIf(ge, kIndexIsTooLarge); |
| 3644 | 3648 |
| 3645 Cmp(index, Operand(Smi::FromInt(0))); | 3649 ASSERT_EQ(0, Smi::FromInt(0)); |
| 3650 Cmp(index, 0); |
| 3646 ThrowIf(lt, kIndexIsNegative); | 3651 ThrowIf(lt, kIndexIsNegative); |
| 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. |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4836 } | 4841 } |
| 4837 } | 4842 } |
| 4838 | 4843 |
| 4839 | 4844 |
| 4840 #undef __ | 4845 #undef __ |
| 4841 | 4846 |
| 4842 | 4847 |
| 4843 } } // namespace v8::internal | 4848 } } // namespace v8::internal |
| 4844 | 4849 |
| 4845 #endif // V8_TARGET_ARCH_A64 | 4850 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |