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 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2978 // Now allocate the JSObject in new space. | 2978 // Now allocate the JSObject in new space. |
2979 // rbx: initial map | 2979 // rbx: initial map |
2980 ASSERT(function->has_initial_map()); | 2980 ASSERT(function->has_initial_map()); |
2981 int instance_size = function->initial_map()->instance_size(); | 2981 int instance_size = function->initial_map()->instance_size(); |
2982 #ifdef DEBUG | 2982 #ifdef DEBUG |
2983 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); | 2983 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
2984 __ shl(rcx, Immediate(kPointerSizeLog2)); | 2984 __ shl(rcx, Immediate(kPointerSizeLog2)); |
2985 __ cmpq(rcx, Immediate(instance_size)); | 2985 __ cmpq(rcx, Immediate(instance_size)); |
2986 __ Check(equal, "Instance size of initial map changed."); | 2986 __ Check(equal, "Instance size of initial map changed."); |
2987 #endif | 2987 #endif |
2988 __ AllocateInNewSpace(instance_size, rdx, rcx, no_reg, | 2988 __ Allocate(instance_size, rdx, rcx, no_reg, &generic_stub_call, |
2989 &generic_stub_call, NO_ALLOCATION_FLAGS); | 2989 NO_ALLOCATION_FLAGS); |
2990 | 2990 |
2991 // Allocated the JSObject, now initialize the fields and add the heap tag. | 2991 // Allocated the JSObject, now initialize the fields and add the heap tag. |
2992 // rbx: initial map | 2992 // rbx: initial map |
2993 // rdx: JSObject (untagged) | 2993 // rdx: JSObject (untagged) |
2994 __ movq(Operand(rdx, JSObject::kMapOffset), rbx); | 2994 __ movq(Operand(rdx, JSObject::kMapOffset), rbx); |
2995 __ Move(rbx, factory()->empty_fixed_array()); | 2995 __ Move(rbx, factory()->empty_fixed_array()); |
2996 __ movq(Operand(rdx, JSObject::kPropertiesOffset), rbx); | 2996 __ movq(Operand(rdx, JSObject::kPropertiesOffset), rbx); |
2997 __ movq(Operand(rdx, JSObject::kElementsOffset), rbx); | 2997 __ movq(Operand(rdx, JSObject::kElementsOffset), rbx); |
2998 | 2998 |
2999 // rax: argc | 2999 // rax: argc |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3413 // compare. | 3413 // compare. |
3414 __ j(not_equal, &miss_force_generic); | 3414 __ j(not_equal, &miss_force_generic); |
3415 | 3415 |
3416 // Check for the empty array, and preallocate a small backing store if | 3416 // Check for the empty array, and preallocate a small backing store if |
3417 // possible. | 3417 // possible. |
3418 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 3418 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); |
3419 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); | 3419 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); |
3420 __ j(not_equal, &check_capacity); | 3420 __ j(not_equal, &check_capacity); |
3421 | 3421 |
3422 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3422 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3423 __ AllocateInNewSpace(size, rdi, rbx, r8, &slow, TAG_OBJECT); | 3423 __ Allocate(size, rdi, rbx, r8, &slow, TAG_OBJECT); |
3424 | 3424 |
3425 // rax: value | 3425 // rax: value |
3426 // rcx: key | 3426 // rcx: key |
3427 // rdx: receiver | 3427 // rdx: receiver |
3428 // rdi: elements | 3428 // rdi: elements |
3429 // Make sure that the backing store can hold additional elements. | 3429 // Make sure that the backing store can hold additional elements. |
3430 __ Move(FieldOperand(rdi, JSObject::kMapOffset), | 3430 __ Move(FieldOperand(rdi, JSObject::kMapOffset), |
3431 masm->isolate()->factory()->fixed_array_map()); | 3431 masm->isolate()->factory()->fixed_array_map()); |
3432 __ Move(FieldOperand(rdi, FixedArray::kLengthOffset), | 3432 __ Move(FieldOperand(rdi, FixedArray::kLengthOffset), |
3433 Smi::FromInt(JSArray::kPreallocatedArrayElements)); | 3433 Smi::FromInt(JSArray::kPreallocatedArrayElements)); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3547 __ j(not_equal, &transition_elements_kind); | 3547 __ j(not_equal, &transition_elements_kind); |
3548 __ bind(&value_is_smi); | 3548 __ bind(&value_is_smi); |
3549 | 3549 |
3550 // Check for the empty array, and preallocate a small backing store if | 3550 // Check for the empty array, and preallocate a small backing store if |
3551 // possible. | 3551 // possible. |
3552 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 3552 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); |
3553 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); | 3553 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); |
3554 __ j(not_equal, &check_capacity); | 3554 __ j(not_equal, &check_capacity); |
3555 | 3555 |
3556 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3556 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3557 __ AllocateInNewSpace(size, rdi, rbx, r8, &slow, TAG_OBJECT); | 3557 __ Allocate(size, rdi, rbx, r8, &slow, TAG_OBJECT); |
3558 | 3558 |
3559 // rax: value | 3559 // rax: value |
3560 // rcx: key | 3560 // rcx: key |
3561 // rdx: receiver | 3561 // rdx: receiver |
3562 // rdi: elements | 3562 // rdi: elements |
3563 // Initialize the new FixedDoubleArray. Leave elements unitialized for | 3563 // Initialize the new FixedDoubleArray. Leave elements unitialized for |
3564 // efficiency, they are guaranteed to be initialized before use. | 3564 // efficiency, they are guaranteed to be initialized before use. |
3565 __ Move(FieldOperand(rdi, JSObject::kMapOffset), | 3565 __ Move(FieldOperand(rdi, JSObject::kMapOffset), |
3566 masm->isolate()->factory()->fixed_double_array_map()); | 3566 masm->isolate()->factory()->fixed_double_array_map()); |
3567 __ Move(FieldOperand(rdi, FixedDoubleArray::kLengthOffset), | 3567 __ Move(FieldOperand(rdi, FixedDoubleArray::kLengthOffset), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3606 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3606 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3607 } | 3607 } |
3608 } | 3608 } |
3609 | 3609 |
3610 | 3610 |
3611 #undef __ | 3611 #undef __ |
3612 | 3612 |
3613 } } // namespace v8::internal | 3613 } } // namespace v8::internal |
3614 | 3614 |
3615 #endif // V8_TARGET_ARCH_X64 | 3615 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |