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 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2772 | 2772 |
2773 // There are two words between the frame pointer and the last argument. | 2773 // There are two words between the frame pointer and the last argument. |
2774 // Subtracting from length accounts for one of them add one more. | 2774 // Subtracting from length accounts for one of them add one more. |
2775 __ add(length, length, Operand(1)); | 2775 __ add(length, length, Operand(1)); |
2776 __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); | 2776 __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); |
2777 } | 2777 } |
2778 | 2778 |
2779 | 2779 |
2780 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { | 2780 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
2781 Register elements = ToRegister(instr->elements()); | 2781 Register elements = ToRegister(instr->elements()); |
2782 Register key = EmitLoadRegister(instr->key(), scratch0()); | |
2783 Register result = ToRegister(instr->result()); | 2782 Register result = ToRegister(instr->result()); |
2784 Register scratch = scratch0(); | 2783 Register scratch = scratch0(); |
2785 | 2784 |
2786 // Load the result. | 2785 if (instr->key()->IsConstantOperand()) { |
2787 if (instr->hydrogen()->key()->representation().IsTagged()) { | 2786 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
2788 __ add(scratch, elements, | 2787 int offset = |
2789 Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); | 2788 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize |
2789 + FixedArray::kHeaderSize; | |
2790 __ ldr(result, FieldMemOperand(elements, offset)); | |
2790 } else { | 2791 } else { |
2791 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); | 2792 Register key = EmitLoadRegister(instr->key(), scratch0()); |
2793 if (instr->hydrogen()->key()->representation().IsTagged()) { | |
Jakob Kummerow
2012/07/30 11:58:08
I don't see how this condition can ever be true. H
danno
2012/07/30 16:11:11
Actually, this does get triggered. It's scary. The
| |
2794 __ add(scratch, elements, | |
2795 Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); | |
2796 } else { | |
2797 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); | |
2798 } | |
2799 if (instr->additional_index() != 0) { | |
2800 __ add(scratch, | |
2801 scratch, | |
2802 Operand(instr->additional_index() << kPointerSizeLog2)); | |
Jakob Kummerow
2012/07/30 11:58:08
What's the benefit of having this addition in gene
danno
2012/07/30 16:11:11
I changed this here and in the DoStoreKeyedFastEle
| |
2803 } | |
2804 __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize)); | |
2792 } | 2805 } |
2793 uint32_t offset = FixedArray::kHeaderSize + | |
2794 (instr->additional_index() << kPointerSizeLog2); | |
2795 __ ldr(result, FieldMemOperand(scratch, offset)); | |
2796 | 2806 |
2797 // Check for the hole value. | 2807 // Check for the hole value. |
2798 if (instr->hydrogen()->RequiresHoleCheck()) { | 2808 if (instr->hydrogen()->RequiresHoleCheck()) { |
2799 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { | 2809 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { |
2800 __ tst(result, Operand(kSmiTagMask)); | 2810 __ tst(result, Operand(kSmiTagMask)); |
2801 DeoptimizeIf(ne, instr->environment()); | 2811 DeoptimizeIf(ne, instr->environment()); |
2802 } else { | 2812 } else { |
2803 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 2813 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
2804 __ cmp(result, scratch); | 2814 __ cmp(result, scratch); |
2805 DeoptimizeIf(eq, instr->environment()); | 2815 DeoptimizeIf(eq, instr->environment()); |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3816 // Name is always in r2. | 3826 // Name is always in r2. |
3817 __ mov(r2, Operand(instr->name())); | 3827 __ mov(r2, Operand(instr->name())); |
3818 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3828 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3819 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3829 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3820 : isolate()->builtins()->StoreIC_Initialize(); | 3830 : isolate()->builtins()->StoreIC_Initialize(); |
3821 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3831 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3822 } | 3832 } |
3823 | 3833 |
3824 | 3834 |
3825 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3835 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3826 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); | 3836 if (instr->index()->IsConstantOperand()) { |
3837 int constant_index = | |
3838 ToInteger32(LConstantOperand::cast(instr->index())); | |
3839 if (instr->hydrogen()->length()->representation().IsTagged()) { | |
3840 __ mov(ip, Operand(Smi::FromInt(constant_index))); | |
3841 } else { | |
3842 __ mov(ip, Operand(constant_index)); | |
3843 } | |
3844 __ cmp(ip, ToRegister(instr->length())); | |
3845 } else { | |
3846 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); | |
3847 } | |
3827 DeoptimizeIf(hs, instr->environment()); | 3848 DeoptimizeIf(hs, instr->environment()); |
3828 } | 3849 } |
3829 | 3850 |
3830 | 3851 |
3831 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { | 3852 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
3832 Register value = ToRegister(instr->value()); | 3853 Register value = ToRegister(instr->value()); |
3833 Register elements = ToRegister(instr->object()); | 3854 Register elements = ToRegister(instr->object()); |
3834 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; | 3855 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; |
3835 Register scratch = scratch0(); | 3856 Register scratch = scratch0(); |
3836 | 3857 |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5447 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5468 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5448 __ ldr(result, FieldMemOperand(scratch, | 5469 __ ldr(result, FieldMemOperand(scratch, |
5449 FixedArray::kHeaderSize - kPointerSize)); | 5470 FixedArray::kHeaderSize - kPointerSize)); |
5450 __ bind(&done); | 5471 __ bind(&done); |
5451 } | 5472 } |
5452 | 5473 |
5453 | 5474 |
5454 #undef __ | 5475 #undef __ |
5455 | 5476 |
5456 } } // namespace v8::internal | 5477 } } // namespace v8::internal |
OLD | NEW |