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 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 3852 |
| 3853 // Do the store. | 3853 // Do the store. |
| 3854 int offset = 0; | |
| 3855 Register store_base = scratch; | |
| 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 = (ToInteger32(const_operand) + instr->additional_index()) * |
|
Michael Starzinger
2012/07/31 13:42:32
Can we use FixedArray::OffsetOfElementAt() for thi
| |
| 3858 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize | 3860 kPointerSize + FixedArray::kHeaderSize; |
| 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::kHeaderSize + |
| 3873 (instr->additional_index() << kPointerSizeLog2); | 3874 (instr->additional_index() << kPointerSizeLog2); |
| 3874 __ str(value, FieldMemOperand(scratch, offset)); | |
| 3875 } | 3875 } |
| 3876 __ str(value, FieldMemOperand(store_base, offset)); | |
| 3876 | 3877 |
| 3877 if (instr->hydrogen()->NeedsWriteBarrier()) { | 3878 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 3878 HType type = instr->hydrogen()->value()->type(); | 3879 HType type = instr->hydrogen()->value()->type(); |
| 3879 SmiCheck check_needed = | 3880 SmiCheck check_needed = |
| 3880 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 3881 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 3881 // Compute address of modified element and store it into key register. | 3882 // Compute address of modified element and store it into key register. |
| 3882 __ add(key, scratch, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 3883 __ add(key, store_base, Operand(offset - kHeapObjectTag)); |
| 3883 __ RecordWrite(elements, | 3884 __ RecordWrite(elements, |
| 3884 key, | 3885 key, |
| 3885 value, | 3886 value, |
| 3886 kLRHasBeenSaved, | 3887 kLRHasBeenSaved, |
| 3887 kSaveFPRegs, | 3888 kSaveFPRegs, |
| 3888 EMIT_REMEMBERED_SET, | 3889 EMIT_REMEMBERED_SET, |
| 3889 check_needed); | 3890 check_needed); |
| 3890 } | 3891 } |
| 3891 } | 3892 } |
| 3892 | 3893 |
| (...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5464 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5465 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 5465 __ ldr(result, FieldMemOperand(scratch, | 5466 __ ldr(result, FieldMemOperand(scratch, |
| 5466 FixedArray::kHeaderSize - kPointerSize)); | 5467 FixedArray::kHeaderSize - kPointerSize)); |
| 5467 __ bind(&done); | 5468 __ bind(&done); |
| 5468 } | 5469 } |
| 5469 | 5470 |
| 5470 | 5471 |
| 5471 #undef __ | 5472 #undef __ |
| 5472 | 5473 |
| 5473 } } // namespace v8::internal | 5474 } } // namespace v8::internal |
| OLD | NEW |