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 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2954 // Now allocate the JSObject in new space. | 2954 // Now allocate the JSObject in new space. |
2955 // rbx: initial map | 2955 // rbx: initial map |
2956 ASSERT(function->has_initial_map()); | 2956 ASSERT(function->has_initial_map()); |
2957 int instance_size = function->initial_map()->instance_size(); | 2957 int instance_size = function->initial_map()->instance_size(); |
2958 #ifdef DEBUG | 2958 #ifdef DEBUG |
2959 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); | 2959 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
2960 __ shl(rcx, Immediate(kPointerSizeLog2)); | 2960 __ shl(rcx, Immediate(kPointerSizeLog2)); |
2961 __ cmpq(rcx, Immediate(instance_size)); | 2961 __ cmpq(rcx, Immediate(instance_size)); |
2962 __ Check(equal, "Instance size of initial map changed."); | 2962 __ Check(equal, "Instance size of initial map changed."); |
2963 #endif | 2963 #endif |
2964 __ AllocateInNewSpace(instance_size, rdx, rcx, no_reg, | 2964 __ Allocate(instance_size, rdx, rcx, no_reg, &generic_stub_call, |
2965 &generic_stub_call, NO_ALLOCATION_FLAGS); | 2965 NO_ALLOCATION_FLAGS); |
2966 | 2966 |
2967 // Allocated the JSObject, now initialize the fields and add the heap tag. | 2967 // Allocated the JSObject, now initialize the fields and add the heap tag. |
2968 // rbx: initial map | 2968 // rbx: initial map |
2969 // rdx: JSObject (untagged) | 2969 // rdx: JSObject (untagged) |
2970 __ movq(Operand(rdx, JSObject::kMapOffset), rbx); | 2970 __ movq(Operand(rdx, JSObject::kMapOffset), rbx); |
2971 __ Move(rbx, factory()->empty_fixed_array()); | 2971 __ Move(rbx, factory()->empty_fixed_array()); |
2972 __ movq(Operand(rdx, JSObject::kPropertiesOffset), rbx); | 2972 __ movq(Operand(rdx, JSObject::kPropertiesOffset), rbx); |
2973 __ movq(Operand(rdx, JSObject::kElementsOffset), rbx); | 2973 __ movq(Operand(rdx, JSObject::kElementsOffset), rbx); |
2974 | 2974 |
2975 // rax: argc | 2975 // rax: argc |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 // compare. | 3389 // compare. |
3390 __ j(not_equal, &miss_force_generic); | 3390 __ j(not_equal, &miss_force_generic); |
3391 | 3391 |
3392 // Check for the empty array, and preallocate a small backing store if | 3392 // Check for the empty array, and preallocate a small backing store if |
3393 // possible. | 3393 // possible. |
3394 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 3394 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); |
3395 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); | 3395 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); |
3396 __ j(not_equal, &check_capacity); | 3396 __ j(not_equal, &check_capacity); |
3397 | 3397 |
3398 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3398 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3399 __ AllocateInNewSpace(size, rdi, rbx, r8, &slow, TAG_OBJECT); | 3399 __ Allocate(size, rdi, rbx, r8, &slow, TAG_OBJECT); |
3400 | 3400 |
3401 // rax: value | 3401 // rax: value |
3402 // rcx: key | 3402 // rcx: key |
3403 // rdx: receiver | 3403 // rdx: receiver |
3404 // rdi: elements | 3404 // rdi: elements |
3405 // Make sure that the backing store can hold additional elements. | 3405 // Make sure that the backing store can hold additional elements. |
3406 __ Move(FieldOperand(rdi, JSObject::kMapOffset), | 3406 __ Move(FieldOperand(rdi, JSObject::kMapOffset), |
3407 masm->isolate()->factory()->fixed_array_map()); | 3407 masm->isolate()->factory()->fixed_array_map()); |
3408 __ Move(FieldOperand(rdi, FixedArray::kLengthOffset), | 3408 __ Move(FieldOperand(rdi, FixedArray::kLengthOffset), |
3409 Smi::FromInt(JSArray::kPreallocatedArrayElements)); | 3409 Smi::FromInt(JSArray::kPreallocatedArrayElements)); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3523 __ j(not_equal, &transition_elements_kind); | 3523 __ j(not_equal, &transition_elements_kind); |
3524 __ bind(&value_is_smi); | 3524 __ bind(&value_is_smi); |
3525 | 3525 |
3526 // Check for the empty array, and preallocate a small backing store if | 3526 // Check for the empty array, and preallocate a small backing store if |
3527 // possible. | 3527 // possible. |
3528 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 3528 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); |
3529 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); | 3529 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex); |
3530 __ j(not_equal, &check_capacity); | 3530 __ j(not_equal, &check_capacity); |
3531 | 3531 |
3532 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3532 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3533 __ AllocateInNewSpace(size, rdi, rbx, r8, &slow, TAG_OBJECT); | 3533 __ Allocate(size, rdi, rbx, r8, &slow, TAG_OBJECT); |
3534 | 3534 |
3535 // rax: value | 3535 // rax: value |
3536 // rcx: key | 3536 // rcx: key |
3537 // rdx: receiver | 3537 // rdx: receiver |
3538 // rdi: elements | 3538 // rdi: elements |
3539 // Initialize the new FixedDoubleArray. Leave elements unitialized for | 3539 // Initialize the new FixedDoubleArray. Leave elements unitialized for |
3540 // efficiency, they are guaranteed to be initialized before use. | 3540 // efficiency, they are guaranteed to be initialized before use. |
3541 __ Move(FieldOperand(rdi, JSObject::kMapOffset), | 3541 __ Move(FieldOperand(rdi, JSObject::kMapOffset), |
3542 masm->isolate()->factory()->fixed_double_array_map()); | 3542 masm->isolate()->factory()->fixed_double_array_map()); |
3543 __ Move(FieldOperand(rdi, FixedDoubleArray::kLengthOffset), | 3543 __ Move(FieldOperand(rdi, FixedDoubleArray::kLengthOffset), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3582 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3583 } | 3583 } |
3584 } | 3584 } |
3585 | 3585 |
3586 | 3586 |
3587 #undef __ | 3587 #undef __ |
3588 | 3588 |
3589 } } // namespace v8::internal | 3589 } } // namespace v8::internal |
3590 | 3590 |
3591 #endif // V8_TARGET_ARCH_X64 | 3591 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |