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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 Label* miss_label) { | 590 Label* miss_label) { |
591 // a0 : value | 591 // a0 : value |
592 Label exit; | 592 Label exit; |
593 | 593 |
594 // Stub never generated for objects that require access checks. | 594 // Stub never generated for objects that require access checks. |
595 DCHECK(!object->IsAccessCheckNeeded()); | 595 DCHECK(!object->IsAccessCheckNeeded()); |
596 DCHECK(!object->IsJSGlobalProxy()); | 596 DCHECK(!object->IsJSGlobalProxy()); |
597 | 597 |
598 FieldIndex index = lookup->GetFieldIndex(); | 598 FieldIndex index = lookup->GetFieldIndex(); |
599 | 599 |
600 Representation representation = lookup->representation(); | 600 DCHECK(lookup->representation().IsHeapObject()); |
601 DCHECK(!representation.IsNone()); | 601 __ JumpIfSmi(value_reg, miss_label); |
602 if (representation.IsSmi()) { | 602 HeapType* field_type = lookup->GetFieldType(); |
603 __ JumpIfNotSmi(value_reg, miss_label); | 603 HeapType::Iterator<Map> it = field_type->Classes(); |
604 } else if (representation.IsHeapObject()) { | 604 if (!it.Done()) { |
605 __ JumpIfSmi(value_reg, miss_label); | 605 __ ld(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
606 HeapType* field_type = lookup->GetFieldType(); | 606 Label do_store; |
607 HeapType::Iterator<Map> it = field_type->Classes(); | 607 Handle<Map> current; |
608 if (!it.Done()) { | 608 while (true) { |
609 __ ld(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 609 // Do the CompareMap() directly within the Branch() functions. |
610 Label do_store; | 610 current = it.Current(); |
611 Handle<Map> current; | 611 it.Advance(); |
612 while (true) { | 612 if (it.Done()) { |
613 // Do the CompareMap() directly within the Branch() functions. | 613 __ Branch(miss_label, ne, scratch1, Operand(current)); |
614 current = it.Current(); | 614 break; |
615 it.Advance(); | |
616 if (it.Done()) { | |
617 __ Branch(miss_label, ne, scratch1, Operand(current)); | |
618 break; | |
619 } | |
620 __ Branch(&do_store, eq, scratch1, Operand(current)); | |
621 } | 615 } |
622 __ bind(&do_store); | 616 __ Branch(&do_store, eq, scratch1, Operand(current)); |
623 } | 617 } |
624 } else if (representation.IsDouble()) { | |
625 // Load the double storage. | |
626 if (index.is_inobject()) { | |
627 __ ld(scratch1, FieldMemOperand(receiver_reg, index.offset())); | |
628 } else { | |
629 __ ld(scratch1, | |
630 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | |
631 __ ld(scratch1, FieldMemOperand(scratch1, index.offset())); | |
632 } | |
633 | |
634 // Store the value into the storage. | |
635 Label do_store, heap_number; | |
636 __ JumpIfNotSmi(value_reg, &heap_number); | |
637 __ SmiUntag(scratch2, value_reg); | |
638 __ mtc1(scratch2, f6); | |
639 __ cvt_d_w(f4, f6); | |
640 __ jmp(&do_store); | |
641 | |
642 __ bind(&heap_number); | |
643 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex, | |
644 miss_label, DONT_DO_SMI_CHECK); | |
645 __ ldc1(f4, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); | |
646 | |
647 __ bind(&do_store); | 618 __ bind(&do_store); |
648 __ sdc1(f4, FieldMemOperand(scratch1, HeapNumber::kValueOffset)); | |
649 // Return the value (register v0). | |
650 DCHECK(value_reg.is(a0)); | |
651 __ Ret(USE_DELAY_SLOT); | |
652 __ mov(v0, a0); | |
653 return; | |
654 } | 619 } |
655 | 620 |
656 // TODO(verwaest): Share this code as a code stub. | |
657 SmiCheck smi_check = representation.IsTagged() | |
658 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | |
659 if (index.is_inobject()) { | 621 if (index.is_inobject()) { |
660 // Set the property straight into the object. | 622 // Set the property straight into the object. |
661 __ sd(value_reg, FieldMemOperand(receiver_reg, index.offset())); | 623 __ sd(value_reg, FieldMemOperand(receiver_reg, index.offset())); |
662 | 624 |
663 if (!representation.IsSmi()) { | 625 // Skip updating write barrier if storing a smi. |
664 // Skip updating write barrier if storing a smi. | 626 __ JumpIfSmi(value_reg, &exit); |
665 __ JumpIfSmi(value_reg, &exit); | |
666 | 627 |
667 // Update the write barrier for the array address. | 628 // Update the write barrier for the array address. |
668 // Pass the now unused name_reg as a scratch register. | 629 // Pass the now unused name_reg as a scratch register. |
669 __ mov(name_reg, value_reg); | 630 __ mov(name_reg, value_reg); |
670 __ RecordWriteField(receiver_reg, | 631 __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1, |
671 index.offset(), | 632 kRAHasNotBeenSaved, kDontSaveFPRegs, |
672 name_reg, | 633 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
673 scratch1, | |
674 kRAHasNotBeenSaved, | |
675 kDontSaveFPRegs, | |
676 EMIT_REMEMBERED_SET, | |
677 smi_check); | |
678 } | |
679 } else { | 634 } else { |
680 // Write to the properties array. | 635 // Write to the properties array. |
681 // Get the properties array. | 636 // Get the properties array. |
682 __ ld(scratch1, | 637 __ ld(scratch1, |
683 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 638 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
684 __ sd(value_reg, FieldMemOperand(scratch1, index.offset())); | 639 __ sd(value_reg, FieldMemOperand(scratch1, index.offset())); |
685 | 640 |
686 if (!representation.IsSmi()) { | 641 // Skip updating write barrier if storing a smi. |
687 // Skip updating write barrier if storing a smi. | 642 __ JumpIfSmi(value_reg, &exit); |
688 __ JumpIfSmi(value_reg, &exit); | |
689 | 643 |
690 // Update the write barrier for the array address. | 644 // Update the write barrier for the array address. |
691 // Ok to clobber receiver_reg and name_reg, since we return. | 645 // Ok to clobber receiver_reg and name_reg, since we return. |
692 __ mov(name_reg, value_reg); | 646 __ mov(name_reg, value_reg); |
693 __ RecordWriteField(scratch1, | 647 __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg, |
694 index.offset(), | 648 kRAHasNotBeenSaved, kDontSaveFPRegs, |
695 name_reg, | 649 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
696 receiver_reg, | |
697 kRAHasNotBeenSaved, | |
698 kDontSaveFPRegs, | |
699 EMIT_REMEMBERED_SET, | |
700 smi_check); | |
701 } | |
702 } | 650 } |
703 | 651 |
704 // Return the value (register v0). | 652 // Return the value (register v0). |
705 DCHECK(value_reg.is(a0)); | 653 DCHECK(value_reg.is(a0)); |
706 __ bind(&exit); | 654 __ bind(&exit); |
707 __ Ret(USE_DELAY_SLOT); | 655 __ Ret(USE_DELAY_SLOT); |
708 __ mov(v0, a0); | 656 __ mov(v0, a0); |
709 } | 657 } |
710 | 658 |
711 | 659 |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 | 1232 |
1285 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1233 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1286 } | 1234 } |
1287 | 1235 |
1288 | 1236 |
1289 #undef __ | 1237 #undef __ |
1290 | 1238 |
1291 } } // namespace v8::internal | 1239 } } // namespace v8::internal |
1292 | 1240 |
1293 #endif // V8_TARGET_ARCH_MIPS64 | 1241 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |