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 bool index_is_smi, | |
| 3625 Register scratch, | |
| 3624 uint32_t encoding_mask) { | 3626 uint32_t encoding_mask) { |
| 3625 Register scratch = __ Tmp1(); | |
| 3626 ASSERT(!AreAliased(string, index, scratch)); | 3627 ASSERT(!AreAliased(string, index, scratch)); |
| 3627 | 3628 |
| 3628 AssertSmi(index); | 3629 if (index_is_smi) { |
| 3630 AssertSmi(index); | |
| 3631 } | |
| 3629 | 3632 |
| 3630 // Check that string is an object. | 3633 // Check that string is an object. |
| 3631 ThrowIfSmi(string, kNonObject); | 3634 ThrowIfSmi(string, kNonObject); |
| 3632 | 3635 |
| 3633 // Check that string has an appropriate map. | 3636 // Check that string has an appropriate map. |
| 3634 Ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | 3637 Ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 3635 Ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 3638 Ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 3639 | |
| 3636 And(scratch, scratch, kStringRepresentationMask | kStringEncodingMask); | 3640 And(scratch, scratch, kStringRepresentationMask | kStringEncodingMask); |
| 3637 Cmp(scratch, encoding_mask); | 3641 Cmp(scratch, encoding_mask); |
| 3638 ThrowIf(ne, kUnexpectedStringType); | 3642 ThrowIf(ne, kUnexpectedStringType); |
| 3639 | 3643 |
| 3640 // Check that the index points inside the string. | |
| 3641 Ldr(scratch, FieldMemOperand(string, String::kLengthOffset)); | 3644 Ldr(scratch, FieldMemOperand(string, String::kLengthOffset)); |
| 3642 Cmp(index, scratch); | 3645 Cmp(index, index_is_smi ? scratch : Operand::UntagSmi(scratch)); |
| 3643 ThrowIf(ge, kIndexIsTooLarge); | 3646 ThrowIf(ge, kIndexIsTooLarge); |
| 3644 | 3647 |
| 3645 Cmp(index, Operand(Smi::FromInt(0))); | 3648 Cmp(index, Operand(Smi::FromInt(0))); |
|
baptiste.afsa1
2014/02/06 15:48:13
Although it will work, it doesn't really make sens
ulan
2014/02/06 16:06:14
I added assert, but didn't add comment since the a
| |
| 3646 ThrowIf(lt, kIndexIsNegative); | 3649 ThrowIf(lt, kIndexIsNegative); |
| 3647 } | 3650 } |
| 3648 | 3651 |
| 3649 | 3652 |
| 3650 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | 3653 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, |
| 3651 Register scratch, | 3654 Register scratch, |
| 3652 Label* miss) { | 3655 Label* miss) { |
| 3653 // TODO(jbramley): Sort out the uses of Tmp0() and Tmp1() in this function. | 3656 // 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 | 3657 // The ARM version takes two scratch registers, and that should be enough for |
| 3655 // all of the checks. | 3658 // all of the checks. |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4836 } | 4839 } |
| 4837 } | 4840 } |
| 4838 | 4841 |
| 4839 | 4842 |
| 4840 #undef __ | 4843 #undef __ |
| 4841 | 4844 |
| 4842 | 4845 |
| 4843 } } // namespace v8::internal | 4846 } } // namespace v8::internal |
| 4844 | 4847 |
| 4845 #endif // V8_TARGET_ARCH_A64 | 4848 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |