| 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 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 } | 2521 } |
| 2522 | 2522 |
| 2523 | 2523 |
| 2524 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { | 2524 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
| 2525 Register elements = ToRegister(instr->elements()); | 2525 Register elements = ToRegister(instr->elements()); |
| 2526 Register key = EmitLoadRegister(instr->key(), scratch0()); | 2526 Register key = EmitLoadRegister(instr->key(), scratch0()); |
| 2527 Register result = ToRegister(instr->result()); | 2527 Register result = ToRegister(instr->result()); |
| 2528 Register scratch = scratch0(); | 2528 Register scratch = scratch0(); |
| 2529 | 2529 |
| 2530 // Load the result. | 2530 // Load the result. |
| 2531 __ sll(scratch, key, kPointerSizeLog2); // Key indexes words. | 2531 if (instr->hydrogen()->key()->representation().IsTagged()) { |
| 2532 __ addu(scratch, elements, scratch); | 2532 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); |
| 2533 __ addu(scratch, elements, scratch); |
| 2534 } else { |
| 2535 __ sll(scratch, key, kPointerSizeLog2); |
| 2536 __ addu(scratch, elements, scratch); |
| 2537 } |
| 2533 uint32_t offset = FixedArray::kHeaderSize + | 2538 uint32_t offset = FixedArray::kHeaderSize + |
| 2534 (instr->additional_index() << kPointerSizeLog2); | 2539 (instr->additional_index() << kPointerSizeLog2); |
| 2535 __ lw(result, FieldMemOperand(scratch, offset)); | 2540 __ lw(result, FieldMemOperand(scratch, offset)); |
| 2536 | 2541 |
| 2537 // Check for the hole value. | 2542 // Check for the hole value. |
| 2538 if (instr->hydrogen()->RequiresHoleCheck()) { | 2543 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2539 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { | 2544 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { |
| 2540 __ And(scratch, result, Operand(kSmiTagMask)); | 2545 __ And(scratch, result, Operand(kSmiTagMask)); |
| 2541 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); | 2546 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); |
| 2542 } else { | 2547 } else { |
| 2543 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 2548 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
| 2544 DeoptimizeIf(eq, instr->environment(), result, Operand(scratch)); | 2549 DeoptimizeIf(eq, instr->environment(), result, Operand(scratch)); |
| 2545 } | 2550 } |
| 2546 } | 2551 } |
| 2547 } | 2552 } |
| 2548 | 2553 |
| 2549 | 2554 |
| 2550 void LCodeGen::DoLoadKeyedFastDoubleElement( | 2555 void LCodeGen::DoLoadKeyedFastDoubleElement( |
| 2551 LLoadKeyedFastDoubleElement* instr) { | 2556 LLoadKeyedFastDoubleElement* instr) { |
| 2552 Register elements = ToRegister(instr->elements()); | 2557 Register elements = ToRegister(instr->elements()); |
| 2553 bool key_is_constant = instr->key()->IsConstantOperand(); | 2558 bool key_is_constant = instr->key()->IsConstantOperand(); |
| 2554 Register key = no_reg; | 2559 Register key = no_reg; |
| 2555 DoubleRegister result = ToDoubleRegister(instr->result()); | 2560 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 2556 Register scratch = scratch0(); | 2561 Register scratch = scratch0(); |
| 2557 | 2562 |
| 2558 int shift_size = | 2563 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); |
| 2559 ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); | 2564 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) |
| 2565 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 2560 int constant_key = 0; | 2566 int constant_key = 0; |
| 2561 if (key_is_constant) { | 2567 if (key_is_constant) { |
| 2562 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 2568 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| 2563 if (constant_key & 0xF0000000) { | 2569 if (constant_key & 0xF0000000) { |
| 2564 Abort("array index constant value too big."); | 2570 Abort("array index constant value too big."); |
| 2565 } | 2571 } |
| 2566 } else { | 2572 } else { |
| 2567 key = ToRegister(instr->key()); | 2573 key = ToRegister(instr->key()); |
| 2568 } | 2574 } |
| 2569 | 2575 |
| 2570 if (key_is_constant) { | 2576 if (key_is_constant) { |
| 2571 __ Addu(elements, elements, | 2577 __ Addu(elements, elements, |
| 2572 Operand(((constant_key + instr->additional_index()) << shift_size) + | 2578 Operand(((constant_key + instr->additional_index()) << |
| 2579 element_size_shift) + |
| 2573 FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 2580 FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
| 2574 } else { | 2581 } else { |
| 2575 __ sll(scratch, key, shift_size); | 2582 __ sll(scratch, key, shift_size); |
| 2576 __ Addu(elements, elements, Operand(scratch)); | 2583 __ Addu(elements, elements, Operand(scratch)); |
| 2577 __ Addu(elements, elements, | 2584 __ Addu(elements, elements, |
| 2578 Operand((FixedDoubleArray::kHeaderSize - kHeapObjectTag) + | 2585 Operand((FixedDoubleArray::kHeaderSize - kHeapObjectTag) + |
| 2579 (instr->additional_index() << shift_size))); | 2586 (instr->additional_index() << element_size_shift))); |
| 2580 } | 2587 } |
| 2581 | 2588 |
| 2582 if (instr->hydrogen()->RequiresHoleCheck()) { | 2589 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2583 __ lw(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); | 2590 __ lw(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); |
| 2584 DeoptimizeIf(eq, instr->environment(), scratch, Operand(kHoleNanUpper32)); | 2591 DeoptimizeIf(eq, instr->environment(), scratch, Operand(kHoleNanUpper32)); |
| 2585 } | 2592 } |
| 2586 | 2593 |
| 2587 __ ldc1(result, MemOperand(elements)); | 2594 __ ldc1(result, MemOperand(elements)); |
| 2588 } | 2595 } |
| 2589 | 2596 |
| 2590 | 2597 |
| 2598 MemOperand LCodeGen::PrepareKeyedOperand(Register key, |
| 2599 Register base, |
| 2600 bool key_is_constant, |
| 2601 int constant_key, |
| 2602 int element_size, |
| 2603 int shift_size, |
| 2604 int additional_index, |
| 2605 int additional_offset) { |
| 2606 if (additional_index != 0 && !key_is_constant) { |
| 2607 additional_index *= 1 << (element_size - shift_size); |
| 2608 __ Addu(scratch0(), key, Operand(additional_index)); |
| 2609 } |
| 2610 |
| 2611 if (key_is_constant) { |
| 2612 return MemOperand(base, |
| 2613 (constant_key << element_size) + additional_offset); |
| 2614 } |
| 2615 |
| 2616 if (additional_index == 0) { |
| 2617 if (shift_size >= 0) { |
| 2618 __ sll(scratch0(), key, shift_size); |
| 2619 __ Addu(scratch0(), base, scratch0()); |
| 2620 return MemOperand(scratch0()); |
| 2621 } else { |
| 2622 ASSERT_EQ(-1, shift_size); |
| 2623 __ srl(scratch0(), key, 1); |
| 2624 __ Addu(scratch0(), base, scratch0()); |
| 2625 return MemOperand(scratch0()); |
| 2626 } |
| 2627 } |
| 2628 |
| 2629 if (shift_size >= 0) { |
| 2630 __ sll(scratch0(), scratch0(), shift_size); |
| 2631 __ Addu(scratch0(), base, scratch0()); |
| 2632 return MemOperand(scratch0()); |
| 2633 } else { |
| 2634 ASSERT_EQ(-1, shift_size); |
| 2635 __ srl(scratch0(), scratch0(), 1); |
| 2636 __ Addu(scratch0(), base, scratch0()); |
| 2637 return MemOperand(scratch0()); |
| 2638 } |
| 2639 } |
| 2640 |
| 2641 |
| 2591 void LCodeGen::DoLoadKeyedSpecializedArrayElement( | 2642 void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
| 2592 LLoadKeyedSpecializedArrayElement* instr) { | 2643 LLoadKeyedSpecializedArrayElement* instr) { |
| 2593 Register external_pointer = ToRegister(instr->external_pointer()); | 2644 Register external_pointer = ToRegister(instr->external_pointer()); |
| 2594 Register key = no_reg; | 2645 Register key = no_reg; |
| 2595 ElementsKind elements_kind = instr->elements_kind(); | 2646 ElementsKind elements_kind = instr->elements_kind(); |
| 2596 bool key_is_constant = instr->key()->IsConstantOperand(); | 2647 bool key_is_constant = instr->key()->IsConstantOperand(); |
| 2597 int constant_key = 0; | 2648 int constant_key = 0; |
| 2598 if (key_is_constant) { | 2649 if (key_is_constant) { |
| 2599 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 2650 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| 2600 if (constant_key & 0xF0000000) { | 2651 if (constant_key & 0xF0000000) { |
| 2601 Abort("array index constant value too big."); | 2652 Abort("array index constant value too big."); |
| 2602 } | 2653 } |
| 2603 } else { | 2654 } else { |
| 2604 key = ToRegister(instr->key()); | 2655 key = ToRegister(instr->key()); |
| 2605 } | 2656 } |
| 2606 int shift_size = ElementsKindToShiftSize(elements_kind); | 2657 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 2607 int additional_offset = instr->additional_index() << shift_size; | 2658 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) |
| 2659 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 2660 int additional_offset = instr->additional_index() << element_size_shift; |
| 2608 | 2661 |
| 2609 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 2662 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 2610 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 2663 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
| 2611 FPURegister result = ToDoubleRegister(instr->result()); | 2664 FPURegister result = ToDoubleRegister(instr->result()); |
| 2612 if (key_is_constant) { | 2665 if (key_is_constant) { |
| 2613 __ Addu(scratch0(), external_pointer, constant_key << shift_size); | 2666 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); |
| 2614 } else { | 2667 } else { |
| 2615 __ sll(scratch0(), key, shift_size); | 2668 __ sll(scratch0(), key, shift_size); |
| 2616 __ Addu(scratch0(), scratch0(), external_pointer); | 2669 __ Addu(scratch0(), scratch0(), external_pointer); |
| 2617 } | 2670 } |
| 2618 | 2671 |
| 2619 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 2672 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
| 2620 __ lwc1(result, MemOperand(scratch0(), additional_offset)); | 2673 __ lwc1(result, MemOperand(scratch0(), additional_offset)); |
| 2621 __ cvt_d_s(result, result); | 2674 __ cvt_d_s(result, result); |
| 2622 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 2675 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
| 2623 __ ldc1(result, MemOperand(scratch0(), additional_offset)); | 2676 __ ldc1(result, MemOperand(scratch0(), additional_offset)); |
| 2624 } | 2677 } |
| 2625 } else { | 2678 } else { |
| 2626 Register result = ToRegister(instr->result()); | 2679 Register result = ToRegister(instr->result()); |
| 2627 Register scratch = scratch0(); | 2680 MemOperand mem_operand = PrepareKeyedOperand( |
| 2628 if (instr->additional_index() != 0 && !key_is_constant) { | 2681 key, external_pointer, key_is_constant, constant_key, |
| 2629 __ Addu(scratch, key, instr->additional_index()); | 2682 element_size_shift, shift_size, |
| 2630 } | 2683 instr->additional_index(), additional_offset); |
| 2631 MemOperand mem_operand(zero_reg); | |
| 2632 if (key_is_constant) { | |
| 2633 mem_operand = | |
| 2634 MemOperand(external_pointer, | |
| 2635 (constant_key << shift_size) + additional_offset); | |
| 2636 } else { | |
| 2637 if (instr->additional_index() == 0) { | |
| 2638 __ sll(scratch, key, shift_size); | |
| 2639 } else { | |
| 2640 __ sll(scratch, scratch, shift_size); | |
| 2641 } | |
| 2642 __ Addu(scratch, scratch, external_pointer); | |
| 2643 mem_operand = MemOperand(scratch); | |
| 2644 } | |
| 2645 switch (elements_kind) { | 2684 switch (elements_kind) { |
| 2646 case EXTERNAL_BYTE_ELEMENTS: | 2685 case EXTERNAL_BYTE_ELEMENTS: |
| 2647 __ lb(result, mem_operand); | 2686 __ lb(result, mem_operand); |
| 2648 break; | 2687 break; |
| 2649 case EXTERNAL_PIXEL_ELEMENTS: | 2688 case EXTERNAL_PIXEL_ELEMENTS: |
| 2650 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2689 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 2651 __ lbu(result, mem_operand); | 2690 __ lbu(result, mem_operand); |
| 2652 break; | 2691 break; |
| 2653 case EXTERNAL_SHORT_ELEMENTS: | 2692 case EXTERNAL_SHORT_ELEMENTS: |
| 2654 __ lh(result, mem_operand); | 2693 __ lh(result, mem_operand); |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3565 | 3604 |
| 3566 // Do the store. | 3605 // Do the store. |
| 3567 if (instr->key()->IsConstantOperand()) { | 3606 if (instr->key()->IsConstantOperand()) { |
| 3568 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 3607 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 3569 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); | 3608 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
| 3570 int offset = | 3609 int offset = |
| 3571 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize | 3610 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize |
| 3572 + FixedArray::kHeaderSize; | 3611 + FixedArray::kHeaderSize; |
| 3573 __ sw(value, FieldMemOperand(elements, offset)); | 3612 __ sw(value, FieldMemOperand(elements, offset)); |
| 3574 } else { | 3613 } else { |
| 3575 __ sll(scratch, key, kPointerSizeLog2); | 3614 if (instr->hydrogen()->key()->representation().IsTagged()) { |
| 3576 __ addu(scratch, elements, scratch); | 3615 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); |
| 3616 __ addu(scratch, elements, scratch); |
| 3617 } else { |
| 3618 __ sll(scratch, key, kPointerSizeLog2); |
| 3619 __ addu(scratch, elements, scratch); |
| 3620 } |
| 3577 if (instr->additional_index() != 0) { | 3621 if (instr->additional_index() != 0) { |
| 3578 __ Addu(scratch, | 3622 __ Addu(scratch, |
| 3579 scratch, | 3623 scratch, |
| 3580 instr->additional_index() << kPointerSizeLog2); | 3624 instr->additional_index() << kPointerSizeLog2); |
| 3581 } | 3625 } |
| 3582 __ sw(value, FieldMemOperand(scratch, FixedArray::kHeaderSize)); | 3626 __ sw(value, FieldMemOperand(scratch, FixedArray::kHeaderSize)); |
| 3583 } | 3627 } |
| 3584 | 3628 |
| 3585 if (instr->hydrogen()->NeedsWriteBarrier()) { | 3629 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 3586 HType type = instr->hydrogen()->value()->type(); | 3630 HType type = instr->hydrogen()->value()->type(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3612 // Calculate the effective address of the slot in the array to store the | 3656 // Calculate the effective address of the slot in the array to store the |
| 3613 // double value. | 3657 // double value. |
| 3614 if (key_is_constant) { | 3658 if (key_is_constant) { |
| 3615 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 3659 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| 3616 if (constant_key & 0xF0000000) { | 3660 if (constant_key & 0xF0000000) { |
| 3617 Abort("array index constant value too big."); | 3661 Abort("array index constant value too big."); |
| 3618 } | 3662 } |
| 3619 } else { | 3663 } else { |
| 3620 key = ToRegister(instr->key()); | 3664 key = ToRegister(instr->key()); |
| 3621 } | 3665 } |
| 3622 int shift_size = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); | 3666 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); |
| 3667 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) |
| 3668 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 3623 if (key_is_constant) { | 3669 if (key_is_constant) { |
| 3624 __ Addu(scratch, elements, Operand((constant_key << shift_size) + | 3670 __ Addu(scratch, elements, Operand((constant_key << element_size_shift) + |
| 3625 FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 3671 FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
| 3626 } else { | 3672 } else { |
| 3627 __ sll(scratch, key, shift_size); | 3673 __ sll(scratch, key, shift_size); |
| 3628 __ Addu(scratch, elements, Operand(scratch)); | 3674 __ Addu(scratch, elements, Operand(scratch)); |
| 3629 __ Addu(scratch, scratch, | 3675 __ Addu(scratch, scratch, |
| 3630 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 3676 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
| 3631 } | 3677 } |
| 3632 | 3678 |
| 3633 if (instr->NeedsCanonicalization()) { | 3679 if (instr->NeedsCanonicalization()) { |
| 3634 Label is_nan; | 3680 Label is_nan; |
| 3635 // Check for NaN. All NaNs must be canonicalized. | 3681 // Check for NaN. All NaNs must be canonicalized. |
| 3636 __ BranchF(NULL, &is_nan, eq, value, value); | 3682 __ BranchF(NULL, &is_nan, eq, value, value); |
| 3637 __ Branch(¬_nan); | 3683 __ Branch(¬_nan); |
| 3638 | 3684 |
| 3639 // Only load canonical NaN if the comparison above set the overflow. | 3685 // Only load canonical NaN if the comparison above set the overflow. |
| 3640 __ bind(&is_nan); | 3686 __ bind(&is_nan); |
| 3641 __ Move(value, FixedDoubleArray::canonical_not_the_hole_nan_as_double()); | 3687 __ Move(value, FixedDoubleArray::canonical_not_the_hole_nan_as_double()); |
| 3642 } | 3688 } |
| 3643 | 3689 |
| 3644 __ bind(¬_nan); | 3690 __ bind(¬_nan); |
| 3645 __ sdc1(value, MemOperand(scratch, instr->additional_index() << shift_size)); | 3691 __ sdc1(value, MemOperand(scratch, instr->additional_index() << |
| 3692 element_size_shift)); |
| 3646 } | 3693 } |
| 3647 | 3694 |
| 3648 | 3695 |
| 3649 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3696 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
| 3650 LStoreKeyedSpecializedArrayElement* instr) { | 3697 LStoreKeyedSpecializedArrayElement* instr) { |
| 3651 | 3698 |
| 3652 Register external_pointer = ToRegister(instr->external_pointer()); | 3699 Register external_pointer = ToRegister(instr->external_pointer()); |
| 3653 Register key = no_reg; | 3700 Register key = no_reg; |
| 3654 ElementsKind elements_kind = instr->elements_kind(); | 3701 ElementsKind elements_kind = instr->elements_kind(); |
| 3655 bool key_is_constant = instr->key()->IsConstantOperand(); | 3702 bool key_is_constant = instr->key()->IsConstantOperand(); |
| 3656 int constant_key = 0; | 3703 int constant_key = 0; |
| 3657 if (key_is_constant) { | 3704 if (key_is_constant) { |
| 3658 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 3705 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| 3659 if (constant_key & 0xF0000000) { | 3706 if (constant_key & 0xF0000000) { |
| 3660 Abort("array index constant value too big."); | 3707 Abort("array index constant value too big."); |
| 3661 } | 3708 } |
| 3662 } else { | 3709 } else { |
| 3663 key = ToRegister(instr->key()); | 3710 key = ToRegister(instr->key()); |
| 3664 } | 3711 } |
| 3665 int shift_size = ElementsKindToShiftSize(elements_kind); | 3712 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 3666 int additional_offset = instr->additional_index() << shift_size; | 3713 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) |
| 3714 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 3715 int additional_offset = instr->additional_index() << element_size_shift; |
| 3667 | 3716 |
| 3668 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 3717 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 3669 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3718 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
| 3670 FPURegister value(ToDoubleRegister(instr->value())); | 3719 FPURegister value(ToDoubleRegister(instr->value())); |
| 3671 if (key_is_constant) { | 3720 if (key_is_constant) { |
| 3672 __ Addu(scratch0(), external_pointer, constant_key << shift_size); | 3721 __ Addu(scratch0(), external_pointer, constant_key << |
| 3722 element_size_shift); |
| 3673 } else { | 3723 } else { |
| 3674 __ sll(scratch0(), key, shift_size); | 3724 __ sll(scratch0(), key, shift_size); |
| 3675 __ Addu(scratch0(), scratch0(), external_pointer); | 3725 __ Addu(scratch0(), scratch0(), external_pointer); |
| 3676 } | 3726 } |
| 3677 | 3727 |
| 3678 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 3728 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
| 3679 __ cvt_s_d(double_scratch0(), value); | 3729 __ cvt_s_d(double_scratch0(), value); |
| 3680 __ swc1(double_scratch0(), MemOperand(scratch0(), additional_offset)); | 3730 __ swc1(double_scratch0(), MemOperand(scratch0(), additional_offset)); |
| 3681 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 3731 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
| 3682 __ sdc1(value, MemOperand(scratch0(), additional_offset)); | 3732 __ sdc1(value, MemOperand(scratch0(), additional_offset)); |
| 3683 } | 3733 } |
| 3684 } else { | 3734 } else { |
| 3685 Register value(ToRegister(instr->value())); | 3735 Register value(ToRegister(instr->value())); |
| 3686 Register scratch = scratch0(); | 3736 MemOperand mem_operand = PrepareKeyedOperand( |
| 3687 if (instr->additional_index() != 0 && !key_is_constant) { | 3737 key, external_pointer, key_is_constant, constant_key, |
| 3688 __ Addu(scratch, key, instr->additional_index()); | 3738 element_size_shift, shift_size, |
| 3689 } | 3739 instr->additional_index(), additional_offset); |
| 3690 MemOperand mem_operand(zero_reg); | |
| 3691 if (key_is_constant) { | |
| 3692 mem_operand = MemOperand(external_pointer, | |
| 3693 ((constant_key + instr->additional_index()) | |
| 3694 << shift_size)); | |
| 3695 } else { | |
| 3696 if (instr->additional_index() == 0) { | |
| 3697 __ sll(scratch, key, shift_size); | |
| 3698 } else { | |
| 3699 __ sll(scratch, scratch, shift_size); | |
| 3700 } | |
| 3701 __ Addu(scratch, scratch, external_pointer); | |
| 3702 mem_operand = MemOperand(scratch); | |
| 3703 } | |
| 3704 switch (elements_kind) { | 3740 switch (elements_kind) { |
| 3705 case EXTERNAL_PIXEL_ELEMENTS: | 3741 case EXTERNAL_PIXEL_ELEMENTS: |
| 3706 case EXTERNAL_BYTE_ELEMENTS: | 3742 case EXTERNAL_BYTE_ELEMENTS: |
| 3707 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3743 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 3708 __ sb(value, mem_operand); | 3744 __ sb(value, mem_operand); |
| 3709 break; | 3745 break; |
| 3710 case EXTERNAL_SHORT_ELEMENTS: | 3746 case EXTERNAL_SHORT_ELEMENTS: |
| 3711 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3747 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 3712 __ sh(value, mem_operand); | 3748 __ sh(value, mem_operand); |
| 3713 break; | 3749 break; |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5207 __ Subu(scratch, result, scratch); | 5243 __ Subu(scratch, result, scratch); |
| 5208 __ lw(result, FieldMemOperand(scratch, | 5244 __ lw(result, FieldMemOperand(scratch, |
| 5209 FixedArray::kHeaderSize - kPointerSize)); | 5245 FixedArray::kHeaderSize - kPointerSize)); |
| 5210 __ bind(&done); | 5246 __ bind(&done); |
| 5211 } | 5247 } |
| 5212 | 5248 |
| 5213 | 5249 |
| 5214 #undef __ | 5250 #undef __ |
| 5215 | 5251 |
| 5216 } } // namespace v8::internal | 5252 } } // namespace v8::internal |
| OLD | NEW |