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 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 // Subtracting from length accounts for one of them add one more. | 2499 // Subtracting from length accounts for one of them add one more. |
2500 __ movq(result, Operand(arguments, length, times_pointer_size, kPointerSize)); | 2500 __ movq(result, Operand(arguments, length, times_pointer_size, kPointerSize)); |
2501 } | 2501 } |
2502 | 2502 |
2503 | 2503 |
2504 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { | 2504 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
2505 Register result = ToRegister(instr->result()); | 2505 Register result = ToRegister(instr->result()); |
2506 LOperand* key = instr->key(); | 2506 LOperand* key = instr->key(); |
2507 if (!key->IsConstantOperand()) { | 2507 if (!key->IsConstantOperand()) { |
2508 Register key_reg = ToRegister(key); | 2508 Register key_reg = ToRegister(key); |
| 2509 // Even though the HLoad/StoreKeyedFastElement instructions force the input |
| 2510 // representation for the key to be an integer, the input gets replaced |
| 2511 // during bound check elimination with the index argument to the bounds |
| 2512 // check, which can be tagged, so that case must be handled here, too. |
2509 if (instr->hydrogen()->key()->representation().IsTagged()) { | 2513 if (instr->hydrogen()->key()->representation().IsTagged()) { |
2510 __ SmiToInteger64(key_reg, key_reg); | 2514 __ SmiToInteger64(key_reg, key_reg); |
2511 } else if (instr->hydrogen()->IsDehoisted()) { | 2515 } else if (instr->hydrogen()->IsDehoisted()) { |
2512 // Sign extend key because it could be a 32 bit negative value | 2516 // Sign extend key because it could be a 32 bit negative value |
2513 // and the dehoisted address computation happens in 64 bits | 2517 // and the dehoisted address computation happens in 64 bits |
2514 __ movsxlq(key_reg, key_reg); | 2518 __ movsxlq(key_reg, key_reg); |
2515 } | 2519 } |
2516 } | 2520 } |
2517 | 2521 |
2518 // Load the result. | 2522 // Load the result. |
(...skipping 16 matching lines...) Expand all Loading... |
2535 } | 2539 } |
2536 } | 2540 } |
2537 | 2541 |
2538 | 2542 |
2539 void LCodeGen::DoLoadKeyedFastDoubleElement( | 2543 void LCodeGen::DoLoadKeyedFastDoubleElement( |
2540 LLoadKeyedFastDoubleElement* instr) { | 2544 LLoadKeyedFastDoubleElement* instr) { |
2541 XMMRegister result(ToDoubleRegister(instr->result())); | 2545 XMMRegister result(ToDoubleRegister(instr->result())); |
2542 LOperand* key = instr->key(); | 2546 LOperand* key = instr->key(); |
2543 if (!key->IsConstantOperand()) { | 2547 if (!key->IsConstantOperand()) { |
2544 Register key_reg = ToRegister(key); | 2548 Register key_reg = ToRegister(key); |
| 2549 // Even though the HLoad/StoreKeyedFastElement instructions force the input |
| 2550 // representation for the key to be an integer, the input gets replaced |
| 2551 // during bound check elimination with the index argument to the bounds |
| 2552 // check, which can be tagged, so that case must be handled here, too. |
2545 if (instr->hydrogen()->key()->representation().IsTagged()) { | 2553 if (instr->hydrogen()->key()->representation().IsTagged()) { |
2546 __ SmiToInteger64(key_reg, key_reg); | 2554 __ SmiToInteger64(key_reg, key_reg); |
2547 } else if (instr->hydrogen()->IsDehoisted()) { | 2555 } else if (instr->hydrogen()->IsDehoisted()) { |
2548 // Sign extend key because it could be a 32 bit negative value | 2556 // Sign extend key because it could be a 32 bit negative value |
2549 // and the dehoisted address computation happens in 64 bits | 2557 // and the dehoisted address computation happens in 64 bits |
2550 __ movsxlq(key_reg, key_reg); | 2558 __ movsxlq(key_reg, key_reg); |
2551 } | 2559 } |
2552 } | 2560 } |
2553 | 2561 |
2554 if (instr->hydrogen()->RequiresHoleCheck()) { | 2562 if (instr->hydrogen()->RequiresHoleCheck()) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 } | 2607 } |
2600 } | 2608 } |
2601 | 2609 |
2602 | 2610 |
2603 void LCodeGen::DoLoadKeyedSpecializedArrayElement( | 2611 void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
2604 LLoadKeyedSpecializedArrayElement* instr) { | 2612 LLoadKeyedSpecializedArrayElement* instr) { |
2605 ElementsKind elements_kind = instr->elements_kind(); | 2613 ElementsKind elements_kind = instr->elements_kind(); |
2606 LOperand* key = instr->key(); | 2614 LOperand* key = instr->key(); |
2607 if (!key->IsConstantOperand()) { | 2615 if (!key->IsConstantOperand()) { |
2608 Register key_reg = ToRegister(key); | 2616 Register key_reg = ToRegister(key); |
| 2617 // Even though the HLoad/StoreKeyedFastElement instructions force the input |
| 2618 // representation for the key to be an integer, the input gets replaced |
| 2619 // during bound check elimination with the index argument to the bounds |
| 2620 // check, which can be tagged, so that case must be handled here, too. |
2609 if (instr->hydrogen()->key()->representation().IsTagged()) { | 2621 if (instr->hydrogen()->key()->representation().IsTagged()) { |
2610 __ SmiToInteger64(key_reg, key_reg); | 2622 __ SmiToInteger64(key_reg, key_reg); |
2611 } else if (instr->hydrogen()->IsDehoisted()) { | 2623 } else if (instr->hydrogen()->IsDehoisted()) { |
2612 // Sign extend key because it could be a 32 bit negative value | 2624 // Sign extend key because it could be a 32 bit negative value |
2613 // and the dehoisted address computation happens in 64 bits | 2625 // and the dehoisted address computation happens in 64 bits |
2614 __ movsxlq(key_reg, key_reg); | 2626 __ movsxlq(key_reg, key_reg); |
2615 } | 2627 } |
2616 } | 2628 } |
2617 Operand operand(BuildFastArrayOperand( | 2629 Operand operand(BuildFastArrayOperand( |
2618 instr->external_pointer(), | 2630 instr->external_pointer(), |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3560 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3549 } | 3561 } |
3550 | 3562 |
3551 | 3563 |
3552 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3564 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
3553 LStoreKeyedSpecializedArrayElement* instr) { | 3565 LStoreKeyedSpecializedArrayElement* instr) { |
3554 ElementsKind elements_kind = instr->elements_kind(); | 3566 ElementsKind elements_kind = instr->elements_kind(); |
3555 LOperand* key = instr->key(); | 3567 LOperand* key = instr->key(); |
3556 if (!key->IsConstantOperand()) { | 3568 if (!key->IsConstantOperand()) { |
3557 Register key_reg = ToRegister(key); | 3569 Register key_reg = ToRegister(key); |
| 3570 // Even though the HLoad/StoreKeyedFastElement instructions force the input |
| 3571 // representation for the key to be an integer, the input gets replaced |
| 3572 // during bound check elimination with the index argument to the bounds |
| 3573 // check, which can be tagged, so that case must be handled here, too. |
3558 if (instr->hydrogen()->key()->representation().IsTagged()) { | 3574 if (instr->hydrogen()->key()->representation().IsTagged()) { |
3559 __ SmiToInteger64(key_reg, key_reg); | 3575 __ SmiToInteger64(key_reg, key_reg); |
3560 } else if (instr->hydrogen()->IsDehoisted()) { | 3576 } else if (instr->hydrogen()->IsDehoisted()) { |
3561 // Sign extend key because it could be a 32 bit negative value | 3577 // Sign extend key because it could be a 32 bit negative value |
3562 // and the dehoisted address computation happens in 64 bits | 3578 // and the dehoisted address computation happens in 64 bits |
3563 __ movsxlq(key_reg, key_reg); | 3579 __ movsxlq(key_reg, key_reg); |
3564 } | 3580 } |
3565 } | 3581 } |
3566 Operand operand(BuildFastArrayOperand( | 3582 Operand operand(BuildFastArrayOperand( |
3567 instr->external_pointer(), | 3583 instr->external_pointer(), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3610 | 3626 |
3611 | 3627 |
3612 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3628 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3613 if (instr->length()->IsRegister()) { | 3629 if (instr->length()->IsRegister()) { |
3614 Register reg = ToRegister(instr->length()); | 3630 Register reg = ToRegister(instr->length()); |
3615 if (FLAG_debug_code && | 3631 if (FLAG_debug_code && |
3616 !instr->hydrogen()->index()->representation().IsTagged()) { | 3632 !instr->hydrogen()->index()->representation().IsTagged()) { |
3617 __ AbortIfNotZeroExtended(reg); | 3633 __ AbortIfNotZeroExtended(reg); |
3618 } | 3634 } |
3619 if (instr->index()->IsConstantOperand()) { | 3635 if (instr->index()->IsConstantOperand()) { |
3620 __ cmpq(reg, | 3636 int constant_index = |
3621 Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); | 3637 ToInteger32(LConstantOperand::cast(instr->index())); |
| 3638 if (instr->hydrogen()->length()->representation().IsTagged()) { |
| 3639 __ Cmp(reg, Smi::FromInt(constant_index)); |
| 3640 } else { |
| 3641 __ cmpq(reg, Immediate(constant_index)); |
| 3642 } |
3622 } else { | 3643 } else { |
3623 Register reg2 = ToRegister(instr->index()); | 3644 Register reg2 = ToRegister(instr->index()); |
3624 if (FLAG_debug_code && | 3645 if (FLAG_debug_code && |
3625 !instr->hydrogen()->index()->representation().IsTagged()) { | 3646 !instr->hydrogen()->index()->representation().IsTagged()) { |
3626 __ AbortIfNotZeroExtended(reg2); | 3647 __ AbortIfNotZeroExtended(reg2); |
3627 } | 3648 } |
3628 __ cmpq(reg, reg2); | 3649 __ cmpq(reg, reg2); |
3629 } | 3650 } |
3630 } else { | 3651 } else { |
3631 if (instr->index()->IsConstantOperand()) { | 3652 if (instr->index()->IsConstantOperand()) { |
3632 __ cmpq(ToOperand(instr->length()), | 3653 __ cmpq(ToOperand(instr->length()), |
3633 Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); | 3654 Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); |
3634 } else { | 3655 } else { |
3635 __ cmpq(ToOperand(instr->length()), ToRegister(instr->index())); | 3656 __ cmpq(ToOperand(instr->length()), ToRegister(instr->index())); |
3636 } | 3657 } |
3637 } | 3658 } |
3638 DeoptimizeIf(below_equal, instr->environment()); | 3659 DeoptimizeIf(below_equal, instr->environment()); |
3639 } | 3660 } |
3640 | 3661 |
3641 | 3662 |
3642 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { | 3663 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
3643 Register value = ToRegister(instr->value()); | 3664 Register value = ToRegister(instr->value()); |
3644 Register elements = ToRegister(instr->object()); | 3665 Register elements = ToRegister(instr->object()); |
3645 LOperand* key = instr->key(); | 3666 LOperand* key = instr->key(); |
3646 if (!key->IsConstantOperand()) { | 3667 if (!key->IsConstantOperand()) { |
3647 Register key_reg = ToRegister(key); | 3668 Register key_reg = ToRegister(key); |
| 3669 // Even though the HLoad/StoreKeyedFastElement instructions force the input |
| 3670 // representation for the key to be an integer, the input gets replaced |
| 3671 // during bound check elimination with the index argument to the bounds |
| 3672 // check, which can be tagged, so that case must be handled here, too. |
3648 if (instr->hydrogen()->key()->representation().IsTagged()) { | 3673 if (instr->hydrogen()->key()->representation().IsTagged()) { |
3649 __ SmiToInteger64(key_reg, key_reg); | 3674 __ SmiToInteger64(key_reg, key_reg); |
3650 } else if (instr->hydrogen()->IsDehoisted()) { | 3675 } else if (instr->hydrogen()->IsDehoisted()) { |
3651 // Sign extend key because it could be a 32 bit negative value | 3676 // Sign extend key because it could be a 32 bit negative value |
3652 // and the dehoisted address computation happens in 64 bits | 3677 // and the dehoisted address computation happens in 64 bits |
3653 __ movsxlq(key_reg, key_reg); | 3678 __ movsxlq(key_reg, key_reg); |
3654 } | 3679 } |
3655 } | 3680 } |
3656 | 3681 |
3657 Operand operand = | 3682 Operand operand = |
(...skipping 23 matching lines...) Expand all Loading... |
3681 } | 3706 } |
3682 } | 3707 } |
3683 | 3708 |
3684 | 3709 |
3685 void LCodeGen::DoStoreKeyedFastDoubleElement( | 3710 void LCodeGen::DoStoreKeyedFastDoubleElement( |
3686 LStoreKeyedFastDoubleElement* instr) { | 3711 LStoreKeyedFastDoubleElement* instr) { |
3687 XMMRegister value = ToDoubleRegister(instr->value()); | 3712 XMMRegister value = ToDoubleRegister(instr->value()); |
3688 LOperand* key = instr->key(); | 3713 LOperand* key = instr->key(); |
3689 if (!key->IsConstantOperand()) { | 3714 if (!key->IsConstantOperand()) { |
3690 Register key_reg = ToRegister(key); | 3715 Register key_reg = ToRegister(key); |
| 3716 // Even though the HLoad/StoreKeyedFastElement instructions force the input |
| 3717 // representation for the key to be an integer, the input gets replaced |
| 3718 // during bound check elimination with the index argument to the bounds |
| 3719 // check, which can be tagged, so that case must be handled here, too. |
3691 if (instr->hydrogen()->key()->representation().IsTagged()) { | 3720 if (instr->hydrogen()->key()->representation().IsTagged()) { |
3692 __ SmiToInteger64(key_reg, key_reg); | 3721 __ SmiToInteger64(key_reg, key_reg); |
3693 } else if (instr->hydrogen()->IsDehoisted()) { | 3722 } else if (instr->hydrogen()->IsDehoisted()) { |
3694 // Sign extend key because it could be a 32 bit negative value | 3723 // Sign extend key because it could be a 32 bit negative value |
3695 // and the dehoisted address computation happens in 64 bits | 3724 // and the dehoisted address computation happens in 64 bits |
3696 __ movsxlq(key_reg, key_reg); | 3725 __ movsxlq(key_reg, key_reg); |
3697 } | 3726 } |
3698 } | 3727 } |
3699 | 3728 |
3700 if (instr->NeedsCanonicalization()) { | 3729 if (instr->NeedsCanonicalization()) { |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5077 FixedArray::kHeaderSize - kPointerSize)); | 5106 FixedArray::kHeaderSize - kPointerSize)); |
5078 __ bind(&done); | 5107 __ bind(&done); |
5079 } | 5108 } |
5080 | 5109 |
5081 | 5110 |
5082 #undef __ | 5111 #undef __ |
5083 | 5112 |
5084 } } // namespace v8::internal | 5113 } } // namespace v8::internal |
5085 | 5114 |
5086 #endif // V8_TARGET_ARCH_X64 | 5115 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |