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

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

Issue 7776010: Convert a bunch of ASSERTs to STATIC_ASSERTs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 void MacroAssembler::RecordWrite(Register object, 142 void MacroAssembler::RecordWrite(Register object,
143 int offset, 143 int offset,
144 Register value, 144 Register value,
145 Register scratch) { 145 Register scratch) {
146 // First, check if a write barrier is even needed. The tests below 146 // First, check if a write barrier is even needed. The tests below
147 // catch stores of Smis and stores into young gen. 147 // catch stores of Smis and stores into young gen.
148 Label done; 148 Label done;
149 149
150 // Skip barrier if writing a smi. 150 // Skip barrier if writing a smi.
151 ASSERT_EQ(0, kSmiTag); 151 STATIC_ASSERT(kSmiTag == 0);
152 JumpIfSmi(value, &done, Label::kNear); 152 JumpIfSmi(value, &done, Label::kNear);
153 153
154 InNewSpace(object, value, equal, &done, Label::kNear); 154 InNewSpace(object, value, equal, &done, Label::kNear);
155 155
156 // The offset is relative to a tagged or untagged HeapObject pointer, 156 // The offset is relative to a tagged or untagged HeapObject pointer,
157 // so either offset or offset + kHeapObjectTag must be a 157 // so either offset or offset + kHeapObjectTag must be a
158 // multiple of kPointerSize. 158 // multiple of kPointerSize.
159 ASSERT(IsAligned(offset, kPointerSize) || 159 ASSERT(IsAligned(offset, kPointerSize) ||
160 IsAligned(offset + kHeapObjectTag, kPointerSize)); 160 IsAligned(offset + kHeapObjectTag, kPointerSize));
161 161
162 Register dst = scratch; 162 Register dst = scratch;
163 if (offset != 0) { 163 if (offset != 0) {
164 lea(dst, Operand(object, offset)); 164 lea(dst, Operand(object, offset));
165 } else { 165 } else {
166 // Array access: calculate the destination address in the same manner as 166 // Array access: calculate the destination address in the same manner as
167 // KeyedStoreIC::GenerateGeneric. Multiply a smi by 2 to get an offset 167 // KeyedStoreIC::GenerateGeneric. Multiply a smi by 2 to get an offset
168 // into an array of words. 168 // into an array of words.
169 ASSERT_EQ(1, kSmiTagSize); 169 STATIC_ASSERT(kSmiTagSize == 1);
170 ASSERT_EQ(0, kSmiTag); 170 STATIC_ASSERT(kSmiTag == 0);
171 lea(dst, Operand(object, dst, times_half_pointer_size, 171 lea(dst, Operand(object, dst, times_half_pointer_size,
172 FixedArray::kHeaderSize - kHeapObjectTag)); 172 FixedArray::kHeaderSize - kHeapObjectTag));
173 } 173 }
174 RecordWriteHelper(object, dst, value); 174 RecordWriteHelper(object, dst, value);
175 175
176 bind(&done); 176 bind(&done);
177 177
178 // Clobber all input registers when running with the debug-code flag 178 // Clobber all input registers when running with the debug-code flag
179 // turned on to provoke errors. 179 // turned on to provoke errors.
180 if (emit_debug_code()) { 180 if (emit_debug_code()) {
181 mov(object, Immediate(BitCast<int32_t>(kZapValue))); 181 mov(object, Immediate(BitCast<int32_t>(kZapValue)));
182 mov(value, Immediate(BitCast<int32_t>(kZapValue))); 182 mov(value, Immediate(BitCast<int32_t>(kZapValue)));
183 mov(scratch, Immediate(BitCast<int32_t>(kZapValue))); 183 mov(scratch, Immediate(BitCast<int32_t>(kZapValue)));
184 } 184 }
185 } 185 }
186 186
187 187
188 void MacroAssembler::RecordWrite(Register object, 188 void MacroAssembler::RecordWrite(Register object,
189 Register address, 189 Register address,
190 Register value) { 190 Register value) {
191 // First, check if a write barrier is even needed. The tests below 191 // First, check if a write barrier is even needed. The tests below
192 // catch stores of Smis and stores into young gen. 192 // catch stores of Smis and stores into young gen.
193 Label done; 193 Label done;
194 194
195 // Skip barrier if writing a smi. 195 // Skip barrier if writing a smi.
196 ASSERT_EQ(0, kSmiTag); 196 STATIC_ASSERT(kSmiTag == 0);
197 JumpIfSmi(value, &done, Label::kNear); 197 JumpIfSmi(value, &done, Label::kNear);
198 198
199 InNewSpace(object, value, equal, &done); 199 InNewSpace(object, value, equal, &done);
200 200
201 RecordWriteHelper(object, address, value); 201 RecordWriteHelper(object, address, value);
202 202
203 bind(&done); 203 bind(&done);
204 204
205 // Clobber all input registers when running with the debug-code flag 205 // Clobber all input registers when running with the debug-code flag
206 // turned on to provoke errors. 206 // turned on to provoke errors.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 bind(&fail); 320 bind(&fail);
321 } 321 }
322 322
323 323
324 Condition MacroAssembler::IsObjectStringType(Register heap_object, 324 Condition MacroAssembler::IsObjectStringType(Register heap_object,
325 Register map, 325 Register map,
326 Register instance_type) { 326 Register instance_type) {
327 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); 327 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset));
328 movzx_b(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); 328 movzx_b(instance_type, FieldOperand(map, Map::kInstanceTypeOffset));
329 ASSERT(kNotStringTag != 0); 329 STATIC_ASSERT(kNotStringTag != 0);
330 test(instance_type, Immediate(kIsNotStringMask)); 330 test(instance_type, Immediate(kIsNotStringMask));
331 return zero; 331 return zero;
332 } 332 }
333 333
334 334
335 void MacroAssembler::IsObjectJSObjectType(Register heap_object, 335 void MacroAssembler::IsObjectJSObjectType(Register heap_object,
336 Register map, 336 Register map,
337 Register scratch, 337 Register scratch,
338 Label* fail) { 338 Label* fail) {
339 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); 339 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset));
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 j(not_equal, failure); 2159 j(not_equal, failure);
2160 } 2160 }
2161 2161
2162 2162
2163 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register object1, 2163 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register object1,
2164 Register object2, 2164 Register object2,
2165 Register scratch1, 2165 Register scratch1,
2166 Register scratch2, 2166 Register scratch2,
2167 Label* failure) { 2167 Label* failure) {
2168 // Check that both objects are not smis. 2168 // Check that both objects are not smis.
2169 ASSERT_EQ(0, kSmiTag); 2169 STATIC_ASSERT(kSmiTag == 0);
2170 mov(scratch1, Operand(object1)); 2170 mov(scratch1, Operand(object1));
2171 and_(scratch1, Operand(object2)); 2171 and_(scratch1, Operand(object2));
2172 JumpIfSmi(scratch1, failure); 2172 JumpIfSmi(scratch1, failure);
2173 2173
2174 // Load instance type for both strings. 2174 // Load instance type for both strings.
2175 mov(scratch1, FieldOperand(object1, HeapObject::kMapOffset)); 2175 mov(scratch1, FieldOperand(object1, HeapObject::kMapOffset));
2176 mov(scratch2, FieldOperand(object2, HeapObject::kMapOffset)); 2176 mov(scratch2, FieldOperand(object2, HeapObject::kMapOffset));
2177 movzx_b(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); 2177 movzx_b(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset));
2178 movzx_b(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); 2178 movzx_b(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset));
2179 2179
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 2248
2249 // Check that the code was patched as expected. 2249 // Check that the code was patched as expected.
2250 ASSERT(masm_.pc_ == address_ + size_); 2250 ASSERT(masm_.pc_ == address_ + size_);
2251 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2251 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2252 } 2252 }
2253 2253
2254 2254
2255 } } // namespace v8::internal 2255 } } // namespace v8::internal
2256 2256
2257 #endif // V8_TARGET_ARCH_IA32 2257 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698