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 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3125 // top forward. | 3125 // top forward. |
3126 // ebx: initial map | 3126 // ebx: initial map |
3127 ASSERT(function->has_initial_map()); | 3127 ASSERT(function->has_initial_map()); |
3128 int instance_size = function->initial_map()->instance_size(); | 3128 int instance_size = function->initial_map()->instance_size(); |
3129 #ifdef DEBUG | 3129 #ifdef DEBUG |
3130 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); | 3130 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); |
3131 __ shl(ecx, kPointerSizeLog2); | 3131 __ shl(ecx, kPointerSizeLog2); |
3132 __ cmp(ecx, Immediate(instance_size)); | 3132 __ cmp(ecx, Immediate(instance_size)); |
3133 __ Check(equal, "Instance size of initial map changed."); | 3133 __ Check(equal, "Instance size of initial map changed."); |
3134 #endif | 3134 #endif |
3135 __ AllocateInNewSpace(instance_size, edx, ecx, no_reg, | 3135 __ Allocate(instance_size, edx, ecx, no_reg, &generic_stub_call, |
3136 &generic_stub_call, NO_ALLOCATION_FLAGS); | 3136 NO_ALLOCATION_FLAGS, MacroAssembler::NEW_SPACE); |
3137 | 3137 |
3138 // Allocated the JSObject, now initialize the fields and add the heap tag. | 3138 // Allocated the JSObject, now initialize the fields and add the heap tag. |
3139 // ebx: initial map | 3139 // ebx: initial map |
3140 // edx: JSObject (untagged) | 3140 // edx: JSObject (untagged) |
3141 __ mov(Operand(edx, JSObject::kMapOffset), ebx); | 3141 __ mov(Operand(edx, JSObject::kMapOffset), ebx); |
3142 __ mov(ebx, factory()->empty_fixed_array()); | 3142 __ mov(ebx, factory()->empty_fixed_array()); |
3143 __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx); | 3143 __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx); |
3144 __ mov(Operand(edx, JSObject::kElementsOffset), ebx); | 3144 __ mov(Operand(edx, JSObject::kElementsOffset), ebx); |
3145 | 3145 |
3146 // Push the allocated object to the stack. This is the object that will be | 3146 // Push the allocated object to the stack. This is the object that will be |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3600 // compare. | 3600 // compare. |
3601 __ j(not_equal, &miss_force_generic); | 3601 __ j(not_equal, &miss_force_generic); |
3602 | 3602 |
3603 // Check for the empty array, and preallocate a small backing store if | 3603 // Check for the empty array, and preallocate a small backing store if |
3604 // possible. | 3604 // possible. |
3605 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 3605 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
3606 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 3606 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
3607 __ j(not_equal, &check_capacity); | 3607 __ j(not_equal, &check_capacity); |
3608 | 3608 |
3609 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3609 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3610 __ AllocateInNewSpace(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT); | 3610 __ Allocate(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT, |
| 3611 MacroAssembler::NEW_SPACE); |
3611 // Restore the key, which is known to be the array length. | 3612 // Restore the key, which is known to be the array length. |
3612 | 3613 |
3613 // eax: value | 3614 // eax: value |
3614 // ecx: key | 3615 // ecx: key |
3615 // edx: receiver | 3616 // edx: receiver |
3616 // edi: elements | 3617 // edi: elements |
3617 // Make sure that the backing store can hold additional elements. | 3618 // Make sure that the backing store can hold additional elements. |
3618 __ mov(FieldOperand(edi, JSObject::kMapOffset), | 3619 __ mov(FieldOperand(edi, JSObject::kMapOffset), |
3619 Immediate(masm->isolate()->factory()->fixed_array_map())); | 3620 Immediate(masm->isolate()->factory()->fixed_array_map())); |
3620 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), | 3621 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3736 __ j(not_equal, &transition_elements_kind); | 3737 __ j(not_equal, &transition_elements_kind); |
3737 __ bind(&value_is_smi); | 3738 __ bind(&value_is_smi); |
3738 | 3739 |
3739 // Check for the empty array, and preallocate a small backing store if | 3740 // Check for the empty array, and preallocate a small backing store if |
3740 // possible. | 3741 // possible. |
3741 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 3742 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
3742 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 3743 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
3743 __ j(not_equal, &check_capacity); | 3744 __ j(not_equal, &check_capacity); |
3744 | 3745 |
3745 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3746 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3746 __ AllocateInNewSpace(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT); | 3747 __ Allocate(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT, |
| 3748 MacroAssembler::NEW_SPACE); |
3747 | 3749 |
3748 // Restore the key, which is known to be the array length. | 3750 // Restore the key, which is known to be the array length. |
3749 __ mov(ecx, Immediate(0)); | 3751 __ mov(ecx, Immediate(0)); |
3750 | 3752 |
3751 // eax: value | 3753 // eax: value |
3752 // ecx: key | 3754 // ecx: key |
3753 // edx: receiver | 3755 // edx: receiver |
3754 // edi: elements | 3756 // edi: elements |
3755 // Initialize the new FixedDoubleArray. | 3757 // Initialize the new FixedDoubleArray. |
3756 __ mov(FieldOperand(edi, JSObject::kMapOffset), | 3758 __ mov(FieldOperand(edi, JSObject::kMapOffset), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3802 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3804 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3803 } | 3805 } |
3804 } | 3806 } |
3805 | 3807 |
3806 | 3808 |
3807 #undef __ | 3809 #undef __ |
3808 | 3810 |
3809 } } // namespace v8::internal | 3811 } } // namespace v8::internal |
3810 | 3812 |
3811 #endif // V8_TARGET_ARCH_IA32 | 3813 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |