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