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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 5745005: Provide baseline GC version. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 : Assembler(buffer, size), 45 : Assembler(buffer, size),
46 generating_stub_(false), 46 generating_stub_(false),
47 allow_stub_calls_(true), 47 allow_stub_calls_(true),
48 code_object_(Heap::undefined_value()) { 48 code_object_(Heap::undefined_value()) {
49 } 49 }
50 50
51 51
52 void MacroAssembler::RecordWriteHelper(Register object, 52 void MacroAssembler::RecordWriteHelper(Register object,
53 Register addr, 53 Register addr,
54 Register scratch) { 54 Register scratch) {
55 #ifndef BASELINE_GC
55 if (FLAG_debug_code) { 56 if (FLAG_debug_code) {
56 // Check that the object is not in new space. 57 // Check that the object is not in new space.
57 Label not_in_new_space; 58 Label not_in_new_space;
58 InNewSpace(object, scratch, not_equal, &not_in_new_space); 59 InNewSpace(object, scratch, not_equal, &not_in_new_space);
59 Abort("new-space object passed to RecordWriteHelper"); 60 Abort("new-space object passed to RecordWriteHelper");
60 bind(&not_in_new_space); 61 bind(&not_in_new_space);
61 } 62 }
62 63
63 // Compute the page start address from the heap object pointer, and reuse 64 // Compute the page start address from the heap object pointer, and reuse
64 // the 'object' register for it. 65 // the 'object' register for it.
65 and_(object, ~Page::kPageAlignmentMask); 66 and_(object, ~Page::kPageAlignmentMask);
66 67
67 // Compute number of region covering addr. See Page::GetRegionNumberForAddress 68 // Compute number of region covering addr. See Page::GetRegionNumberForAddress
68 // method for more details. 69 // method for more details.
69 and_(addr, Page::kPageAlignmentMask); 70 and_(addr, Page::kPageAlignmentMask);
70 shr(addr, Page::kRegionSizeLog2); 71 shr(addr, Page::kRegionSizeLog2);
71 72
72 // Set dirty mark for region. 73 // Set dirty mark for region.
73 bts(Operand(object, Page::kDirtyFlagOffset), addr); 74 bts(Operand(object, Page::kDirtyFlagOffset), addr);
75 #endif
74 } 76 }
75 77
76 78
77 void MacroAssembler::InNewSpace(Register object, 79 void MacroAssembler::InNewSpace(Register object,
78 Register scratch, 80 Register scratch,
79 Condition cc, 81 Condition cc,
80 Label* branch) { 82 Label* branch) {
81 ASSERT(cc == equal || cc == not_equal); 83 ASSERT(cc == equal || cc == not_equal);
82 if (Serializer::enabled()) { 84 if (Serializer::enabled()) {
83 // Can't do arithmetic on external references if it might get serialized. 85 // Can't do arithmetic on external references if it might get serialized.
(...skipping 11 matching lines...) Expand all
95 and_(scratch, Heap::NewSpaceMask()); 97 and_(scratch, Heap::NewSpaceMask());
96 j(cc, branch); 98 j(cc, branch);
97 } 99 }
98 } 100 }
99 101
100 102
101 void MacroAssembler::RecordWrite(Register object, 103 void MacroAssembler::RecordWrite(Register object,
102 int offset, 104 int offset,
103 Register value, 105 Register value,
104 Register scratch) { 106 Register scratch) {
107 #ifndef BASELINE_GC
105 // The compiled code assumes that record write doesn't change the 108 // The compiled code assumes that record write doesn't change the
106 // context register, so we check that none of the clobbered 109 // context register, so we check that none of the clobbered
107 // registers are esi. 110 // registers are esi.
108 ASSERT(!object.is(esi) && !value.is(esi) && !scratch.is(esi)); 111 ASSERT(!object.is(esi) && !value.is(esi) && !scratch.is(esi));
109 112
110 // First, check if a write barrier is even needed. The tests below 113 // First, check if a write barrier is even needed. The tests below
111 // catch stores of Smis and stores into young gen. 114 // catch stores of Smis and stores into young gen.
112 Label done; 115 Label done;
113 116
114 // Skip barrier if writing a smi. 117 // Skip barrier if writing a smi.
(...skipping 17 matching lines...) Expand all
132 // KeyedStoreIC::GenerateGeneric. Multiply a smi by 2 to get an offset 135 // KeyedStoreIC::GenerateGeneric. Multiply a smi by 2 to get an offset
133 // into an array of words. 136 // into an array of words.
134 ASSERT_EQ(1, kSmiTagSize); 137 ASSERT_EQ(1, kSmiTagSize);
135 ASSERT_EQ(0, kSmiTag); 138 ASSERT_EQ(0, kSmiTag);
136 lea(dst, Operand(object, dst, times_half_pointer_size, 139 lea(dst, Operand(object, dst, times_half_pointer_size,
137 FixedArray::kHeaderSize - kHeapObjectTag)); 140 FixedArray::kHeaderSize - kHeapObjectTag));
138 } 141 }
139 RecordWriteHelper(object, dst, value); 142 RecordWriteHelper(object, dst, value);
140 143
141 bind(&done); 144 bind(&done);
145 #endif
142 146
143 // Clobber all input registers when running with the debug-code flag 147 // Clobber all input registers when running with the debug-code flag
144 // turned on to provoke errors. 148 // turned on to provoke errors.
145 if (FLAG_debug_code) { 149 if (FLAG_debug_code) {
146 mov(object, Immediate(BitCast<int32_t>(kZapValue))); 150 mov(object, Immediate(BitCast<int32_t>(kZapValue)));
147 mov(value, Immediate(BitCast<int32_t>(kZapValue))); 151 mov(value, Immediate(BitCast<int32_t>(kZapValue)));
148 mov(scratch, Immediate(BitCast<int32_t>(kZapValue))); 152 mov(scratch, Immediate(BitCast<int32_t>(kZapValue)));
149 } 153 }
150 } 154 }
151 155
152 156
153 void MacroAssembler::RecordWrite(Register object, 157 void MacroAssembler::RecordWrite(Register object,
154 Register address, 158 Register address,
155 Register value) { 159 Register value) {
160 #ifndef BASELINE_GC
156 // The compiled code assumes that record write doesn't change the 161 // The compiled code assumes that record write doesn't change the
157 // context register, so we check that none of the clobbered 162 // context register, so we check that none of the clobbered
158 // registers are esi. 163 // registers are esi.
159 ASSERT(!object.is(esi) && !value.is(esi) && !address.is(esi)); 164 ASSERT(!object.is(esi) && !value.is(esi) && !address.is(esi));
160 165
161 // First, check if a write barrier is even needed. The tests below 166 // First, check if a write barrier is even needed. The tests below
162 // catch stores of Smis and stores into young gen. 167 // catch stores of Smis and stores into young gen.
163 Label done; 168 Label done;
164 169
165 // Skip barrier if writing a smi. 170 // Skip barrier if writing a smi.
166 ASSERT_EQ(0, kSmiTag); 171 ASSERT_EQ(0, kSmiTag);
167 test(value, Immediate(kSmiTagMask)); 172 test(value, Immediate(kSmiTagMask));
168 j(zero, &done); 173 j(zero, &done);
169 174
170 InNewSpace(object, value, equal, &done); 175 InNewSpace(object, value, equal, &done);
171 176
172 RecordWriteHelper(object, address, value); 177 RecordWriteHelper(object, address, value);
173 178
174 bind(&done); 179 bind(&done);
180 #endif
175 181
176 // Clobber all input registers when running with the debug-code flag 182 // Clobber all input registers when running with the debug-code flag
177 // turned on to provoke errors. 183 // turned on to provoke errors.
178 if (FLAG_debug_code) { 184 if (FLAG_debug_code) {
179 mov(object, Immediate(BitCast<int32_t>(kZapValue))); 185 mov(object, Immediate(BitCast<int32_t>(kZapValue)));
180 mov(address, Immediate(BitCast<int32_t>(kZapValue))); 186 mov(address, Immediate(BitCast<int32_t>(kZapValue)));
181 mov(value, Immediate(BitCast<int32_t>(kZapValue))); 187 mov(value, Immediate(BitCast<int32_t>(kZapValue)));
182 } 188 }
183 } 189 }
184 190
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 1921
1916 // Check that the code was patched as expected. 1922 // Check that the code was patched as expected.
1917 ASSERT(masm_.pc_ == address_ + size_); 1923 ASSERT(masm_.pc_ == address_ + size_);
1918 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1924 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1919 } 1925 }
1920 1926
1921 1927
1922 } } // namespace v8::internal 1928 } } // namespace v8::internal
1923 1929
1924 #endif // V8_TARGET_ARCH_IA32 1930 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/ia32/ic-ia32.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698