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

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

Issue 10828216: MIPS: Fix write barrier for StoreKeyedFastElements on ARM. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on r12311 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 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 __ sll(length, length, kPointerSizeLog2); 2583 __ sll(length, length, kPointerSizeLog2);
2584 __ Addu(at, arguments, Operand(length)); 2584 __ Addu(at, arguments, Operand(length));
2585 __ lw(result, MemOperand(at, 0)); 2585 __ lw(result, MemOperand(at, 0));
2586 } 2586 }
2587 2587
2588 2588
2589 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { 2589 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2590 Register elements = ToRegister(instr->elements()); 2590 Register elements = ToRegister(instr->elements());
2591 Register result = ToRegister(instr->result()); 2591 Register result = ToRegister(instr->result());
2592 Register scratch = scratch0(); 2592 Register scratch = scratch0();
2593 Register store_base = scratch;
2594 int offset = 0;
2593 2595
2594 if (instr->key()->IsConstantOperand()) { 2596 if (instr->key()->IsConstantOperand()) {
2595 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 2597 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
2596 int offset = 2598 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
2597 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize 2599 instr->additional_index());
2598 + FixedArray::kHeaderSize; 2600 store_base = elements;
2599 __ lw(result, FieldMemOperand(elements, offset));
2600 } else { 2601 } else {
2601 Register key = EmitLoadRegister(instr->key(), scratch); 2602 Register key = EmitLoadRegister(instr->key(), scratch);
2602 // Even though the HLoadKeyedFastElement instruction forces the input 2603 // Even though the HLoadKeyedFastElement instruction forces the input
2603 // representation for the key to be an integer, the input gets replaced 2604 // representation for the key to be an integer, the input gets replaced
2604 // during bound check elimination with the index argument to the bounds 2605 // during bound check elimination with the index argument to the bounds
2605 // check, which can be tagged, so that case must be handled here, too. 2606 // check, which can be tagged, so that case must be handled here, too.
2606 if (instr->hydrogen()->key()->representation().IsTagged()) { 2607 if (instr->hydrogen()->key()->representation().IsTagged()) {
2607 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); 2608 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize);
2608 __ addu(scratch, elements, scratch); 2609 __ addu(scratch, elements, scratch);
2609 } else { 2610 } else {
2610 __ sll(scratch, key, kPointerSizeLog2); 2611 __ sll(scratch, key, kPointerSizeLog2);
2611 __ addu(scratch, elements, scratch); 2612 __ addu(scratch, elements, scratch);
2612 } 2613 }
2613 uint32_t offset = FixedArray::kHeaderSize + 2614 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
2614 (instr->additional_index() << kPointerSizeLog2);
2615 __ lw(result, FieldMemOperand(scratch, offset));
2616 } 2615 }
2616 __ lw(result, FieldMemOperand(store_base, offset));
2617 2617
2618 // Check for the hole value. 2618 // Check for the hole value.
2619 if (instr->hydrogen()->RequiresHoleCheck()) { 2619 if (instr->hydrogen()->RequiresHoleCheck()) {
2620 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { 2620 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
2621 __ And(scratch, result, Operand(kSmiTagMask)); 2621 __ And(scratch, result, Operand(kSmiTagMask));
2622 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); 2622 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
2623 } else { 2623 } else {
2624 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); 2624 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
2625 DeoptimizeIf(eq, instr->environment(), result, Operand(scratch)); 2625 DeoptimizeIf(eq, instr->environment(), result, Operand(scratch));
2626 } 2626 }
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
3678 Operand(ToRegister(instr->length()))); 3678 Operand(ToRegister(instr->length())));
3679 } 3679 }
3680 } 3680 }
3681 3681
3682 3682
3683 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { 3683 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3684 Register value = ToRegister(instr->value()); 3684 Register value = ToRegister(instr->value());
3685 Register elements = ToRegister(instr->object()); 3685 Register elements = ToRegister(instr->object());
3686 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; 3686 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3687 Register scratch = scratch0(); 3687 Register scratch = scratch0();
3688 Register store_base = scratch;
3689 int offset = 0;
3688 3690
3689 // Do the store. 3691 // Do the store.
3690 if (instr->key()->IsConstantOperand()) { 3692 if (instr->key()->IsConstantOperand()) {
3691 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); 3693 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3692 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 3694 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3693 int offset = 3695 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
3694 (ToInteger32(const_operand) + instr->additional_index()) * kPointerSize 3696 instr->additional_index());
3695 + FixedArray::kHeaderSize; 3697 store_base = elements;
3696 __ sw(value, FieldMemOperand(elements, offset));
3697 } else { 3698 } else {
3698 // Even though the HLoadKeyedFastElement instruction forces the input 3699 // Even though the HLoadKeyedFastElement instruction forces the input
3699 // representation for the key to be an integer, the input gets replaced 3700 // representation for the key to be an integer, the input gets replaced
3700 // during bound check elimination with the index argument to the bounds 3701 // during bound check elimination with the index argument to the bounds
3701 // check, which can be tagged, so that case must be handled here, too. 3702 // check, which can be tagged, so that case must be handled here, too.
3702 if (instr->hydrogen()->key()->representation().IsTagged()) { 3703 if (instr->hydrogen()->key()->representation().IsTagged()) {
3703 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); 3704 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize);
3704 __ addu(scratch, elements, scratch); 3705 __ addu(scratch, elements, scratch);
3705 } else { 3706 } else {
3706 __ sll(scratch, key, kPointerSizeLog2); 3707 __ sll(scratch, key, kPointerSizeLog2);
3707 __ addu(scratch, elements, scratch); 3708 __ addu(scratch, elements, scratch);
3708 } 3709 }
3709 uint32_t offset = FixedArray::kHeaderSize + 3710 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
3710 (instr->additional_index() << kPointerSizeLog2);
3711 __ sw(value, FieldMemOperand(scratch, offset));
3712 } 3711 }
3712 __ sw(value, FieldMemOperand(store_base, offset));
3713 3713
3714 if (instr->hydrogen()->NeedsWriteBarrier()) { 3714 if (instr->hydrogen()->NeedsWriteBarrier()) {
3715 HType type = instr->hydrogen()->value()->type(); 3715 HType type = instr->hydrogen()->value()->type();
3716 SmiCheck check_needed = 3716 SmiCheck check_needed =
3717 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 3717 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
3718 // Compute address of modified element and store it into key register. 3718 // Compute address of modified element and store it into key register.
3719 __ Addu(key, scratch, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 3719 __ Addu(key, store_base, Operand(offset - kHeapObjectTag));
3720 __ RecordWrite(elements, 3720 __ RecordWrite(elements,
3721 key, 3721 key,
3722 value, 3722 value,
3723 kRAHasBeenSaved, 3723 kRAHasBeenSaved,
3724 kSaveFPRegs, 3724 kSaveFPRegs,
3725 EMIT_REMEMBERED_SET, 3725 EMIT_REMEMBERED_SET,
3726 check_needed); 3726 check_needed);
3727 } 3727 }
3728 } 3728 }
3729 3729
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
5328 __ Subu(scratch, result, scratch); 5328 __ Subu(scratch, result, scratch);
5329 __ lw(result, FieldMemOperand(scratch, 5329 __ lw(result, FieldMemOperand(scratch,
5330 FixedArray::kHeaderSize - kPointerSize)); 5330 FixedArray::kHeaderSize - kPointerSize));
5331 __ bind(&done); 5331 __ bind(&done);
5332 } 5332 }
5333 5333
5334 5334
5335 #undef __ 5335 #undef __
5336 5336
5337 } } // namespace v8::internal 5337 } } // 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