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