| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 __ bind(&with_write_barrier); | 1574 __ bind(&with_write_barrier); |
| 1575 | 1575 |
| 1576 __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 1576 __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 1577 | 1577 |
| 1578 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { | 1578 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { |
| 1579 Label fast_object, not_fast_object; | 1579 Label fast_object, not_fast_object; |
| 1580 __ CheckFastObjectElements(r3, r7, ¬_fast_object); | 1580 __ CheckFastObjectElements(r3, r7, ¬_fast_object); |
| 1581 __ jmp(&fast_object); | 1581 __ jmp(&fast_object); |
| 1582 // In case of fast smi-only, convert to fast object, otherwise bail out. | 1582 // In case of fast smi-only, convert to fast object, otherwise bail out. |
| 1583 __ bind(¬_fast_object); | 1583 __ bind(¬_fast_object); |
| 1584 __ CheckFastSmiOnlyElements(r3, r7, &call_builtin); | 1584 __ CheckFastSmiElements(r3, r7, &call_builtin); |
| 1585 // edx: receiver | 1585 // edx: receiver |
| 1586 // r3: map | 1586 // r3: map |
| 1587 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, | 1587 Label try_holey_map; |
| 1588 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 1588 FAST_ELEMENTS, | 1589 FAST_ELEMENTS, |
| 1589 r3, | 1590 r3, |
| 1590 r7, | 1591 r7, |
| 1592 &try_holey_map); |
| 1593 __ mov(r2, receiver); |
| 1594 ElementsTransitionGenerator::GenerateMapChangeElementTransition(masm()); |
| 1595 __ jmp(&fast_object); |
| 1596 |
| 1597 __ bind(&try_holey_map); |
| 1598 __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS, |
| 1599 FAST_HOLEY_ELEMENTS, |
| 1600 r3, |
| 1601 r7, |
| 1591 &call_builtin); | 1602 &call_builtin); |
| 1592 __ mov(r2, receiver); | 1603 __ mov(r2, receiver); |
| 1593 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm()); | 1604 ElementsTransitionGenerator::GenerateMapChangeElementTransition(masm()); |
| 1594 __ bind(&fast_object); | 1605 __ bind(&fast_object); |
| 1595 } else { | 1606 } else { |
| 1596 __ CheckFastObjectElements(r3, r3, &call_builtin); | 1607 __ CheckFastObjectElements(r3, r3, &call_builtin); |
| 1597 } | 1608 } |
| 1598 | 1609 |
| 1599 // Save new length. | 1610 // Save new length. |
| 1600 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1611 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1601 | 1612 |
| 1602 // Store the value. | 1613 // Store the value. |
| 1603 // We may need a register containing the address end_elements below, | 1614 // We may need a register containing the address end_elements below, |
| (...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3365 | 3376 |
| 3366 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3377 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 3367 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3378 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 3368 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3379 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3369 case EXTERNAL_PIXEL_ELEMENTS: | 3380 case EXTERNAL_PIXEL_ELEMENTS: |
| 3370 return false; | 3381 return false; |
| 3371 | 3382 |
| 3372 case EXTERNAL_FLOAT_ELEMENTS: | 3383 case EXTERNAL_FLOAT_ELEMENTS: |
| 3373 case EXTERNAL_DOUBLE_ELEMENTS: | 3384 case EXTERNAL_DOUBLE_ELEMENTS: |
| 3374 case FAST_ELEMENTS: | 3385 case FAST_ELEMENTS: |
| 3375 case FAST_SMI_ONLY_ELEMENTS: | 3386 case FAST_SMI_ELEMENTS: |
| 3376 case FAST_DOUBLE_ELEMENTS: | 3387 case FAST_DOUBLE_ELEMENTS: |
| 3388 case FAST_HOLEY_ELEMENTS: |
| 3389 case FAST_HOLEY_SMI_ELEMENTS: |
| 3390 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3377 case DICTIONARY_ELEMENTS: | 3391 case DICTIONARY_ELEMENTS: |
| 3378 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3392 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3379 UNREACHABLE(); | 3393 UNREACHABLE(); |
| 3380 return false; | 3394 return false; |
| 3381 } | 3395 } |
| 3382 return false; | 3396 return false; |
| 3383 } | 3397 } |
| 3384 | 3398 |
| 3385 | 3399 |
| 3386 static void GenerateSmiKeyCheck(MacroAssembler* masm, | 3400 static void GenerateSmiKeyCheck(MacroAssembler* masm, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3490 __ add(r2, r3, Operand(key, LSL, 2)); | 3504 __ add(r2, r3, Operand(key, LSL, 2)); |
| 3491 __ vldr(d0, r2, 0); | 3505 __ vldr(d0, r2, 0); |
| 3492 } else { | 3506 } else { |
| 3493 __ add(r4, r3, Operand(key, LSL, 2)); | 3507 __ add(r4, r3, Operand(key, LSL, 2)); |
| 3494 // r4: pointer to the beginning of the double we want to load. | 3508 // r4: pointer to the beginning of the double we want to load. |
| 3495 __ ldr(r2, MemOperand(r4, 0)); | 3509 __ ldr(r2, MemOperand(r4, 0)); |
| 3496 __ ldr(r3, MemOperand(r4, Register::kSizeInBytes)); | 3510 __ ldr(r3, MemOperand(r4, Register::kSizeInBytes)); |
| 3497 } | 3511 } |
| 3498 break; | 3512 break; |
| 3499 case FAST_ELEMENTS: | 3513 case FAST_ELEMENTS: |
| 3500 case FAST_SMI_ONLY_ELEMENTS: | 3514 case FAST_SMI_ELEMENTS: |
| 3501 case FAST_DOUBLE_ELEMENTS: | 3515 case FAST_DOUBLE_ELEMENTS: |
| 3516 case FAST_HOLEY_ELEMENTS: |
| 3517 case FAST_HOLEY_SMI_ELEMENTS: |
| 3518 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3502 case DICTIONARY_ELEMENTS: | 3519 case DICTIONARY_ELEMENTS: |
| 3503 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3520 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3504 UNREACHABLE(); | 3521 UNREACHABLE(); |
| 3505 break; | 3522 break; |
| 3506 } | 3523 } |
| 3507 | 3524 |
| 3508 // For integer array types: | 3525 // For integer array types: |
| 3509 // r2: value | 3526 // r2: value |
| 3510 // For float array type: | 3527 // For float array type: |
| 3511 // s0: value (if VFP3 is supported) | 3528 // s0: value (if VFP3 is supported) |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3831 r4, s2); // These are: scratch2, single_scratch. | 3848 r4, s2); // These are: scratch2, single_scratch. |
| 3832 if (destination == FloatingPointHelper::kVFPRegisters) { | 3849 if (destination == FloatingPointHelper::kVFPRegisters) { |
| 3833 CpuFeatures::Scope scope(VFP3); | 3850 CpuFeatures::Scope scope(VFP3); |
| 3834 __ vstr(d0, r3, 0); | 3851 __ vstr(d0, r3, 0); |
| 3835 } else { | 3852 } else { |
| 3836 __ str(r6, MemOperand(r3, 0)); | 3853 __ str(r6, MemOperand(r3, 0)); |
| 3837 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); | 3854 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); |
| 3838 } | 3855 } |
| 3839 break; | 3856 break; |
| 3840 case FAST_ELEMENTS: | 3857 case FAST_ELEMENTS: |
| 3841 case FAST_SMI_ONLY_ELEMENTS: | 3858 case FAST_SMI_ELEMENTS: |
| 3842 case FAST_DOUBLE_ELEMENTS: | 3859 case FAST_DOUBLE_ELEMENTS: |
| 3860 case FAST_HOLEY_ELEMENTS: |
| 3861 case FAST_HOLEY_SMI_ELEMENTS: |
| 3862 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3843 case DICTIONARY_ELEMENTS: | 3863 case DICTIONARY_ELEMENTS: |
| 3844 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3864 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3845 UNREACHABLE(); | 3865 UNREACHABLE(); |
| 3846 break; | 3866 break; |
| 3847 } | 3867 } |
| 3848 | 3868 |
| 3849 // Entry registers are intact, r0 holds the value which is the return value. | 3869 // Entry registers are intact, r0 holds the value which is the return value. |
| 3850 __ Ret(); | 3870 __ Ret(); |
| 3851 | 3871 |
| 3852 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) { | 3872 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3895 __ strh(r5, MemOperand(r3, key, LSL, 0)); | 3915 __ strh(r5, MemOperand(r3, key, LSL, 0)); |
| 3896 break; | 3916 break; |
| 3897 case EXTERNAL_INT_ELEMENTS: | 3917 case EXTERNAL_INT_ELEMENTS: |
| 3898 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3918 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3899 __ str(r5, MemOperand(r3, key, LSL, 1)); | 3919 __ str(r5, MemOperand(r3, key, LSL, 1)); |
| 3900 break; | 3920 break; |
| 3901 case EXTERNAL_PIXEL_ELEMENTS: | 3921 case EXTERNAL_PIXEL_ELEMENTS: |
| 3902 case EXTERNAL_FLOAT_ELEMENTS: | 3922 case EXTERNAL_FLOAT_ELEMENTS: |
| 3903 case EXTERNAL_DOUBLE_ELEMENTS: | 3923 case EXTERNAL_DOUBLE_ELEMENTS: |
| 3904 case FAST_ELEMENTS: | 3924 case FAST_ELEMENTS: |
| 3905 case FAST_SMI_ONLY_ELEMENTS: | 3925 case FAST_SMI_ELEMENTS: |
| 3906 case FAST_DOUBLE_ELEMENTS: | 3926 case FAST_DOUBLE_ELEMENTS: |
| 3927 case FAST_HOLEY_ELEMENTS: |
| 3928 case FAST_HOLEY_SMI_ELEMENTS: |
| 3929 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3907 case DICTIONARY_ELEMENTS: | 3930 case DICTIONARY_ELEMENTS: |
| 3908 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3931 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3909 UNREACHABLE(); | 3932 UNREACHABLE(); |
| 3910 break; | 3933 break; |
| 3911 } | 3934 } |
| 3912 } | 3935 } |
| 3913 | 3936 |
| 3914 // Entry registers are intact, r0 holds the value which is the return | 3937 // Entry registers are intact, r0 holds the value which is the return |
| 3915 // value. | 3938 // value. |
| 3916 __ Ret(); | 3939 __ Ret(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4035 __ strh(r5, MemOperand(r3, key, LSL, 0)); | 4058 __ strh(r5, MemOperand(r3, key, LSL, 0)); |
| 4036 break; | 4059 break; |
| 4037 case EXTERNAL_INT_ELEMENTS: | 4060 case EXTERNAL_INT_ELEMENTS: |
| 4038 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 4061 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 4039 __ str(r5, MemOperand(r3, key, LSL, 1)); | 4062 __ str(r5, MemOperand(r3, key, LSL, 1)); |
| 4040 break; | 4063 break; |
| 4041 case EXTERNAL_PIXEL_ELEMENTS: | 4064 case EXTERNAL_PIXEL_ELEMENTS: |
| 4042 case EXTERNAL_FLOAT_ELEMENTS: | 4065 case EXTERNAL_FLOAT_ELEMENTS: |
| 4043 case EXTERNAL_DOUBLE_ELEMENTS: | 4066 case EXTERNAL_DOUBLE_ELEMENTS: |
| 4044 case FAST_ELEMENTS: | 4067 case FAST_ELEMENTS: |
| 4045 case FAST_SMI_ONLY_ELEMENTS: | 4068 case FAST_SMI_ELEMENTS: |
| 4046 case FAST_DOUBLE_ELEMENTS: | 4069 case FAST_DOUBLE_ELEMENTS: |
| 4070 case FAST_HOLEY_ELEMENTS: |
| 4071 case FAST_HOLEY_SMI_ELEMENTS: |
| 4072 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 4047 case DICTIONARY_ELEMENTS: | 4073 case DICTIONARY_ELEMENTS: |
| 4048 case NON_STRICT_ARGUMENTS_ELEMENTS: | 4074 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 4049 UNREACHABLE(); | 4075 UNREACHABLE(); |
| 4050 break; | 4076 break; |
| 4051 } | 4077 } |
| 4052 } | 4078 } |
| 4053 } | 4079 } |
| 4054 } | 4080 } |
| 4055 | 4081 |
| 4056 // Slow case, key and receiver still in r0 and r1. | 4082 // Slow case, key and receiver still in r0 and r1. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4218 Register elements_reg = r3; | 4244 Register elements_reg = r3; |
| 4219 Register length_reg = r5; | 4245 Register length_reg = r5; |
| 4220 Register scratch2 = r6; | 4246 Register scratch2 = r6; |
| 4221 | 4247 |
| 4222 // This stub is meant to be tail-jumped to, the receiver must already | 4248 // This stub is meant to be tail-jumped to, the receiver must already |
| 4223 // have been verified by the caller to not be a smi. | 4249 // have been verified by the caller to not be a smi. |
| 4224 | 4250 |
| 4225 // Check that the key is a smi or a heap number convertible to a smi. | 4251 // Check that the key is a smi or a heap number convertible to a smi. |
| 4226 GenerateSmiKeyCheck(masm, key_reg, r4, r5, d1, &miss_force_generic); | 4252 GenerateSmiKeyCheck(masm, key_reg, r4, r5, d1, &miss_force_generic); |
| 4227 | 4253 |
| 4228 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { | 4254 if (IsFastSmiElementsKind(elements_kind)) { |
| 4229 __ JumpIfNotSmi(value_reg, &transition_elements_kind); | 4255 __ JumpIfNotSmi(value_reg, &transition_elements_kind); |
| 4230 } | 4256 } |
| 4231 | 4257 |
| 4232 // Check that the key is within bounds. | 4258 // Check that the key is within bounds. |
| 4233 __ ldr(elements_reg, | 4259 __ ldr(elements_reg, |
| 4234 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 4260 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
| 4235 if (is_js_array) { | 4261 if (is_js_array) { |
| 4236 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 4262 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
| 4237 } else { | 4263 } else { |
| 4238 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); | 4264 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); |
| 4239 } | 4265 } |
| 4240 // Compare smis. | 4266 // Compare smis. |
| 4241 __ cmp(key_reg, scratch); | 4267 __ cmp(key_reg, scratch); |
| 4242 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { | 4268 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { |
| 4243 __ b(hs, &grow); | 4269 __ b(hs, &grow); |
| 4244 } else { | 4270 } else { |
| 4245 __ b(hs, &miss_force_generic); | 4271 __ b(hs, &miss_force_generic); |
| 4246 } | 4272 } |
| 4247 | 4273 |
| 4248 // Make sure elements is a fast element array, not 'cow'. | 4274 // Make sure elements is a fast element array, not 'cow'. |
| 4249 __ CheckMap(elements_reg, | 4275 __ CheckMap(elements_reg, |
| 4250 scratch, | 4276 scratch, |
| 4251 Heap::kFixedArrayMapRootIndex, | 4277 Heap::kFixedArrayMapRootIndex, |
| 4252 &miss_force_generic, | 4278 &miss_force_generic, |
| 4253 DONT_DO_SMI_CHECK); | 4279 DONT_DO_SMI_CHECK); |
| 4254 | 4280 |
| 4255 __ bind(&finish_store); | 4281 __ bind(&finish_store); |
| 4256 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { | 4282 if (IsFastSmiElementsKind(elements_kind)) { |
| 4257 __ add(scratch, | 4283 __ add(scratch, |
| 4258 elements_reg, | 4284 elements_reg, |
| 4259 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4285 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 4260 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); | 4286 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); |
| 4261 __ add(scratch, | 4287 __ add(scratch, |
| 4262 scratch, | 4288 scratch, |
| 4263 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); | 4289 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 4264 __ str(value_reg, MemOperand(scratch)); | 4290 __ str(value_reg, MemOperand(scratch)); |
| 4265 } else { | 4291 } else { |
| 4266 ASSERT(elements_kind == FAST_ELEMENTS); | 4292 ASSERT(IsFastObjectElementsKind(elements_kind)); |
| 4267 __ add(scratch, | 4293 __ add(scratch, |
| 4268 elements_reg, | 4294 elements_reg, |
| 4269 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4295 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 4270 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); | 4296 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); |
| 4271 __ add(scratch, | 4297 __ add(scratch, |
| 4272 scratch, | 4298 scratch, |
| 4273 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); | 4299 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 4274 __ str(value_reg, MemOperand(scratch)); | 4300 __ str(value_reg, MemOperand(scratch)); |
| 4275 __ mov(receiver_reg, value_reg); | 4301 __ mov(receiver_reg, value_reg); |
| 4276 __ RecordWrite(elements_reg, // Object. | 4302 __ RecordWrite(elements_reg, // Object. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4503 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4529 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
| 4504 } | 4530 } |
| 4505 } | 4531 } |
| 4506 | 4532 |
| 4507 | 4533 |
| 4508 #undef __ | 4534 #undef __ |
| 4509 | 4535 |
| 4510 } } // namespace v8::internal | 4536 } } // namespace v8::internal |
| 4511 | 4537 |
| 4512 #endif // V8_TARGET_ARCH_ARM | 4538 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |