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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 __ bind(&with_write_barrier); | 1455 __ bind(&with_write_barrier); |
1456 | 1456 |
1457 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 1457 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
1458 | 1458 |
1459 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { | 1459 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { |
1460 Label fast_object, not_fast_object; | 1460 Label fast_object, not_fast_object; |
1461 __ CheckFastObjectElements(ebx, ¬_fast_object, Label::kNear); | 1461 __ CheckFastObjectElements(ebx, ¬_fast_object, Label::kNear); |
1462 __ jmp(&fast_object); | 1462 __ jmp(&fast_object); |
1463 // In case of fast smi-only, convert to fast object, otherwise bail out. | 1463 // In case of fast smi-only, convert to fast object, otherwise bail out. |
1464 __ bind(¬_fast_object); | 1464 __ bind(¬_fast_object); |
1465 __ CheckFastSmiElements(ebx, &call_builtin); | 1465 __ CheckFastSmiOnlyElements(ebx, &call_builtin); |
1466 // edi: elements array | 1466 // edi: elements array |
1467 // edx: receiver | 1467 // edx: receiver |
1468 // ebx: map | 1468 // ebx: map |
1469 Label try_holey_map; | 1469 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, |
1470 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, | |
1471 FAST_ELEMENTS, | 1470 FAST_ELEMENTS, |
1472 ebx, | 1471 ebx, |
1473 edi, | 1472 edi, |
1474 &try_holey_map); | |
1475 | |
1476 ElementsTransitionGenerator:: | |
1477 GenerateMapChangeElementsTransition(masm()); | |
1478 // Restore edi. | |
1479 __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); | |
1480 __ jmp(&fast_object); | |
1481 | |
1482 __ bind(&try_holey_map); | |
1483 __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS, | |
1484 FAST_HOLEY_ELEMENTS, | |
1485 ebx, | |
1486 edi, | |
1487 &call_builtin); | 1473 &call_builtin); |
1488 ElementsTransitionGenerator:: | 1474 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm()); |
1489 GenerateMapChangeElementsTransition(masm()); | |
1490 // Restore edi. | 1475 // Restore edi. |
1491 __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); | 1476 __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); |
1492 __ bind(&fast_object); | 1477 __ bind(&fast_object); |
1493 } else { | 1478 } else { |
1494 __ CheckFastObjectElements(ebx, &call_builtin); | 1479 __ CheckFastObjectElements(ebx, &call_builtin); |
1495 } | 1480 } |
1496 | 1481 |
1497 // Save new length. | 1482 // Save new length. |
1498 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); | 1483 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
1499 | 1484 |
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3826 // ----------------------------------- | 3811 // ----------------------------------- |
3827 Label miss_force_generic, grow, slow, transition_elements_kind; | 3812 Label miss_force_generic, grow, slow, transition_elements_kind; |
3828 Label check_capacity, prepare_slow, finish_store, commit_backing_store; | 3813 Label check_capacity, prepare_slow, finish_store, commit_backing_store; |
3829 | 3814 |
3830 // This stub is meant to be tail-jumped to, the receiver must already | 3815 // This stub is meant to be tail-jumped to, the receiver must already |
3831 // have been verified by the caller to not be a smi. | 3816 // have been verified by the caller to not be a smi. |
3832 | 3817 |
3833 // Check that the key is a smi or a heap number convertible to a smi. | 3818 // Check that the key is a smi or a heap number convertible to a smi. |
3834 GenerateSmiKeyCheck(masm, ecx, ebx, xmm0, xmm1, &miss_force_generic); | 3819 GenerateSmiKeyCheck(masm, ecx, ebx, xmm0, xmm1, &miss_force_generic); |
3835 | 3820 |
3836 if (IsFastSmiElementsKind(elements_kind)) { | 3821 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { |
3837 __ JumpIfNotSmi(eax, &transition_elements_kind); | 3822 __ JumpIfNotSmi(eax, &transition_elements_kind); |
3838 } | 3823 } |
3839 | 3824 |
3840 // Get the elements array and make sure it is a fast element array, not 'cow'. | 3825 // Get the elements array and make sure it is a fast element array, not 'cow'. |
3841 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 3826 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
3842 if (is_js_array) { | 3827 if (is_js_array) { |
3843 // Check that the key is within bounds. | 3828 // Check that the key is within bounds. |
3844 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis. | 3829 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis. |
3845 if (grow_mode == ALLOW_JSARRAY_GROWTH) { | 3830 if (grow_mode == ALLOW_JSARRAY_GROWTH) { |
3846 __ j(above_equal, &grow); | 3831 __ j(above_equal, &grow); |
3847 } else { | 3832 } else { |
3848 __ j(above_equal, &miss_force_generic); | 3833 __ j(above_equal, &miss_force_generic); |
3849 } | 3834 } |
3850 } else { | 3835 } else { |
3851 // Check that the key is within bounds. | 3836 // Check that the key is within bounds. |
3852 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis. | 3837 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis. |
3853 __ j(above_equal, &miss_force_generic); | 3838 __ j(above_equal, &miss_force_generic); |
3854 } | 3839 } |
3855 | 3840 |
3856 __ cmp(FieldOperand(edi, HeapObject::kMapOffset), | 3841 __ cmp(FieldOperand(edi, HeapObject::kMapOffset), |
3857 Immediate(masm->isolate()->factory()->fixed_array_map())); | 3842 Immediate(masm->isolate()->factory()->fixed_array_map())); |
3858 __ j(not_equal, &miss_force_generic); | 3843 __ j(not_equal, &miss_force_generic); |
3859 | 3844 |
3860 __ bind(&finish_store); | 3845 __ bind(&finish_store); |
3861 if (IsFastSmiElementsKind(elements_kind)) { | 3846 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { |
3862 // ecx is a smi, use times_half_pointer_size instead of | 3847 // ecx is a smi, use times_half_pointer_size instead of |
3863 // times_pointer_size | 3848 // times_pointer_size |
3864 __ mov(FieldOperand(edi, | 3849 __ mov(FieldOperand(edi, |
3865 ecx, | 3850 ecx, |
3866 times_half_pointer_size, | 3851 times_half_pointer_size, |
3867 FixedArray::kHeaderSize), eax); | 3852 FixedArray::kHeaderSize), eax); |
3868 } else { | 3853 } else { |
3869 ASSERT(IsFastObjectElementsKind(elements_kind)); | 3854 ASSERT(elements_kind == FAST_ELEMENTS); |
3870 // Do the store and update the write barrier. | 3855 // Do the store and update the write barrier. |
3871 // ecx is a smi, use times_half_pointer_size instead of | 3856 // ecx is a smi, use times_half_pointer_size instead of |
3872 // times_pointer_size | 3857 // times_pointer_size |
3873 __ lea(ecx, FieldOperand(edi, | 3858 __ lea(ecx, FieldOperand(edi, |
3874 ecx, | 3859 ecx, |
3875 times_half_pointer_size, | 3860 times_half_pointer_size, |
3876 FixedArray::kHeaderSize)); | 3861 FixedArray::kHeaderSize)); |
3877 __ mov(Operand(ecx, 0), eax); | 3862 __ mov(Operand(ecx, 0), eax); |
3878 // Make sure to preserve the value in register eax. | 3863 // Make sure to preserve the value in register eax. |
3879 __ mov(ebx, eax); | 3864 __ mov(ebx, eax); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4096 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 4081 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
4097 } | 4082 } |
4098 } | 4083 } |
4099 | 4084 |
4100 | 4085 |
4101 #undef __ | 4086 #undef __ |
4102 | 4087 |
4103 } } // namespace v8::internal | 4088 } } // namespace v8::internal |
4104 | 4089 |
4105 #endif // V8_TARGET_ARCH_IA32 | 4090 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |