OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 | 564 |
565 static inline bool IsInlinedICSite(Address address, | 565 static inline bool IsInlinedICSite(Address address, |
566 Address* inline_end_address) { | 566 Address* inline_end_address) { |
567 // If the instruction after the call site is not the pseudo instruction nop1 | 567 // If the instruction after the call site is not the pseudo instruction nop1 |
568 // then this is not related to an inlined in-object property load. The nop1 | 568 // then this is not related to an inlined in-object property load. The nop1 |
569 // instruction is located just after the call to the IC in the deferred code | 569 // instruction is located just after the call to the IC in the deferred code |
570 // handling the miss in the inlined code. After the nop1 instruction there is | 570 // handling the miss in the inlined code. After the nop1 instruction there is |
571 // a branch instruction for jumping back from the deferred code. | 571 // a branch instruction for jumping back from the deferred code. |
572 Address address_after_call = address + Assembler::kCallTargetAddressOffset; | 572 Address address_after_call = address + Assembler::kCallTargetAddressOffset; |
573 Instr instr_after_call = Assembler::instr_at(address_after_call); | 573 Instr instr_after_call = Assembler::instr_at(address_after_call); |
574 if (!Assembler::IsNop(instr_after_call, PROPERTY_LOAD_INLINED)) { | 574 if (!Assembler::IsNop(instr_after_call, PROPERTY_ACCESS_INLINED)) { |
575 return false; | 575 return false; |
576 } | 576 } |
577 Address address_after_nop = address_after_call + Assembler::kInstrSize; | 577 Address address_after_nop = address_after_call + Assembler::kInstrSize; |
578 Instr instr_after_nop = Assembler::instr_at(address_after_nop); | 578 Instr instr_after_nop = Assembler::instr_at(address_after_nop); |
579 ASSERT(Assembler::IsBranch(instr_after_nop)); | 579 ASSERT(Assembler::IsBranch(instr_after_nop)); |
580 | 580 |
581 // Find the end of the inlined code for handling the load. | 581 // Find the end of the inlined code for handling the load. |
582 int b_offset = | 582 int b_offset = |
583 Assembler::GetBranchOffset(instr_after_nop) + Assembler::kPcLoadDelta; | 583 Assembler::GetBranchOffset(instr_after_nop) + Assembler::kPcLoadDelta; |
584 ASSERT(b_offset < 0); // Jumping back from deferred code. | 584 ASSERT(b_offset < 0); // Jumping back from deferred code. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 639 |
640 // Patch the map check. | 640 // Patch the map check. |
641 Address ldr_map_instr_address = | 641 Address ldr_map_instr_address = |
642 inline_end_address - 18 * Assembler::kInstrSize; | 642 inline_end_address - 18 * Assembler::kInstrSize; |
643 Assembler::set_target_address_at(ldr_map_instr_address, | 643 Assembler::set_target_address_at(ldr_map_instr_address, |
644 reinterpret_cast<Address>(map)); | 644 reinterpret_cast<Address>(map)); |
645 return true; | 645 return true; |
646 } | 646 } |
647 | 647 |
648 | 648 |
649 void KeyedStoreIC::ClearInlinedVersion(Address address) {} | 649 void KeyedStoreIC::ClearInlinedVersion(Address address) { |
| 650 // Insert null as the elements map to check for. This will make |
| 651 // sure that the elements fast-case map check fails so that control |
| 652 // flows to the IC instead of the inlined version. |
| 653 PatchInlinedStore(address, Heap::null_value()); |
| 654 } |
650 | 655 |
651 | 656 |
652 void KeyedStoreIC::RestoreInlinedVersion(Address address) {} | 657 void KeyedStoreIC::RestoreInlinedVersion(Address address) { |
| 658 // Restore the fast-case elements map check so that the inlined |
| 659 // version can be used again. |
| 660 PatchInlinedStore(address, Heap::fixed_array_map()); |
| 661 } |
653 | 662 |
654 | 663 |
655 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { | 664 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { |
656 return false; | 665 // Find the end of the inlined code for handling the store if this is an |
| 666 // inlined IC call site. |
| 667 Address inline_end_address; |
| 668 if (!IsInlinedICSite(address, &inline_end_address)) return false; |
| 669 |
| 670 // Patch the map check. |
| 671 Address ldr_map_instr_address = |
| 672 inline_end_address - 5 * Assembler::kInstrSize; |
| 673 Assembler::set_target_address_at(ldr_map_instr_address, |
| 674 reinterpret_cast<Address>(map)); |
| 675 return true; |
657 } | 676 } |
658 | 677 |
659 | 678 |
660 Object* KeyedLoadIC_Miss(Arguments args); | 679 Object* KeyedLoadIC_Miss(Arguments args); |
661 | 680 |
662 | 681 |
663 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 682 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
664 // ---------- S t a t e -------------- | 683 // ---------- S t a t e -------------- |
665 // -- lr : return address | 684 // -- lr : return address |
666 // -- sp[0] : key | 685 // -- sp[0] : key |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 __ bind(&miss); | 1777 __ bind(&miss); |
1759 | 1778 |
1760 GenerateMiss(masm); | 1779 GenerateMiss(masm); |
1761 } | 1780 } |
1762 | 1781 |
1763 | 1782 |
1764 #undef __ | 1783 #undef __ |
1765 | 1784 |
1766 | 1785 |
1767 } } // namespace v8::internal | 1786 } } // namespace v8::internal |
OLD | NEW |