OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic-inl.h" | 10 #include "src/ic-inl.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 Label* miss_label) { | 586 Label* miss_label) { |
587 // a0 : value | 587 // a0 : value |
588 Label exit; | 588 Label exit; |
589 | 589 |
590 // Stub never generated for objects that require access checks. | 590 // Stub never generated for objects that require access checks. |
591 DCHECK(!object->IsAccessCheckNeeded()); | 591 DCHECK(!object->IsAccessCheckNeeded()); |
592 DCHECK(!object->IsJSGlobalProxy()); | 592 DCHECK(!object->IsJSGlobalProxy()); |
593 | 593 |
594 FieldIndex index = lookup->GetFieldIndex(); | 594 FieldIndex index = lookup->GetFieldIndex(); |
595 | 595 |
596 Representation representation = lookup->representation(); | 596 DCHECK(lookup->representation().IsHeapObject()); |
597 DCHECK(!representation.IsNone()); | 597 __ JumpIfSmi(value_reg, miss_label); |
598 if (representation.IsSmi()) { | 598 HeapType* field_type = lookup->GetFieldType(); |
599 __ JumpIfNotSmi(value_reg, miss_label); | 599 HeapType::Iterator<Map> it = field_type->Classes(); |
600 } else if (representation.IsHeapObject()) { | 600 if (!it.Done()) { |
601 __ JumpIfSmi(value_reg, miss_label); | 601 __ lw(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
602 HeapType* field_type = lookup->GetFieldType(); | 602 Label do_store; |
603 HeapType::Iterator<Map> it = field_type->Classes(); | 603 Handle<Map> current; |
604 if (!it.Done()) { | 604 while (true) { |
605 __ lw(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 605 // Do the CompareMap() directly within the Branch() functions. |
606 Label do_store; | 606 current = it.Current(); |
607 Handle<Map> current; | 607 it.Advance(); |
608 while (true) { | 608 if (it.Done()) { |
609 // Do the CompareMap() directly within the Branch() functions. | 609 __ Branch(miss_label, ne, scratch1, Operand(current)); |
610 current = it.Current(); | 610 break; |
611 it.Advance(); | |
612 if (it.Done()) { | |
613 __ Branch(miss_label, ne, scratch1, Operand(current)); | |
614 break; | |
615 } | |
616 __ Branch(&do_store, eq, scratch1, Operand(current)); | |
617 } | 611 } |
618 __ bind(&do_store); | 612 __ Branch(&do_store, eq, scratch1, Operand(current)); |
619 } | 613 } |
620 } else if (representation.IsDouble()) { | |
621 // Load the double storage. | |
622 if (index.is_inobject()) { | |
623 __ lw(scratch1, FieldMemOperand(receiver_reg, index.offset())); | |
624 } else { | |
625 __ lw(scratch1, | |
626 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | |
627 __ lw(scratch1, FieldMemOperand(scratch1, index.offset())); | |
628 } | |
629 | |
630 // Store the value into the storage. | |
631 Label do_store, heap_number; | |
632 __ JumpIfNotSmi(value_reg, &heap_number); | |
633 __ SmiUntag(scratch2, value_reg); | |
634 __ mtc1(scratch2, f6); | |
635 __ cvt_d_w(f4, f6); | |
636 __ jmp(&do_store); | |
637 | |
638 __ bind(&heap_number); | |
639 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex, | |
640 miss_label, DONT_DO_SMI_CHECK); | |
641 __ ldc1(f4, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); | |
642 | |
643 __ bind(&do_store); | 614 __ bind(&do_store); |
644 __ sdc1(f4, FieldMemOperand(scratch1, HeapNumber::kValueOffset)); | |
645 // Return the value (register v0). | |
646 DCHECK(value_reg.is(a0)); | |
647 __ Ret(USE_DELAY_SLOT); | |
648 __ mov(v0, a0); | |
649 return; | |
650 } | 615 } |
651 | 616 |
652 // TODO(verwaest): Share this code as a code stub. | |
653 SmiCheck smi_check = representation.IsTagged() | |
654 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | |
655 if (index.is_inobject()) { | 617 if (index.is_inobject()) { |
656 // Set the property straight into the object. | 618 // Set the property straight into the object. |
657 __ sw(value_reg, FieldMemOperand(receiver_reg, index.offset())); | 619 __ sw(value_reg, FieldMemOperand(receiver_reg, index.offset())); |
658 | 620 |
659 if (!representation.IsSmi()) { | 621 // Skip updating write barrier if storing a smi. |
660 // Skip updating write barrier if storing a smi. | 622 __ JumpIfSmi(value_reg, &exit); |
661 __ JumpIfSmi(value_reg, &exit); | |
662 | 623 |
663 // Update the write barrier for the array address. | 624 // Update the write barrier for the array address. |
664 // Pass the now unused name_reg as a scratch register. | 625 // Pass the now unused name_reg as a scratch register. |
665 __ mov(name_reg, value_reg); | 626 __ mov(name_reg, value_reg); |
666 __ RecordWriteField(receiver_reg, | 627 __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1, |
667 index.offset(), | 628 kRAHasNotBeenSaved, kDontSaveFPRegs, |
668 name_reg, | 629 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
669 scratch1, | |
670 kRAHasNotBeenSaved, | |
671 kDontSaveFPRegs, | |
672 EMIT_REMEMBERED_SET, | |
673 smi_check); | |
674 } | |
675 } else { | 630 } else { |
676 // Write to the properties array. | 631 // Write to the properties array. |
677 // Get the properties array. | 632 // Get the properties array. |
678 __ lw(scratch1, | 633 __ lw(scratch1, |
679 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 634 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
680 __ sw(value_reg, FieldMemOperand(scratch1, index.offset())); | 635 __ sw(value_reg, FieldMemOperand(scratch1, index.offset())); |
681 | 636 |
682 if (!representation.IsSmi()) { | 637 // Skip updating write barrier if storing a smi. |
683 // Skip updating write barrier if storing a smi. | 638 __ JumpIfSmi(value_reg, &exit); |
684 __ JumpIfSmi(value_reg, &exit); | |
685 | 639 |
686 // Update the write barrier for the array address. | 640 // Update the write barrier for the array address. |
687 // Ok to clobber receiver_reg and name_reg, since we return. | 641 // Ok to clobber receiver_reg and name_reg, since we return. |
688 __ mov(name_reg, value_reg); | 642 __ mov(name_reg, value_reg); |
689 __ RecordWriteField(scratch1, | 643 __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg, |
690 index.offset(), | 644 kRAHasNotBeenSaved, kDontSaveFPRegs, |
691 name_reg, | 645 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
692 receiver_reg, | |
693 kRAHasNotBeenSaved, | |
694 kDontSaveFPRegs, | |
695 EMIT_REMEMBERED_SET, | |
696 smi_check); | |
697 } | |
698 } | 646 } |
699 | 647 |
700 // Return the value (register v0). | 648 // Return the value (register v0). |
701 DCHECK(value_reg.is(a0)); | 649 DCHECK(value_reg.is(a0)); |
702 __ bind(&exit); | 650 __ bind(&exit); |
703 __ Ret(USE_DELAY_SLOT); | 651 __ Ret(USE_DELAY_SLOT); |
704 __ mov(v0, a0); | 652 __ mov(v0, a0); |
705 } | 653 } |
706 | 654 |
707 | 655 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 | 1227 |
1280 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1228 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1281 } | 1229 } |
1282 | 1230 |
1283 | 1231 |
1284 #undef __ | 1232 #undef __ |
1285 | 1233 |
1286 } } // namespace v8::internal | 1234 } } // namespace v8::internal |
1287 | 1235 |
1288 #endif // V8_TARGET_ARCH_MIPS | 1236 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |