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