| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 __ ret(0); | 339 __ ret(0); |
| 340 } | 340 } |
| 341 | 341 |
| 342 | 342 |
| 343 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, | 343 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, |
| 344 Register dst, | 344 Register dst, |
| 345 Register src, | 345 Register src, |
| 346 bool inobject, | 346 bool inobject, |
| 347 int index, | 347 int index, |
| 348 Representation representation) { | 348 Representation representation) { |
| 349 ASSERT(!FLAG_track_double_fields || !representation.IsDouble()); | 349 ASSERT(!representation.IsDouble()); |
| 350 int offset = index * kPointerSize; | 350 int offset = index * kPointerSize; |
| 351 if (!inobject) { | 351 if (!inobject) { |
| 352 // Calculate the offset into the properties array. | 352 // Calculate the offset into the properties array. |
| 353 offset = offset + FixedArray::kHeaderSize; | 353 offset = offset + FixedArray::kHeaderSize; |
| 354 __ movp(dst, FieldOperand(src, JSObject::kPropertiesOffset)); | 354 __ movp(dst, FieldOperand(src, JSObject::kPropertiesOffset)); |
| 355 src = dst; | 355 src = dst; |
| 356 } | 356 } |
| 357 __ movp(dst, FieldOperand(src, offset)); | 357 __ movp(dst, FieldOperand(src, offset)); |
| 358 } | 358 } |
| 359 | 359 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 int descriptor = transition->LastAdded(); | 530 int descriptor = transition->LastAdded(); |
| 531 DescriptorArray* descriptors = transition->instance_descriptors(); | 531 DescriptorArray* descriptors = transition->instance_descriptors(); |
| 532 PropertyDetails details = descriptors->GetDetails(descriptor); | 532 PropertyDetails details = descriptors->GetDetails(descriptor); |
| 533 Representation representation = details.representation(); | 533 Representation representation = details.representation(); |
| 534 ASSERT(!representation.IsNone()); | 534 ASSERT(!representation.IsNone()); |
| 535 | 535 |
| 536 if (details.type() == CONSTANT) { | 536 if (details.type() == CONSTANT) { |
| 537 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); | 537 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); |
| 538 __ Cmp(value_reg, constant); | 538 __ Cmp(value_reg, constant); |
| 539 __ j(not_equal, miss_label); | 539 __ j(not_equal, miss_label); |
| 540 } else if (FLAG_track_fields && representation.IsSmi()) { | 540 } else if (representation.IsSmi()) { |
| 541 __ JumpIfNotSmi(value_reg, miss_label); | 541 __ JumpIfNotSmi(value_reg, miss_label); |
| 542 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 542 } else if (representation.IsHeapObject()) { |
| 543 __ JumpIfSmi(value_reg, miss_label); | 543 __ JumpIfSmi(value_reg, miss_label); |
| 544 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 544 } else if (representation.IsDouble()) { |
| 545 Label do_store, heap_number; | 545 Label do_store, heap_number; |
| 546 __ AllocateHeapNumber(storage_reg, scratch1, slow); | 546 __ AllocateHeapNumber(storage_reg, scratch1, slow); |
| 547 | 547 |
| 548 __ JumpIfNotSmi(value_reg, &heap_number); | 548 __ JumpIfNotSmi(value_reg, &heap_number); |
| 549 __ SmiToInteger32(scratch1, value_reg); | 549 __ SmiToInteger32(scratch1, value_reg); |
| 550 __ Cvtlsi2sd(xmm0, scratch1); | 550 __ Cvtlsi2sd(xmm0, scratch1); |
| 551 __ jmp(&do_store); | 551 __ jmp(&do_store); |
| 552 | 552 |
| 553 __ bind(&heap_number); | 553 __ bind(&heap_number); |
| 554 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), | 554 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 // face of a transition we can use the old map here because the size of the | 607 // face of a transition we can use the old map here because the size of the |
| 608 // object and the number of in-object properties is not going to change. | 608 // object and the number of in-object properties is not going to change. |
| 609 index -= object->map()->inobject_properties(); | 609 index -= object->map()->inobject_properties(); |
| 610 | 610 |
| 611 // TODO(verwaest): Share this code as a code stub. | 611 // TODO(verwaest): Share this code as a code stub. |
| 612 SmiCheck smi_check = representation.IsTagged() | 612 SmiCheck smi_check = representation.IsTagged() |
| 613 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 613 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
| 614 if (index < 0) { | 614 if (index < 0) { |
| 615 // Set the property straight into the object. | 615 // Set the property straight into the object. |
| 616 int offset = object->map()->instance_size() + (index * kPointerSize); | 616 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 617 if (FLAG_track_double_fields && representation.IsDouble()) { | 617 if (representation.IsDouble()) { |
| 618 __ movp(FieldOperand(receiver_reg, offset), storage_reg); | 618 __ movp(FieldOperand(receiver_reg, offset), storage_reg); |
| 619 } else { | 619 } else { |
| 620 __ movp(FieldOperand(receiver_reg, offset), value_reg); | 620 __ movp(FieldOperand(receiver_reg, offset), value_reg); |
| 621 } | 621 } |
| 622 | 622 |
| 623 if (!FLAG_track_fields || !representation.IsSmi()) { | 623 if (!representation.IsSmi()) { |
| 624 // Update the write barrier for the array address. | 624 // Update the write barrier for the array address. |
| 625 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 625 if (!representation.IsDouble()) { |
| 626 __ movp(storage_reg, value_reg); | 626 __ movp(storage_reg, value_reg); |
| 627 } | 627 } |
| 628 __ RecordWriteField( | 628 __ RecordWriteField( |
| 629 receiver_reg, offset, storage_reg, scratch1, kDontSaveFPRegs, | 629 receiver_reg, offset, storage_reg, scratch1, kDontSaveFPRegs, |
| 630 EMIT_REMEMBERED_SET, smi_check); | 630 EMIT_REMEMBERED_SET, smi_check); |
| 631 } | 631 } |
| 632 } else { | 632 } else { |
| 633 // Write to the properties array. | 633 // Write to the properties array. |
| 634 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 634 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 635 // Get the properties array (optimistically). | 635 // Get the properties array (optimistically). |
| 636 __ movp(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 636 __ movp(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 637 if (FLAG_track_double_fields && representation.IsDouble()) { | 637 if (representation.IsDouble()) { |
| 638 __ movp(FieldOperand(scratch1, offset), storage_reg); | 638 __ movp(FieldOperand(scratch1, offset), storage_reg); |
| 639 } else { | 639 } else { |
| 640 __ movp(FieldOperand(scratch1, offset), value_reg); | 640 __ movp(FieldOperand(scratch1, offset), value_reg); |
| 641 } | 641 } |
| 642 | 642 |
| 643 if (!FLAG_track_fields || !representation.IsSmi()) { | 643 if (!representation.IsSmi()) { |
| 644 // Update the write barrier for the array address. | 644 // Update the write barrier for the array address. |
| 645 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 645 if (!representation.IsDouble()) { |
| 646 __ movp(storage_reg, value_reg); | 646 __ movp(storage_reg, value_reg); |
| 647 } | 647 } |
| 648 __ RecordWriteField( | 648 __ RecordWriteField( |
| 649 scratch1, offset, storage_reg, receiver_reg, kDontSaveFPRegs, | 649 scratch1, offset, storage_reg, receiver_reg, kDontSaveFPRegs, |
| 650 EMIT_REMEMBERED_SET, smi_check); | 650 EMIT_REMEMBERED_SET, smi_check); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 | 653 |
| 654 // Return the value (register rax). | 654 // Return the value (register rax). |
| 655 ASSERT(value_reg.is(rax)); | 655 ASSERT(value_reg.is(rax)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 674 | 674 |
| 675 int index = lookup->GetFieldIndex().field_index(); | 675 int index = lookup->GetFieldIndex().field_index(); |
| 676 | 676 |
| 677 // Adjust for the number of properties stored in the object. Even in the | 677 // Adjust for the number of properties stored in the object. Even in the |
| 678 // face of a transition we can use the old map here because the size of the | 678 // face of a transition we can use the old map here because the size of the |
| 679 // object and the number of in-object properties is not going to change. | 679 // object and the number of in-object properties is not going to change. |
| 680 index -= object->map()->inobject_properties(); | 680 index -= object->map()->inobject_properties(); |
| 681 | 681 |
| 682 Representation representation = lookup->representation(); | 682 Representation representation = lookup->representation(); |
| 683 ASSERT(!representation.IsNone()); | 683 ASSERT(!representation.IsNone()); |
| 684 if (FLAG_track_fields && representation.IsSmi()) { | 684 if (representation.IsSmi()) { |
| 685 __ JumpIfNotSmi(value_reg, miss_label); | 685 __ JumpIfNotSmi(value_reg, miss_label); |
| 686 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 686 } else if (representation.IsHeapObject()) { |
| 687 __ JumpIfSmi(value_reg, miss_label); | 687 __ JumpIfSmi(value_reg, miss_label); |
| 688 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 688 } else if (representation.IsDouble()) { |
| 689 // Load the double storage. | 689 // Load the double storage. |
| 690 if (index < 0) { | 690 if (index < 0) { |
| 691 int offset = object->map()->instance_size() + (index * kPointerSize); | 691 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 692 __ movp(scratch1, FieldOperand(receiver_reg, offset)); | 692 __ movp(scratch1, FieldOperand(receiver_reg, offset)); |
| 693 } else { | 693 } else { |
| 694 __ movp(scratch1, | 694 __ movp(scratch1, |
| 695 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 695 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 696 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 696 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 697 __ movp(scratch1, FieldOperand(scratch1, offset)); | 697 __ movp(scratch1, FieldOperand(scratch1, offset)); |
| 698 } | 698 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 717 } | 717 } |
| 718 | 718 |
| 719 // TODO(verwaest): Share this code as a code stub. | 719 // TODO(verwaest): Share this code as a code stub. |
| 720 SmiCheck smi_check = representation.IsTagged() | 720 SmiCheck smi_check = representation.IsTagged() |
| 721 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 721 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
| 722 if (index < 0) { | 722 if (index < 0) { |
| 723 // Set the property straight into the object. | 723 // Set the property straight into the object. |
| 724 int offset = object->map()->instance_size() + (index * kPointerSize); | 724 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 725 __ movp(FieldOperand(receiver_reg, offset), value_reg); | 725 __ movp(FieldOperand(receiver_reg, offset), value_reg); |
| 726 | 726 |
| 727 if (!FLAG_track_fields || !representation.IsSmi()) { | 727 if (!representation.IsSmi()) { |
| 728 // Update the write barrier for the array address. | 728 // Update the write barrier for the array address. |
| 729 // Pass the value being stored in the now unused name_reg. | 729 // Pass the value being stored in the now unused name_reg. |
| 730 __ movp(name_reg, value_reg); | 730 __ movp(name_reg, value_reg); |
| 731 __ RecordWriteField( | 731 __ RecordWriteField( |
| 732 receiver_reg, offset, name_reg, scratch1, kDontSaveFPRegs, | 732 receiver_reg, offset, name_reg, scratch1, kDontSaveFPRegs, |
| 733 EMIT_REMEMBERED_SET, smi_check); | 733 EMIT_REMEMBERED_SET, smi_check); |
| 734 } | 734 } |
| 735 } else { | 735 } else { |
| 736 // Write to the properties array. | 736 // Write to the properties array. |
| 737 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 737 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 738 // Get the properties array (optimistically). | 738 // Get the properties array (optimistically). |
| 739 __ movp(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 739 __ movp(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 740 __ movp(FieldOperand(scratch1, offset), value_reg); | 740 __ movp(FieldOperand(scratch1, offset), value_reg); |
| 741 | 741 |
| 742 if (!FLAG_track_fields || !representation.IsSmi()) { | 742 if (!representation.IsSmi()) { |
| 743 // Update the write barrier for the array address. | 743 // Update the write barrier for the array address. |
| 744 // Pass the value being stored in the now unused name_reg. | 744 // Pass the value being stored in the now unused name_reg. |
| 745 __ movp(name_reg, value_reg); | 745 __ movp(name_reg, value_reg); |
| 746 __ RecordWriteField( | 746 __ RecordWriteField( |
| 747 scratch1, offset, name_reg, receiver_reg, kDontSaveFPRegs, | 747 scratch1, offset, name_reg, receiver_reg, kDontSaveFPRegs, |
| 748 EMIT_REMEMBERED_SET, smi_check); | 748 EMIT_REMEMBERED_SET, smi_check); |
| 749 } | 749 } |
| 750 } | 750 } |
| 751 | 751 |
| 752 // Return the value (register rax). | 752 // Return the value (register rax). |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 // ----------------------------------- | 1473 // ----------------------------------- |
| 1474 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1474 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 | 1477 |
| 1478 #undef __ | 1478 #undef __ |
| 1479 | 1479 |
| 1480 } } // namespace v8::internal | 1480 } } // namespace v8::internal |
| 1481 | 1481 |
| 1482 #endif // V8_TARGET_ARCH_X64 | 1482 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |