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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 __ lw(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); | 306 __ lw(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
307 } | 307 } |
308 | 308 |
309 | 309 |
310 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, | 310 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, |
311 Register dst, | 311 Register dst, |
312 Register src, | 312 Register src, |
313 bool inobject, | 313 bool inobject, |
314 int index, | 314 int index, |
315 Representation representation) { | 315 Representation representation) { |
316 ASSERT(!FLAG_track_double_fields || !representation.IsDouble()); | 316 ASSERT(!representation.IsDouble()); |
317 int offset = index * kPointerSize; | 317 int offset = index * kPointerSize; |
318 if (!inobject) { | 318 if (!inobject) { |
319 // Calculate the offset into the properties array. | 319 // Calculate the offset into the properties array. |
320 offset = offset + FixedArray::kHeaderSize; | 320 offset = offset + FixedArray::kHeaderSize; |
321 __ lw(dst, FieldMemOperand(src, JSObject::kPropertiesOffset)); | 321 __ lw(dst, FieldMemOperand(src, JSObject::kPropertiesOffset)); |
322 src = dst; | 322 src = dst; |
323 } | 323 } |
324 __ lw(dst, FieldMemOperand(src, offset)); | 324 __ lw(dst, FieldMemOperand(src, offset)); |
325 } | 325 } |
326 | 326 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 int descriptor = transition->LastAdded(); | 460 int descriptor = transition->LastAdded(); |
461 DescriptorArray* descriptors = transition->instance_descriptors(); | 461 DescriptorArray* descriptors = transition->instance_descriptors(); |
462 PropertyDetails details = descriptors->GetDetails(descriptor); | 462 PropertyDetails details = descriptors->GetDetails(descriptor); |
463 Representation representation = details.representation(); | 463 Representation representation = details.representation(); |
464 ASSERT(!representation.IsNone()); | 464 ASSERT(!representation.IsNone()); |
465 | 465 |
466 if (details.type() == CONSTANT) { | 466 if (details.type() == CONSTANT) { |
467 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); | 467 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); |
468 __ li(scratch1, constant); | 468 __ li(scratch1, constant); |
469 __ Branch(miss_label, ne, value_reg, Operand(scratch1)); | 469 __ Branch(miss_label, ne, value_reg, Operand(scratch1)); |
470 } else if (FLAG_track_fields && representation.IsSmi()) { | 470 } else if (representation.IsSmi()) { |
471 __ JumpIfNotSmi(value_reg, miss_label); | 471 __ JumpIfNotSmi(value_reg, miss_label); |
472 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 472 } else if (representation.IsHeapObject()) { |
473 __ JumpIfSmi(value_reg, miss_label); | 473 __ JumpIfSmi(value_reg, miss_label); |
474 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 474 } else if (representation.IsDouble()) { |
475 Label do_store, heap_number; | 475 Label do_store, heap_number; |
476 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); | 476 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); |
477 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); | 477 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); |
478 | 478 |
479 __ JumpIfNotSmi(value_reg, &heap_number); | 479 __ JumpIfNotSmi(value_reg, &heap_number); |
480 __ SmiUntag(scratch1, value_reg); | 480 __ SmiUntag(scratch1, value_reg); |
481 __ mtc1(scratch1, f6); | 481 __ mtc1(scratch1, f6); |
482 __ cvt_d_w(f4, f6); | 482 __ cvt_d_w(f4, f6); |
483 __ jmp(&do_store); | 483 __ jmp(&do_store); |
484 | 484 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // face of a transition we can use the old map here because the size of the | 538 // face of a transition we can use the old map here because the size of the |
539 // object and the number of in-object properties is not going to change. | 539 // object and the number of in-object properties is not going to change. |
540 index -= object->map()->inobject_properties(); | 540 index -= object->map()->inobject_properties(); |
541 | 541 |
542 // TODO(verwaest): Share this code as a code stub. | 542 // TODO(verwaest): Share this code as a code stub. |
543 SmiCheck smi_check = representation.IsTagged() | 543 SmiCheck smi_check = representation.IsTagged() |
544 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 544 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
545 if (index < 0) { | 545 if (index < 0) { |
546 // Set the property straight into the object. | 546 // Set the property straight into the object. |
547 int offset = object->map()->instance_size() + (index * kPointerSize); | 547 int offset = object->map()->instance_size() + (index * kPointerSize); |
548 if (FLAG_track_double_fields && representation.IsDouble()) { | 548 if (representation.IsDouble()) { |
549 __ sw(storage_reg, FieldMemOperand(receiver_reg, offset)); | 549 __ sw(storage_reg, FieldMemOperand(receiver_reg, offset)); |
550 } else { | 550 } else { |
551 __ sw(value_reg, FieldMemOperand(receiver_reg, offset)); | 551 __ sw(value_reg, FieldMemOperand(receiver_reg, offset)); |
552 } | 552 } |
553 | 553 |
554 if (!FLAG_track_fields || !representation.IsSmi()) { | 554 if (!representation.IsSmi()) { |
555 // Update the write barrier for the array address. | 555 // Update the write barrier for the array address. |
556 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 556 if (!representation.IsDouble()) { |
557 __ mov(storage_reg, value_reg); | 557 __ mov(storage_reg, value_reg); |
558 } | 558 } |
559 __ RecordWriteField(receiver_reg, | 559 __ RecordWriteField(receiver_reg, |
560 offset, | 560 offset, |
561 storage_reg, | 561 storage_reg, |
562 scratch1, | 562 scratch1, |
563 kRAHasNotBeenSaved, | 563 kRAHasNotBeenSaved, |
564 kDontSaveFPRegs, | 564 kDontSaveFPRegs, |
565 EMIT_REMEMBERED_SET, | 565 EMIT_REMEMBERED_SET, |
566 smi_check); | 566 smi_check); |
567 } | 567 } |
568 } else { | 568 } else { |
569 // Write to the properties array. | 569 // Write to the properties array. |
570 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 570 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
571 // Get the properties array | 571 // Get the properties array |
572 __ lw(scratch1, | 572 __ lw(scratch1, |
573 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 573 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
574 if (FLAG_track_double_fields && representation.IsDouble()) { | 574 if (representation.IsDouble()) { |
575 __ sw(storage_reg, FieldMemOperand(scratch1, offset)); | 575 __ sw(storage_reg, FieldMemOperand(scratch1, offset)); |
576 } else { | 576 } else { |
577 __ sw(value_reg, FieldMemOperand(scratch1, offset)); | 577 __ sw(value_reg, FieldMemOperand(scratch1, offset)); |
578 } | 578 } |
579 | 579 |
580 if (!FLAG_track_fields || !representation.IsSmi()) { | 580 if (!representation.IsSmi()) { |
581 // Update the write barrier for the array address. | 581 // Update the write barrier for the array address. |
582 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 582 if (!representation.IsDouble()) { |
583 __ mov(storage_reg, value_reg); | 583 __ mov(storage_reg, value_reg); |
584 } | 584 } |
585 __ RecordWriteField(scratch1, | 585 __ RecordWriteField(scratch1, |
586 offset, | 586 offset, |
587 storage_reg, | 587 storage_reg, |
588 receiver_reg, | 588 receiver_reg, |
589 kRAHasNotBeenSaved, | 589 kRAHasNotBeenSaved, |
590 kDontSaveFPRegs, | 590 kDontSaveFPRegs, |
591 EMIT_REMEMBERED_SET, | 591 EMIT_REMEMBERED_SET, |
592 smi_check); | 592 smi_check); |
(...skipping 30 matching lines...) Expand all Loading... |
623 | 623 |
624 int index = lookup->GetFieldIndex().field_index(); | 624 int index = lookup->GetFieldIndex().field_index(); |
625 | 625 |
626 // Adjust for the number of properties stored in the object. Even in the | 626 // Adjust for the number of properties stored in the object. Even in the |
627 // face of a transition we can use the old map here because the size of the | 627 // face of a transition we can use the old map here because the size of the |
628 // object and the number of in-object properties is not going to change. | 628 // object and the number of in-object properties is not going to change. |
629 index -= object->map()->inobject_properties(); | 629 index -= object->map()->inobject_properties(); |
630 | 630 |
631 Representation representation = lookup->representation(); | 631 Representation representation = lookup->representation(); |
632 ASSERT(!representation.IsNone()); | 632 ASSERT(!representation.IsNone()); |
633 if (FLAG_track_fields && representation.IsSmi()) { | 633 if (representation.IsSmi()) { |
634 __ JumpIfNotSmi(value_reg, miss_label); | 634 __ JumpIfNotSmi(value_reg, miss_label); |
635 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 635 } else if (representation.IsHeapObject()) { |
636 __ JumpIfSmi(value_reg, miss_label); | 636 __ JumpIfSmi(value_reg, miss_label); |
637 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 637 } else if (representation.IsDouble()) { |
638 // Load the double storage. | 638 // Load the double storage. |
639 if (index < 0) { | 639 if (index < 0) { |
640 int offset = object->map()->instance_size() + (index * kPointerSize); | 640 int offset = object->map()->instance_size() + (index * kPointerSize); |
641 __ lw(scratch1, FieldMemOperand(receiver_reg, offset)); | 641 __ lw(scratch1, FieldMemOperand(receiver_reg, offset)); |
642 } else { | 642 } else { |
643 __ lw(scratch1, | 643 __ lw(scratch1, |
644 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 644 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
645 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 645 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
646 __ lw(scratch1, FieldMemOperand(scratch1, offset)); | 646 __ lw(scratch1, FieldMemOperand(scratch1, offset)); |
647 } | 647 } |
(...skipping 21 matching lines...) Expand all Loading... |
669 } | 669 } |
670 | 670 |
671 // TODO(verwaest): Share this code as a code stub. | 671 // TODO(verwaest): Share this code as a code stub. |
672 SmiCheck smi_check = representation.IsTagged() | 672 SmiCheck smi_check = representation.IsTagged() |
673 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 673 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
674 if (index < 0) { | 674 if (index < 0) { |
675 // Set the property straight into the object. | 675 // Set the property straight into the object. |
676 int offset = object->map()->instance_size() + (index * kPointerSize); | 676 int offset = object->map()->instance_size() + (index * kPointerSize); |
677 __ sw(value_reg, FieldMemOperand(receiver_reg, offset)); | 677 __ sw(value_reg, FieldMemOperand(receiver_reg, offset)); |
678 | 678 |
679 if (!FLAG_track_fields || !representation.IsSmi()) { | 679 if (!representation.IsSmi()) { |
680 // Skip updating write barrier if storing a smi. | 680 // Skip updating write barrier if storing a smi. |
681 __ JumpIfSmi(value_reg, &exit); | 681 __ JumpIfSmi(value_reg, &exit); |
682 | 682 |
683 // Update the write barrier for the array address. | 683 // Update the write barrier for the array address. |
684 // Pass the now unused name_reg as a scratch register. | 684 // Pass the now unused name_reg as a scratch register. |
685 __ mov(name_reg, value_reg); | 685 __ mov(name_reg, value_reg); |
686 __ RecordWriteField(receiver_reg, | 686 __ RecordWriteField(receiver_reg, |
687 offset, | 687 offset, |
688 name_reg, | 688 name_reg, |
689 scratch1, | 689 scratch1, |
690 kRAHasNotBeenSaved, | 690 kRAHasNotBeenSaved, |
691 kDontSaveFPRegs, | 691 kDontSaveFPRegs, |
692 EMIT_REMEMBERED_SET, | 692 EMIT_REMEMBERED_SET, |
693 smi_check); | 693 smi_check); |
694 } | 694 } |
695 } else { | 695 } else { |
696 // Write to the properties array. | 696 // Write to the properties array. |
697 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 697 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
698 // Get the properties array. | 698 // Get the properties array. |
699 __ lw(scratch1, | 699 __ lw(scratch1, |
700 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); | 700 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
701 __ sw(value_reg, FieldMemOperand(scratch1, offset)); | 701 __ sw(value_reg, FieldMemOperand(scratch1, offset)); |
702 | 702 |
703 if (!FLAG_track_fields || !representation.IsSmi()) { | 703 if (!representation.IsSmi()) { |
704 // Skip updating write barrier if storing a smi. | 704 // Skip updating write barrier if storing a smi. |
705 __ JumpIfSmi(value_reg, &exit); | 705 __ JumpIfSmi(value_reg, &exit); |
706 | 706 |
707 // Update the write barrier for the array address. | 707 // Update the write barrier for the array address. |
708 // Ok to clobber receiver_reg and name_reg, since we return. | 708 // Ok to clobber receiver_reg and name_reg, since we return. |
709 __ mov(name_reg, value_reg); | 709 __ mov(name_reg, value_reg); |
710 __ RecordWriteField(scratch1, | 710 __ RecordWriteField(scratch1, |
711 offset, | 711 offset, |
712 name_reg, | 712 name_reg, |
713 receiver_reg, | 713 receiver_reg, |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 // ----------------------------------- | 1571 // ----------------------------------- |
1572 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1572 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1573 } | 1573 } |
1574 | 1574 |
1575 | 1575 |
1576 #undef __ | 1576 #undef __ |
1577 | 1577 |
1578 } } // namespace v8::internal | 1578 } } // namespace v8::internal |
1579 | 1579 |
1580 #endif // V8_TARGET_ARCH_MIPS | 1580 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |