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 3138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3149 // top forward. | 3149 // top forward. |
3150 // ebx: initial map | 3150 // ebx: initial map |
3151 ASSERT(function->has_initial_map()); | 3151 ASSERT(function->has_initial_map()); |
3152 int instance_size = function->initial_map()->instance_size(); | 3152 int instance_size = function->initial_map()->instance_size(); |
3153 #ifdef DEBUG | 3153 #ifdef DEBUG |
3154 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); | 3154 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); |
3155 __ shl(ecx, kPointerSizeLog2); | 3155 __ shl(ecx, kPointerSizeLog2); |
3156 __ cmp(ecx, Immediate(instance_size)); | 3156 __ cmp(ecx, Immediate(instance_size)); |
3157 __ Check(equal, "Instance size of initial map changed."); | 3157 __ Check(equal, "Instance size of initial map changed."); |
3158 #endif | 3158 #endif |
3159 __ AllocateInNewSpace(instance_size, edx, ecx, no_reg, | 3159 __ Allocate(instance_size, edx, ecx, no_reg, &generic_stub_call, |
3160 &generic_stub_call, NO_ALLOCATION_FLAGS); | 3160 NO_ALLOCATION_FLAGS); |
3161 | 3161 |
3162 // Allocated the JSObject, now initialize the fields and add the heap tag. | 3162 // Allocated the JSObject, now initialize the fields and add the heap tag. |
3163 // ebx: initial map | 3163 // ebx: initial map |
3164 // edx: JSObject (untagged) | 3164 // edx: JSObject (untagged) |
3165 __ mov(Operand(edx, JSObject::kMapOffset), ebx); | 3165 __ mov(Operand(edx, JSObject::kMapOffset), ebx); |
3166 __ mov(ebx, factory()->empty_fixed_array()); | 3166 __ mov(ebx, factory()->empty_fixed_array()); |
3167 __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx); | 3167 __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx); |
3168 __ mov(Operand(edx, JSObject::kElementsOffset), ebx); | 3168 __ mov(Operand(edx, JSObject::kElementsOffset), ebx); |
3169 | 3169 |
3170 // Push the allocated object to the stack. This is the object that will be | 3170 // 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... |
3624 // compare. | 3624 // compare. |
3625 __ j(not_equal, &miss_force_generic); | 3625 __ j(not_equal, &miss_force_generic); |
3626 | 3626 |
3627 // Check for the empty array, and preallocate a small backing store if | 3627 // Check for the empty array, and preallocate a small backing store if |
3628 // possible. | 3628 // possible. |
3629 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 3629 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
3630 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 3630 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
3631 __ j(not_equal, &check_capacity); | 3631 __ j(not_equal, &check_capacity); |
3632 | 3632 |
3633 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3633 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3634 __ AllocateInNewSpace(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT); | 3634 __ Allocate(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT); |
3635 // Restore the key, which is known to be the array length. | 3635 // Restore the key, which is known to be the array length. |
3636 | 3636 |
3637 // eax: value | 3637 // eax: value |
3638 // ecx: key | 3638 // ecx: key |
3639 // edx: receiver | 3639 // edx: receiver |
3640 // edi: elements | 3640 // edi: elements |
3641 // Make sure that the backing store can hold additional elements. | 3641 // Make sure that the backing store can hold additional elements. |
3642 __ mov(FieldOperand(edi, JSObject::kMapOffset), | 3642 __ mov(FieldOperand(edi, JSObject::kMapOffset), |
3643 Immediate(masm->isolate()->factory()->fixed_array_map())); | 3643 Immediate(masm->isolate()->factory()->fixed_array_map())); |
3644 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), | 3644 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3760 __ j(not_equal, &transition_elements_kind); | 3760 __ j(not_equal, &transition_elements_kind); |
3761 __ bind(&value_is_smi); | 3761 __ bind(&value_is_smi); |
3762 | 3762 |
3763 // Check for the empty array, and preallocate a small backing store if | 3763 // Check for the empty array, and preallocate a small backing store if |
3764 // possible. | 3764 // possible. |
3765 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 3765 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
3766 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 3766 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
3767 __ j(not_equal, &check_capacity); | 3767 __ j(not_equal, &check_capacity); |
3768 | 3768 |
3769 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3769 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3770 __ AllocateInNewSpace(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT); | 3770 __ Allocate(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT); |
3771 | 3771 |
3772 // Restore the key, which is known to be the array length. | 3772 // Restore the key, which is known to be the array length. |
3773 __ mov(ecx, Immediate(0)); | 3773 __ mov(ecx, Immediate(0)); |
3774 | 3774 |
3775 // eax: value | 3775 // eax: value |
3776 // ecx: key | 3776 // ecx: key |
3777 // edx: receiver | 3777 // edx: receiver |
3778 // edi: elements | 3778 // edi: elements |
3779 // Initialize the new FixedDoubleArray. | 3779 // Initialize the new FixedDoubleArray. |
3780 __ mov(FieldOperand(edi, JSObject::kMapOffset), | 3780 __ mov(FieldOperand(edi, JSObject::kMapOffset), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3826 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3826 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3827 } | 3827 } |
3828 } | 3828 } |
3829 | 3829 |
3830 | 3830 |
3831 #undef __ | 3831 #undef __ |
3832 | 3832 |
3833 } } // namespace v8::internal | 3833 } } // namespace v8::internal |
3834 | 3834 |
3835 #endif // V8_TARGET_ARCH_IA32 | 3835 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |