Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: src/x64/macro-assembler-x64.h

Issue 6026017: Fix/implement new write barrier for x64. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 void LoadRoot(Register destination, Heap::RootListIndex index); 75 void LoadRoot(Register destination, Heap::RootListIndex index);
76 void CompareRoot(Register with, Heap::RootListIndex index); 76 void CompareRoot(Register with, Heap::RootListIndex index);
77 void CompareRoot(Operand with, Heap::RootListIndex index); 77 void CompareRoot(Operand with, Heap::RootListIndex index);
78 void PushRoot(Heap::RootListIndex index); 78 void PushRoot(Heap::RootListIndex index);
79 void StoreRoot(Register source, Heap::RootListIndex index); 79 void StoreRoot(Register source, Heap::RootListIndex index);
80 80
81 // --------------------------------------------------------------------------- 81 // ---------------------------------------------------------------------------
82 // GC Support 82 // GC Support
83 83
84 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
85 // For page containing |object| mark region covering |addr| dirty. 84 // For page containing |object| mark region covering |addr| dirty.
86 // RecordWriteHelper only works if the object is not in new 85 // RecordWriteHelper only works if the object is not in new
87 // space. 86 // space.
88 void RecordWriteHelper(Register object, 87 void RecordWriteHelper(Register object,
89 Register addr, 88 Register addr,
90 Register scratch); 89 Register scratch,
90 SaveFPRegsMode save_fp);
91 91
92 // Check if object is in new space. The condition cc can be equal or 92 // Check if object is in new space. The condition cc can be equal or
93 // not_equal. If it is equal a jump will be done if the object is on new 93 // not_equal. If it is equal a jump will be done if the object is on new
94 // space. The register scratch can be object itself, but it will be clobbered. 94 // space. The register scratch can be object itself, but it will be clobbered.
95 template <typename LabelType> 95 template <typename LabelType>
96 void InNewSpace(Register object, 96 void InNewSpace(Register object,
97 Register scratch, 97 Register scratch,
98 Condition cc, 98 Condition cc,
99 LabelType* branch); 99 LabelType* branch);
100 100
101 // For page containing |object| mark region covering [object+offset] 101 // For page containing |object| mark region covering [object+offset]
102 // dirty. |object| is the object being stored into, |value| is the 102 // dirty. |object| is the object being stored into, |value| is the
103 // object being stored. If |offset| is zero, then the |scratch| 103 // object being stored. If |offset| is zero, then the |scratch|
104 // register contains the array index into the elements array 104 // register contains the array index into the elements array
105 // represented as an untagged 32-bit integer. All registers are 105 // represented as an untagged 32-bit integer. All registers are
106 // clobbered by the operation. RecordWrite filters out smis so it 106 // clobbered by the operation. RecordWrite filters out smis so it
107 // does not update the write barrier if the value is a smi. 107 // does not update the write barrier if the value is a smi.
108 void RecordWrite(Register object, 108 void RecordWrite(Register object,
109 int offset, 109 int offset,
110 Register value, 110 Register value,
111 Register scratch); 111 Register scratch,
112 SaveFPRegsMode save_fp);
112 113
113 // For page containing |object| mark region covering [address] 114 // For page containing |object| mark region covering [address]
114 // dirty. |object| is the object being stored into, |value| is the 115 // dirty. |object| is the object being stored into, |value| is the
115 // object being stored. All registers are clobbered by the 116 // object being stored. All registers are clobbered by the
116 // operation. RecordWrite filters out smis so it does not update 117 // operation. RecordWrite filters out smis so it does not update
117 // the write barrier if the value is a smi. 118 // the write barrier if the value is a smi.
118 void RecordWrite(Register object, 119 void RecordWrite(Register object,
119 Register address, 120 Register address,
120 Register value); 121 Register value,
122 SaveFPRegsMode save_fp);
121 123
122 // For page containing |object| mark region covering [object+offset] dirty. 124 // For page containing |object| mark region covering [object+offset] dirty.
123 // The value is known to not be a smi. 125 // The value is known to not be a smi.
124 // object is the object being stored into, value is the object being stored. 126 // object is the object being stored into, value is the object being stored.
125 // If offset is zero, then the scratch register contains the array index into 127 // If offset is zero, then the scratch register contains the array index into
126 // the elements array represented as an untagged 32-bit integer. 128 // the elements array represented as an untagged 32-bit integer.
127 // All registers are clobbered by the operation. 129 // All registers are clobbered by the operation.
128 void RecordWriteNonSmi(Register object, 130 void RecordWriteNonSmi(Register object,
129 int offset, 131 int offset,
130 Register value, 132 Register value,
131 Register scratch); 133 Register scratch,
132 #endif 134 SaveFPRegsMode save_fp);
133 135
134 #ifdef ENABLE_DEBUGGER_SUPPORT 136 #ifdef ENABLE_DEBUGGER_SUPPORT
135 // --------------------------------------------------------------------------- 137 // ---------------------------------------------------------------------------
136 // Debugger Support 138 // Debugger Support
137 139
138 void DebugBreak(); 140 void DebugBreak();
139 #endif 141 #endif
140 142
141 // --------------------------------------------------------------------------- 143 // ---------------------------------------------------------------------------
142 // Activation frames 144 // Activation frames
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 andl(scratch2, Immediate(kFlatAsciiStringMask)); 1645 andl(scratch2, Immediate(kFlatAsciiStringMask));
1644 // Interleave the bits to check both scratch1 and scratch2 in one test. 1646 // Interleave the bits to check both scratch1 and scratch2 in one test.
1645 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); 1647 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
1646 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); 1648 lea(scratch1, Operand(scratch1, scratch2, times_8, 0));
1647 cmpl(scratch1, 1649 cmpl(scratch1,
1648 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); 1650 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3)));
1649 j(not_equal, on_fail); 1651 j(not_equal, on_fail);
1650 } 1652 }
1651 1653
1652 1654
1653 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1654 template <typename LabelType> 1655 template <typename LabelType>
1655 void MacroAssembler::InNewSpace(Register object, 1656 void MacroAssembler::InNewSpace(Register object,
1656 Register scratch, 1657 Register scratch,
1657 Condition cc, 1658 Condition cc,
1658 LabelType* branch) { 1659 LabelType* branch) {
1659 if (Serializer::enabled()) { 1660 if (Serializer::enabled()) {
1660 // Can't do arithmetic on external references if it might get serialized. 1661 // Can't do arithmetic on external references if it might get serialized.
1661 // The mask isn't really an address. We load it as an external reference in 1662 // The mask isn't really an address. We load it as an external reference in
1662 // case the size of the new space is different between the snapshot maker 1663 // case the size of the new space is different between the snapshot maker
1663 // and the running system. 1664 // and the running system.
(...skipping 14 matching lines...) Expand all
1678 movq(kScratchRegister, -new_space_start, RelocInfo::NONE); 1679 movq(kScratchRegister, -new_space_start, RelocInfo::NONE);
1679 if (scratch.is(object)) { 1680 if (scratch.is(object)) {
1680 addq(scratch, kScratchRegister); 1681 addq(scratch, kScratchRegister);
1681 } else { 1682 } else {
1682 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); 1683 lea(scratch, Operand(object, kScratchRegister, times_1, 0));
1683 } 1684 }
1684 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask()))); 1685 and_(scratch, Immediate(static_cast<int32_t>(Heap::NewSpaceMask())));
1685 j(cc, branch); 1686 j(cc, branch);
1686 } 1687 }
1687 } 1688 }
1688 #endif 1689
1689 1690
1690 template <typename LabelType> 1691 template <typename LabelType>
1691 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 1692 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
1692 const ParameterCount& actual, 1693 const ParameterCount& actual,
1693 Handle<Code> code_constant, 1694 Handle<Code> code_constant,
1694 Register code_register, 1695 Register code_register,
1695 LabelType* done, 1696 LabelType* done,
1696 InvokeFlag flag) { 1697 InvokeFlag flag) {
1697 bool definitely_matches = false; 1698 bool definitely_matches = false;
1698 NearLabel invoke; 1699 NearLabel invoke;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 Jump(adaptor, RelocInfo::CODE_TARGET); 1750 Jump(adaptor, RelocInfo::CODE_TARGET);
1750 } 1751 }
1751 bind(&invoke); 1752 bind(&invoke);
1752 } 1753 }
1753 } 1754 }
1754 1755
1755 1756
1756 } } // namespace v8::internal 1757 } } // namespace v8::internal
1757 1758
1758 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 1759 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698