| 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 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 __ bind(&with_write_barrier); | 1427 __ bind(&with_write_barrier); |
| 1428 | 1428 |
| 1429 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); | 1429 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); |
| 1430 | 1430 |
| 1431 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { | 1431 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { |
| 1432 Label fast_object, not_fast_object; | 1432 Label fast_object, not_fast_object; |
| 1433 __ CheckFastObjectElements(rbx, ¬_fast_object, Label::kNear); | 1433 __ CheckFastObjectElements(rbx, ¬_fast_object, Label::kNear); |
| 1434 __ jmp(&fast_object); | 1434 __ jmp(&fast_object); |
| 1435 // In case of fast smi-only, convert to fast object, otherwise bail out. | 1435 // In case of fast smi-only, convert to fast object, otherwise bail out. |
| 1436 __ bind(¬_fast_object); | 1436 __ bind(¬_fast_object); |
| 1437 __ CheckFastSmiOnlyElements(rbx, &call_builtin); | 1437 __ CheckFastSmiElements(rbx, &call_builtin); |
| 1438 // rdx: receiver | 1438 // rdx: receiver |
| 1439 // rbx: map | 1439 // rbx: map |
| 1440 __ movq(r9, rdi); // Backup rdi as it is going to be trashed. | 1440 |
| 1441 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, | 1441 Label try_holey_map; |
| 1442 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 1442 FAST_ELEMENTS, | 1443 FAST_ELEMENTS, |
| 1443 rbx, | 1444 rbx, |
| 1444 rdi, | 1445 rdi, |
| 1446 &try_holey_map); |
| 1447 |
| 1448 ElementsTransitionGenerator:: |
| 1449 GenerateMapChangeElementsTransition(masm()); |
| 1450 // Restore edi. |
| 1451 __ movq(rdi, FieldOperand(rdx, JSArray::kElementsOffset)); |
| 1452 __ jmp(&fast_object); |
| 1453 |
| 1454 __ bind(&try_holey_map); |
| 1455 __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS, |
| 1456 FAST_HOLEY_ELEMENTS, |
| 1457 rbx, |
| 1458 rdi, |
| 1445 &call_builtin); | 1459 &call_builtin); |
| 1446 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm()); | 1460 ElementsTransitionGenerator:: |
| 1447 __ movq(rdi, r9); | 1461 GenerateMapChangeElementsTransition(masm()); |
| 1462 __ movq(rdi, FieldOperand(rdx, JSArray::kElementsOffset)); |
| 1448 __ bind(&fast_object); | 1463 __ bind(&fast_object); |
| 1449 } else { | 1464 } else { |
| 1450 __ CheckFastObjectElements(rbx, &call_builtin); | 1465 __ CheckFastObjectElements(rbx, &call_builtin); |
| 1451 } | 1466 } |
| 1452 | 1467 |
| 1453 // Save new length. | 1468 // Save new length. |
| 1454 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1469 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
| 1455 | 1470 |
| 1456 // Store the value. | 1471 // Store the value. |
| 1457 __ lea(rdx, FieldOperand(rdi, | 1472 __ lea(rdx, FieldOperand(rdi, |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3362 // Need to perform int-to-float conversion. | 3377 // Need to perform int-to-float conversion. |
| 3363 __ cvtlsi2ss(xmm0, rdx); | 3378 __ cvtlsi2ss(xmm0, rdx); |
| 3364 __ movss(Operand(rbx, rdi, times_4, 0), xmm0); | 3379 __ movss(Operand(rbx, rdi, times_4, 0), xmm0); |
| 3365 break; | 3380 break; |
| 3366 case EXTERNAL_DOUBLE_ELEMENTS: | 3381 case EXTERNAL_DOUBLE_ELEMENTS: |
| 3367 // Need to perform int-to-float conversion. | 3382 // Need to perform int-to-float conversion. |
| 3368 __ cvtlsi2sd(xmm0, rdx); | 3383 __ cvtlsi2sd(xmm0, rdx); |
| 3369 __ movsd(Operand(rbx, rdi, times_8, 0), xmm0); | 3384 __ movsd(Operand(rbx, rdi, times_8, 0), xmm0); |
| 3370 break; | 3385 break; |
| 3371 case FAST_ELEMENTS: | 3386 case FAST_ELEMENTS: |
| 3372 case FAST_SMI_ONLY_ELEMENTS: | 3387 case FAST_SMI_ELEMENTS: |
| 3373 case FAST_DOUBLE_ELEMENTS: | 3388 case FAST_DOUBLE_ELEMENTS: |
| 3389 case FAST_HOLEY_ELEMENTS: |
| 3390 case FAST_HOLEY_SMI_ELEMENTS: |
| 3391 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3374 case DICTIONARY_ELEMENTS: | 3392 case DICTIONARY_ELEMENTS: |
| 3375 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3393 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3376 UNREACHABLE(); | 3394 UNREACHABLE(); |
| 3377 break; | 3395 break; |
| 3378 } | 3396 } |
| 3379 __ ret(0); | 3397 __ ret(0); |
| 3380 | 3398 |
| 3381 // TODO(danno): handle heap number -> pixel array conversion | 3399 // TODO(danno): handle heap number -> pixel array conversion |
| 3382 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) { | 3400 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) { |
| 3383 __ bind(&check_heap_number); | 3401 __ bind(&check_heap_number); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3428 __ movw(Operand(rbx, rdi, times_2, 0), r8); | 3446 __ movw(Operand(rbx, rdi, times_2, 0), r8); |
| 3429 break; | 3447 break; |
| 3430 case EXTERNAL_INT_ELEMENTS: | 3448 case EXTERNAL_INT_ELEMENTS: |
| 3431 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3449 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3432 __ movl(Operand(rbx, rdi, times_4, 0), r8); | 3450 __ movl(Operand(rbx, rdi, times_4, 0), r8); |
| 3433 break; | 3451 break; |
| 3434 case EXTERNAL_PIXEL_ELEMENTS: | 3452 case EXTERNAL_PIXEL_ELEMENTS: |
| 3435 case EXTERNAL_FLOAT_ELEMENTS: | 3453 case EXTERNAL_FLOAT_ELEMENTS: |
| 3436 case EXTERNAL_DOUBLE_ELEMENTS: | 3454 case EXTERNAL_DOUBLE_ELEMENTS: |
| 3437 case FAST_ELEMENTS: | 3455 case FAST_ELEMENTS: |
| 3438 case FAST_SMI_ONLY_ELEMENTS: | 3456 case FAST_SMI_ELEMENTS: |
| 3439 case FAST_DOUBLE_ELEMENTS: | 3457 case FAST_DOUBLE_ELEMENTS: |
| 3458 case FAST_HOLEY_ELEMENTS: |
| 3459 case FAST_HOLEY_SMI_ELEMENTS: |
| 3460 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3440 case DICTIONARY_ELEMENTS: | 3461 case DICTIONARY_ELEMENTS: |
| 3441 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3462 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3442 UNREACHABLE(); | 3463 UNREACHABLE(); |
| 3443 break; | 3464 break; |
| 3444 } | 3465 } |
| 3445 __ ret(0); | 3466 __ ret(0); |
| 3446 } | 3467 } |
| 3447 } | 3468 } |
| 3448 | 3469 |
| 3449 // Slow case: call runtime. | 3470 // Slow case: call runtime. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3580 // ----------------------------------- | 3601 // ----------------------------------- |
| 3581 Label miss_force_generic, transition_elements_kind, finish_store, grow; | 3602 Label miss_force_generic, transition_elements_kind, finish_store, grow; |
| 3582 Label check_capacity, slow; | 3603 Label check_capacity, slow; |
| 3583 | 3604 |
| 3584 // This stub is meant to be tail-jumped to, the receiver must already | 3605 // This stub is meant to be tail-jumped to, the receiver must already |
| 3585 // have been verified by the caller to not be a smi. | 3606 // have been verified by the caller to not be a smi. |
| 3586 | 3607 |
| 3587 // Check that the key is a smi or a heap number convertible to a smi. | 3608 // Check that the key is a smi or a heap number convertible to a smi. |
| 3588 GenerateSmiKeyCheck(masm, rcx, rbx, xmm0, xmm1, &miss_force_generic); | 3609 GenerateSmiKeyCheck(masm, rcx, rbx, xmm0, xmm1, &miss_force_generic); |
| 3589 | 3610 |
| 3590 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { | 3611 if (IsFastSmiElementsKind(elements_kind)) { |
| 3591 __ JumpIfNotSmi(rax, &transition_elements_kind); | 3612 __ JumpIfNotSmi(rax, &transition_elements_kind); |
| 3592 } | 3613 } |
| 3593 | 3614 |
| 3594 // Get the elements array and make sure it is a fast element array, not 'cow'. | 3615 // Get the elements array and make sure it is a fast element array, not 'cow'. |
| 3595 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 3616 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 3596 // Check that the key is within bounds. | 3617 // Check that the key is within bounds. |
| 3597 if (is_js_array) { | 3618 if (is_js_array) { |
| 3598 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset)); | 3619 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset)); |
| 3599 if (grow_mode == ALLOW_JSARRAY_GROWTH) { | 3620 if (grow_mode == ALLOW_JSARRAY_GROWTH) { |
| 3600 __ j(above_equal, &grow); | 3621 __ j(above_equal, &grow); |
| 3601 } else { | 3622 } else { |
| 3602 __ j(above_equal, &miss_force_generic); | 3623 __ j(above_equal, &miss_force_generic); |
| 3603 } | 3624 } |
| 3604 } else { | 3625 } else { |
| 3605 __ SmiCompare(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | 3626 __ SmiCompare(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); |
| 3606 __ j(above_equal, &miss_force_generic); | 3627 __ j(above_equal, &miss_force_generic); |
| 3607 } | 3628 } |
| 3608 | 3629 |
| 3609 __ CompareRoot(FieldOperand(rdi, HeapObject::kMapOffset), | 3630 __ CompareRoot(FieldOperand(rdi, HeapObject::kMapOffset), |
| 3610 Heap::kFixedArrayMapRootIndex); | 3631 Heap::kFixedArrayMapRootIndex); |
| 3611 __ j(not_equal, &miss_force_generic); | 3632 __ j(not_equal, &miss_force_generic); |
| 3612 | 3633 |
| 3613 __ bind(&finish_store); | 3634 __ bind(&finish_store); |
| 3614 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { | 3635 if (IsFastSmiElementsKind(elements_kind)) { |
| 3615 __ SmiToInteger32(rcx, rcx); | 3636 __ SmiToInteger32(rcx, rcx); |
| 3616 __ movq(FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize), | 3637 __ movq(FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize), |
| 3617 rax); | 3638 rax); |
| 3618 } else { | 3639 } else { |
| 3619 // Do the store and update the write barrier. | 3640 // Do the store and update the write barrier. |
| 3620 ASSERT(elements_kind == FAST_ELEMENTS); | 3641 ASSERT(IsFastObjectElementsKind(elements_kind)); |
| 3621 __ SmiToInteger32(rcx, rcx); | 3642 __ SmiToInteger32(rcx, rcx); |
| 3622 __ lea(rcx, | 3643 __ lea(rcx, |
| 3623 FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize)); | 3644 FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize)); |
| 3624 __ movq(Operand(rcx, 0), rax); | 3645 __ movq(Operand(rcx, 0), rax); |
| 3625 // Make sure to preserve the value in register rax. | 3646 // Make sure to preserve the value in register rax. |
| 3626 __ movq(rbx, rax); | 3647 __ movq(rbx, rax); |
| 3627 __ RecordWrite(rdi, rcx, rbx, kDontSaveFPRegs); | 3648 __ RecordWrite(rdi, rcx, rbx, kDontSaveFPRegs); |
| 3628 } | 3649 } |
| 3629 | 3650 |
| 3630 // Done. | 3651 // Done. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3831 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3852 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
| 3832 } | 3853 } |
| 3833 } | 3854 } |
| 3834 | 3855 |
| 3835 | 3856 |
| 3836 #undef __ | 3857 #undef __ |
| 3837 | 3858 |
| 3838 } } // namespace v8::internal | 3859 } } // namespace v8::internal |
| 3839 | 3860 |
| 3840 #endif // V8_TARGET_ARCH_X64 | 3861 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |