| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3487 // Check that the key is a smi. | 3487 // Check that the key is a smi. |
| 3488 __ JumpIfNotSmi(key, &miss_force_generic); | 3488 __ JumpIfNotSmi(key, &miss_force_generic); |
| 3489 | 3489 |
| 3490 __ lw(a3, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 3490 __ lw(a3, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 3491 // a3: elements array | 3491 // a3: elements array |
| 3492 | 3492 |
| 3493 // Check that the index is in range. | 3493 // Check that the index is in range. |
| 3494 __ lw(t1, FieldMemOperand(a3, ExternalArray::kLengthOffset)); | 3494 __ lw(t1, FieldMemOperand(a3, ExternalArray::kLengthOffset)); |
| 3495 __ sra(t2, key, kSmiTagSize); | 3495 __ sra(t2, key, kSmiTagSize); |
| 3496 // Unsigned comparison catches both negative and too-large values. | 3496 // Unsigned comparison catches both negative and too-large values. |
| 3497 __ Branch(&miss_force_generic, Uless, t1, Operand(t2)); | 3497 __ Branch(&miss_force_generic, Ugreater_equal, key, Operand(t1)); |
| 3498 | 3498 |
| 3499 __ lw(a3, FieldMemOperand(a3, ExternalArray::kExternalPointerOffset)); | 3499 __ lw(a3, FieldMemOperand(a3, ExternalArray::kExternalPointerOffset)); |
| 3500 // a3: base pointer of external storage | 3500 // a3: base pointer of external storage |
| 3501 | 3501 |
| 3502 // We are not untagging smi key and instead work with it | 3502 // We are not untagging smi key and instead work with it |
| 3503 // as if it was premultiplied by 2. | 3503 // as if it was premultiplied by 2. |
| 3504 ASSERT((kSmiTag == 0) && (kSmiTagSize == 1)); | 3504 ASSERT((kSmiTag == 0) && (kSmiTagSize == 1)); |
| 3505 | 3505 |
| 3506 Register value = a2; | 3506 Register value = a2; |
| 3507 switch (elements_kind) { | 3507 switch (elements_kind) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3631 // conversion. Don't use a0 and a1 as AllocateHeapNumber clobbers all | 3631 // conversion. Don't use a0 and a1 as AllocateHeapNumber clobbers all |
| 3632 // registers - also when jumping due to exhausted young space. | 3632 // registers - also when jumping due to exhausted young space. |
| 3633 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); | 3633 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); |
| 3634 __ AllocateHeapNumber(v0, t2, t3, t6, &slow); | 3634 __ AllocateHeapNumber(v0, t2, t3, t6, &slow); |
| 3635 | 3635 |
| 3636 // This is replaced by a macro: | 3636 // This is replaced by a macro: |
| 3637 // __ mtc1(value, f0); // LS 32-bits. | 3637 // __ mtc1(value, f0); // LS 32-bits. |
| 3638 // __ mtc1(zero_reg, f1); // MS 32-bits are all zero. | 3638 // __ mtc1(zero_reg, f1); // MS 32-bits are all zero. |
| 3639 // __ cvt_d_l(f0, f0); // Use 64 bit conv to get correct unsigned 32-bit. | 3639 // __ cvt_d_l(f0, f0); // Use 64 bit conv to get correct unsigned 32-bit. |
| 3640 | 3640 |
| 3641 __ Cvt_d_uw(f0, value); | 3641 __ Cvt_d_uw(f0, value, f22); |
| 3642 | 3642 |
| 3643 __ sdc1(f0, MemOperand(v0, HeapNumber::kValueOffset - kHeapObjectTag)); | 3643 __ sdc1(f0, MemOperand(v0, HeapNumber::kValueOffset - kHeapObjectTag)); |
| 3644 | 3644 |
| 3645 __ Ret(); | 3645 __ Ret(); |
| 3646 } else { | 3646 } else { |
| 3647 // Check whether unsigned integer fits into smi. | 3647 // Check whether unsigned integer fits into smi. |
| 3648 Label box_int_0, box_int_1, done; | 3648 Label box_int_0, box_int_1, done; |
| 3649 __ And(t2, value, Operand(0x80000000)); | 3649 __ And(t2, value, Operand(0x80000000)); |
| 3650 __ Branch(&box_int_0, ne, t2, Operand(zero_reg)); | 3650 __ Branch(&box_int_0, ne, t2, Operand(zero_reg)); |
| 3651 __ And(t2, value, Operand(0x40000000)); | 3651 __ And(t2, value, Operand(0x40000000)); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3815 | 3815 |
| 3816 // Register usage. | 3816 // Register usage. |
| 3817 Register value = a0; | 3817 Register value = a0; |
| 3818 Register key = a1; | 3818 Register key = a1; |
| 3819 Register receiver = a2; | 3819 Register receiver = a2; |
| 3820 // a3 mostly holds the elements array or the destination external array. | 3820 // a3 mostly holds the elements array or the destination external array. |
| 3821 | 3821 |
| 3822 // This stub is meant to be tail-jumped to, the receiver must already | 3822 // This stub is meant to be tail-jumped to, the receiver must already |
| 3823 // have been verified by the caller to not be a smi. | 3823 // have been verified by the caller to not be a smi. |
| 3824 | 3824 |
| 3825 // Check that the key is a smi. |
| 3826 __ JumpIfNotSmi(key, &miss_force_generic); |
| 3827 |
| 3825 __ lw(a3, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 3828 __ lw(a3, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 3826 | 3829 |
| 3827 // Check that the key is a smi. | |
| 3828 __ JumpIfNotSmi(key, &miss_force_generic); | |
| 3829 | |
| 3830 // Check that the index is in range. | 3830 // Check that the index is in range. |
| 3831 __ SmiUntag(t0, key); | 3831 __ SmiUntag(t0, key); |
| 3832 __ lw(t1, FieldMemOperand(a3, ExternalArray::kLengthOffset)); | 3832 __ lw(t1, FieldMemOperand(a3, ExternalArray::kLengthOffset)); |
| 3833 // Unsigned comparison catches both negative and too-large values. | 3833 // Unsigned comparison catches both negative and too-large values. |
| 3834 __ Branch(&miss_force_generic, Ugreater_equal, t0, Operand(t1)); | 3834 __ Branch(&miss_force_generic, Ugreater_equal, key, Operand(t1)); |
| 3835 | 3835 |
| 3836 // Handle both smis and HeapNumbers in the fast path. Go to the | 3836 // Handle both smis and HeapNumbers in the fast path. Go to the |
| 3837 // runtime for all other kinds of values. | 3837 // runtime for all other kinds of values. |
| 3838 // a3: external array. | 3838 // a3: external array. |
| 3839 // t0: key (integer). | 3839 // t0: key (integer). |
| 3840 | 3840 |
| 3841 if (elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS) { | 3841 if (elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS) { |
| 3842 // Double to pixel conversion is only implemented in the runtime for now. | 3842 // Double to pixel conversion is only implemented in the runtime for now. |
| 3843 __ JumpIfNotSmi(value, &slow); | 3843 __ JumpIfNotSmi(value, &slow); |
| 3844 } else { | 3844 } else { |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4486 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 4486 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
| 4487 __ Jump(ic, RelocInfo::CODE_TARGET); | 4487 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 4488 } | 4488 } |
| 4489 | 4489 |
| 4490 | 4490 |
| 4491 #undef __ | 4491 #undef __ |
| 4492 | 4492 |
| 4493 } } // namespace v8::internal | 4493 } } // namespace v8::internal |
| 4494 | 4494 |
| 4495 #endif // V8_TARGET_ARCH_MIPS | 4495 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |