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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 } | 569 } |
570 | 570 |
571 // Return the value (register v0). | 571 // Return the value (register v0). |
572 DCHECK(value_reg.is(a0)); | 572 DCHECK(value_reg.is(a0)); |
573 __ bind(&exit); | 573 __ bind(&exit); |
574 __ Ret(USE_DELAY_SLOT); | 574 __ Ret(USE_DELAY_SLOT); |
575 __ mov(v0, a0); | 575 __ mov(v0, a0); |
576 } | 576 } |
577 | 577 |
578 | 578 |
579 // Generate StoreField code, value is passed in a0 register. | 579 void NamedStoreHandlerCompiler::GenerateStoreField(LookupResult* lookup, |
580 // When leaving generated code after success, the receiver_reg and name_reg | 580 Register value_reg, |
581 // may be clobbered. Upon branch to miss_label, the receiver and name | 581 Label* miss_label) { |
582 // registers have their original values. | |
583 void NamedStoreHandlerCompiler::GenerateStoreField( | |
584 Handle<JSObject> object, LookupResult* lookup, Register receiver_reg, | |
585 Register name_reg, Register value_reg, Register scratch1, Register scratch2, | |
586 Label* miss_label) { | |
587 // a0 : value | |
588 Label exit; | |
589 | |
590 // Stub never generated for objects that require access checks. | |
591 DCHECK(!object->IsAccessCheckNeeded()); | |
592 DCHECK(!object->IsJSGlobalProxy()); | |
593 | |
594 FieldIndex index = lookup->GetFieldIndex(); | |
595 | |
596 DCHECK(lookup->representation().IsHeapObject()); | 582 DCHECK(lookup->representation().IsHeapObject()); |
597 __ JumpIfSmi(value_reg, miss_label); | 583 __ JumpIfSmi(value_reg, miss_label); |
598 HeapType* field_type = lookup->GetFieldType(); | 584 HeapType::Iterator<Map> it = lookup->GetFieldType()->Classes(); |
599 HeapType::Iterator<Map> it = field_type->Classes(); | 585 __ lw(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset)); |
600 if (!it.Done()) { | 586 Label do_store; |
601 __ lw(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset)); | 587 Handle<Map> current; |
602 Label do_store; | 588 while (true) { |
603 Handle<Map> current; | 589 // Do the CompareMap() directly within the Branch() functions. |
604 while (true) { | 590 current = it.Current(); |
605 // Do the CompareMap() directly within the Branch() functions. | 591 it.Advance(); |
606 current = it.Current(); | 592 if (it.Done()) { |
607 it.Advance(); | 593 __ Branch(miss_label, ne, scratch1(), Operand(current)); |
608 if (it.Done()) { | 594 break; |
609 __ Branch(miss_label, ne, scratch1, Operand(current)); | |
610 break; | |
611 } | |
612 __ Branch(&do_store, eq, scratch1, Operand(current)); | |
613 } | 595 } |
614 __ bind(&do_store); | 596 __ Branch(&do_store, eq, scratch1(), Operand(current)); |
615 } | 597 } |
| 598 __ bind(&do_store); |
616 | 599 |
617 if (index.is_inobject()) { | 600 StoreFieldStub stub(isolate(), lookup->GetFieldIndex(), |
618 // Set the property straight into the object. | 601 lookup->representation()); |
619 __ sw(value_reg, FieldMemOperand(receiver_reg, index.offset())); | 602 GenerateTailCall(masm(), stub.GetCode()); |
620 | |
621 // Skip updating write barrier if storing a smi. | |
622 __ JumpIfSmi(value_reg, &exit); | |
623 | |
624 // Update the write barrier for the array address. | |
625 // Pass the now unused name_reg as a scratch register. | |
626 __ mov(name_reg, value_reg); | |
627 __ RecordWriteField(receiver_reg, index.offset(), name_reg, scratch1, | |
628 kRAHasNotBeenSaved, kDontSaveFPRegs, | |
629 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
630 } else { | |
631 // Write to the properties array. | |
632 // Get the properties array. | |
633 __ lw(scratch1, | |
634 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | |
635 __ sw(value_reg, FieldMemOperand(scratch1, index.offset())); | |
636 | |
637 // Skip updating write barrier if storing a smi. | |
638 __ JumpIfSmi(value_reg, &exit); | |
639 | |
640 // Update the write barrier for the array address. | |
641 // Ok to clobber receiver_reg and name_reg, since we return. | |
642 __ mov(name_reg, value_reg); | |
643 __ RecordWriteField(scratch1, index.offset(), name_reg, receiver_reg, | |
644 kRAHasNotBeenSaved, kDontSaveFPRegs, | |
645 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
646 } | |
647 | |
648 // Return the value (register v0). | |
649 DCHECK(value_reg.is(a0)); | |
650 __ bind(&exit); | |
651 __ Ret(USE_DELAY_SLOT); | |
652 __ mov(v0, a0); | |
653 } | 603 } |
654 | 604 |
655 | 605 |
656 Register PropertyHandlerCompiler::CheckPrototypes( | 606 Register PropertyHandlerCompiler::CheckPrototypes( |
657 Register object_reg, Register holder_reg, Register scratch1, | 607 Register object_reg, Register holder_reg, Register scratch1, |
658 Register scratch2, Handle<Name> name, Label* miss, | 608 Register scratch2, Handle<Name> name, Label* miss, |
659 PrototypeCheckType check) { | 609 PrototypeCheckType check) { |
660 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); | 610 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); |
661 | 611 |
662 // Make sure there's no overlap between holder and object registers. | 612 // Make sure there's no overlap between holder and object registers. |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 | 1177 |
1228 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1178 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1229 } | 1179 } |
1230 | 1180 |
1231 | 1181 |
1232 #undef __ | 1182 #undef __ |
1233 | 1183 |
1234 } } // namespace v8::internal | 1184 } } // namespace v8::internal |
1235 | 1185 |
1236 #endif // V8_TARGET_ARCH_MIPS | 1186 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |