Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 10824107: Fix write barrier for StoreKeyedFastElements on ARM (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2763 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 result = ToRegister(instr->result()); 2782 Register result = ToRegister(instr->result());
2783 Register scratch = scratch0(); 2783 Register scratch = scratch0();
2784 Register store_base = scratch;
2785 int offset = 0;
2784 2786
2785 if (instr->key()->IsConstantOperand()) { 2787 if (instr->key()->IsConstantOperand()) {
2786 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 2788 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
2787 int offset = 2789 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
2788 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize 2790 instr->additional_index());
2789 + FixedArray::kHeaderSize; 2791 store_base = elements;
2790 __ ldr(result, FieldMemOperand(elements, offset));
2791 } else { 2792 } else {
2792 Register key = EmitLoadRegister(instr->key(), scratch0()); 2793 Register key = EmitLoadRegister(instr->key(), scratch0());
2793 // Even though the HLoadKeyedFastElement instruction forces the input 2794 // Even though the HLoadKeyedFastElement instruction forces the input
2794 // representation for the key to be an integer, the input gets replaced 2795 // representation for the key to be an integer, the input gets replaced
2795 // during bound check elimination with the index argument to the bounds 2796 // during bound check elimination with the index argument to the bounds
2796 // check, which can be tagged, so that case must be handled here, too. 2797 // check, which can be tagged, so that case must be handled here, too.
2797 if (instr->hydrogen()->key()->representation().IsTagged()) { 2798 if (instr->hydrogen()->key()->representation().IsTagged()) {
2798 __ add(scratch, elements, 2799 __ add(scratch, elements,
2799 Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); 2800 Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize));
2800 } else { 2801 } else {
2801 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); 2802 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
2802 } 2803 }
2803 uint32_t offset = FixedArray::kHeaderSize + 2804 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
2804 (instr->additional_index() << kPointerSizeLog2);
2805 __ ldr(result, FieldMemOperand(scratch, offset));
2806 } 2805 }
2806 __ ldr(result, FieldMemOperand(store_base, offset));
2807 2807
2808 // Check for the hole value. 2808 // Check for the hole value.
2809 if (instr->hydrogen()->RequiresHoleCheck()) { 2809 if (instr->hydrogen()->RequiresHoleCheck()) {
2810 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { 2810 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
2811 __ tst(result, Operand(kSmiTagMask)); 2811 __ tst(result, Operand(kSmiTagMask));
2812 DeoptimizeIf(ne, instr->environment()); 2812 DeoptimizeIf(ne, instr->environment());
2813 } else { 2813 } else {
2814 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); 2814 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
2815 __ cmp(result, scratch); 2815 __ cmp(result, scratch);
2816 DeoptimizeIf(eq, instr->environment()); 2816 DeoptimizeIf(eq, instr->environment());
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3842 } 3842 }
3843 DeoptimizeIf(hs, instr->environment()); 3843 DeoptimizeIf(hs, instr->environment());
3844 } 3844 }
3845 3845
3846 3846
3847 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { 3847 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3848 Register value = ToRegister(instr->value()); 3848 Register value = ToRegister(instr->value());
3849 Register elements = ToRegister(instr->object()); 3849 Register elements = ToRegister(instr->object());
3850 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; 3850 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3851 Register scratch = scratch0(); 3851 Register scratch = scratch0();
3852 Register store_base = scratch;
3853 int offset = 0;
3852 3854
3853 // Do the store. 3855 // Do the store.
3854 if (instr->key()->IsConstantOperand()) { 3856 if (instr->key()->IsConstantOperand()) {
3855 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); 3857 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3856 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 3858 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3857 int offset = 3859 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
3858 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize 3860 instr->additional_index());
3859 + FixedArray::kHeaderSize; 3861 store_base = elements;
3860 __ str(value, FieldMemOperand(elements, offset));
3861 } else { 3862 } else {
3862 // Even though the HLoadKeyedFastElement instruction forces the input 3863 // Even though the HLoadKeyedFastElement instruction forces the input
3863 // representation for the key to be an integer, the input gets replaced 3864 // representation for the key to be an integer, the input gets replaced
3864 // during bound check elimination with the index argument to the bounds 3865 // during bound check elimination with the index argument to the bounds
3865 // check, which can be tagged, so that case must be handled here, too. 3866 // check, which can be tagged, so that case must be handled here, too.
3866 if (instr->hydrogen()->key()->representation().IsTagged()) { 3867 if (instr->hydrogen()->key()->representation().IsTagged()) {
3867 __ add(scratch, elements, 3868 __ add(scratch, elements,
3868 Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); 3869 Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize));
3869 } else { 3870 } else {
3870 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); 3871 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
3871 } 3872 }
3872 uint32_t offset = FixedArray::kHeaderSize + 3873 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
3873 (instr->additional_index() << kPointerSizeLog2);
3874 __ str(value, FieldMemOperand(scratch, offset));
3875 } 3874 }
3875 __ str(value, FieldMemOperand(store_base, offset));
3876 3876
3877 if (instr->hydrogen()->NeedsWriteBarrier()) { 3877 if (instr->hydrogen()->NeedsWriteBarrier()) {
3878 HType type = instr->hydrogen()->value()->type(); 3878 HType type = instr->hydrogen()->value()->type();
3879 SmiCheck check_needed = 3879 SmiCheck check_needed =
3880 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 3880 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
3881 // Compute address of modified element and store it into key register. 3881 // Compute address of modified element and store it into key register.
3882 __ add(key, scratch, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 3882 __ add(key, store_base, Operand(offset - kHeapObjectTag));
3883 __ RecordWrite(elements, 3883 __ RecordWrite(elements,
3884 key, 3884 key,
3885 value, 3885 value,
3886 kLRHasBeenSaved, 3886 kLRHasBeenSaved,
3887 kSaveFPRegs, 3887 kSaveFPRegs,
3888 EMIT_REMEMBERED_SET, 3888 EMIT_REMEMBERED_SET,
3889 check_needed); 3889 check_needed);
3890 } 3890 }
3891 } 3891 }
3892 3892
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
5464 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 5464 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
5465 __ ldr(result, FieldMemOperand(scratch, 5465 __ ldr(result, FieldMemOperand(scratch,
5466 FixedArray::kHeaderSize - kPointerSize)); 5466 FixedArray::kHeaderSize - kPointerSize));
5467 __ bind(&done); 5467 __ bind(&done);
5468 } 5468 }
5469 5469
5470 5470
5471 #undef __ 5471 #undef __
5472 5472
5473 } } // namespace v8::internal 5473 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698