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