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