OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // For page containing |object| mark region covering |addr| dirty. | 64 // For page containing |object| mark region covering |addr| dirty. |
65 // RecordWriteHelper only works if the object is not in new | 65 // RecordWriteHelper only works if the object is not in new |
66 // space. | 66 // space. |
67 void RecordWriteHelper(Register object, | 67 void RecordWriteHelper(Register object, |
68 Register addr, | 68 Register addr, |
69 Register scratch); | 69 Register scratch); |
70 | 70 |
71 // Check if object is in new space. | 71 // Check if object is in new space. |
72 // scratch can be object itself, but it will be clobbered. | 72 // scratch can be object itself, but it will be clobbered. |
| 73 template <typename LabelType> |
73 void InNewSpace(Register object, | 74 void InNewSpace(Register object, |
74 Register scratch, | 75 Register scratch, |
75 Condition cc, // equal for new space, not_equal otherwise. | 76 Condition cc, // equal for new space, not_equal otherwise. |
76 Label* branch); | 77 LabelType* branch); |
77 | 78 |
78 // For page containing |object| mark region covering [object+offset] | 79 // For page containing |object| mark region covering [object+offset] |
79 // dirty. |object| is the object being stored into, |value| is the | 80 // dirty. |object| is the object being stored into, |value| is the |
80 // object being stored. If offset is zero, then the scratch register | 81 // object being stored. If offset is zero, then the scratch register |
81 // contains the array index into the elements array represented as a | 82 // contains the array index into the elements array represented as a |
82 // Smi. All registers are clobbered by the operation. RecordWrite | 83 // Smi. All registers are clobbered by the operation. RecordWrite |
83 // filters out smis so it does not update the write barrier if the | 84 // filters out smis so it does not update the write barrier if the |
84 // value is a smi. | 85 // value is a smi. |
85 void RecordWrite(Register object, | 86 void RecordWrite(Register object, |
86 int offset, | 87 int offset, |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 | 652 |
652 // Helper for PopHandleScope. Allowed to perform a GC and returns | 653 // Helper for PopHandleScope. Allowed to perform a GC and returns |
653 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and | 654 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and |
654 // possibly returns a failure object indicating an allocation failure. | 655 // possibly returns a failure object indicating an allocation failure. |
655 MUST_USE_RESULT MaybeObject* PopHandleScopeHelper(Register saved, | 656 MUST_USE_RESULT MaybeObject* PopHandleScopeHelper(Register saved, |
656 Register scratch, | 657 Register scratch, |
657 bool gc_allowed); | 658 bool gc_allowed); |
658 }; | 659 }; |
659 | 660 |
660 | 661 |
| 662 template <typename LabelType> |
| 663 void MacroAssembler::InNewSpace(Register object, |
| 664 Register scratch, |
| 665 Condition cc, |
| 666 LabelType* branch) { |
| 667 ASSERT(cc == equal || cc == not_equal); |
| 668 if (Serializer::enabled()) { |
| 669 // Can't do arithmetic on external references if it might get serialized. |
| 670 mov(scratch, Operand(object)); |
| 671 // The mask isn't really an address. We load it as an external reference in |
| 672 // case the size of the new space is different between the snapshot maker |
| 673 // and the running system. |
| 674 and_(Operand(scratch), Immediate(ExternalReference::new_space_mask())); |
| 675 cmp(Operand(scratch), Immediate(ExternalReference::new_space_start())); |
| 676 j(cc, branch); |
| 677 } else { |
| 678 int32_t new_space_start = reinterpret_cast<int32_t>( |
| 679 ExternalReference::new_space_start().address()); |
| 680 lea(scratch, Operand(object, -new_space_start)); |
| 681 and_(scratch, Heap::NewSpaceMask()); |
| 682 j(cc, branch); |
| 683 } |
| 684 } |
| 685 |
| 686 |
661 // The code patcher is used to patch (typically) small parts of code e.g. for | 687 // The code patcher is used to patch (typically) small parts of code e.g. for |
662 // debugging and other types of instrumentation. When using the code patcher | 688 // debugging and other types of instrumentation. When using the code patcher |
663 // the exact number of bytes specified must be emitted. Is not legal to emit | 689 // the exact number of bytes specified must be emitted. Is not legal to emit |
664 // relocation information. If any of these constraints are violated it causes | 690 // relocation information. If any of these constraints are violated it causes |
665 // an assertion. | 691 // an assertion. |
666 class CodePatcher { | 692 class CodePatcher { |
667 public: | 693 public: |
668 CodePatcher(byte* address, int size); | 694 CodePatcher(byte* address, int size); |
669 virtual ~CodePatcher(); | 695 virtual ~CodePatcher(); |
670 | 696 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 } \ | 765 } \ |
740 masm-> | 766 masm-> |
741 #else | 767 #else |
742 #define ACCESS_MASM(masm) masm-> | 768 #define ACCESS_MASM(masm) masm-> |
743 #endif | 769 #endif |
744 | 770 |
745 | 771 |
746 } } // namespace v8::internal | 772 } } // namespace v8::internal |
747 | 773 |
748 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 774 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |