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

Side by Side Diff: src/arm/builtins-arm.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 | « no previous file | src/arm/full-codegen-arm.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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset)); 131 __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset));
132 132
133 // Calculate the location of the elements array and set elements array member 133 // Calculate the location of the elements array and set elements array member
134 // of the JSArray. 134 // of the JSArray.
135 // result: JSObject 135 // result: JSObject
136 // scratch2: start of next object 136 // scratch2: start of next object
137 __ add(scratch1, result, Operand(JSArray::kSize)); 137 __ add(scratch1, result, Operand(JSArray::kSize));
138 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); 138 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset));
139 139
140 // Clear the heap tag on the elements array. 140 // Clear the heap tag on the elements array.
141 ASSERT(kSmiTag == 0); 141 STATIC_ASSERT(kSmiTag == 0);
142 __ sub(scratch1, scratch1, Operand(kHeapObjectTag)); 142 __ sub(scratch1, scratch1, Operand(kHeapObjectTag));
143 143
144 // Initialize the FixedArray and fill it with holes. FixedArray length is 144 // Initialize the FixedArray and fill it with holes. FixedArray length is
145 // stored as a smi. 145 // stored as a smi.
146 // result: JSObject 146 // result: JSObject
147 // scratch1: elements array (untagged) 147 // scratch1: elements array (untagged)
148 // scratch2: start of next object 148 // scratch2: start of next object
149 __ LoadRoot(scratch3, Heap::kFixedArrayMapRootIndex); 149 __ LoadRoot(scratch3, Heap::kFixedArrayMapRootIndex);
150 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset); 150 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset);
151 __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex)); 151 __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 result, 200 result,
201 elements_array_end, 201 elements_array_end,
202 scratch1, 202 scratch1,
203 gc_required, 203 gc_required,
204 TAG_OBJECT); 204 TAG_OBJECT);
205 __ jmp(&allocated); 205 __ jmp(&allocated);
206 206
207 // Allocate the JSArray object together with space for a FixedArray with the 207 // Allocate the JSArray object together with space for a FixedArray with the
208 // requested number of elements. 208 // requested number of elements.
209 __ bind(&not_empty); 209 __ bind(&not_empty);
210 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 210 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
211 __ mov(elements_array_end, 211 __ mov(elements_array_end,
212 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize)); 212 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize));
213 __ add(elements_array_end, 213 __ add(elements_array_end,
214 elements_array_end, 214 elements_array_end,
215 Operand(array_size, ASR, kSmiTagSize)); 215 Operand(array_size, ASR, kSmiTagSize));
216 __ AllocateInNewSpace( 216 __ AllocateInNewSpace(
217 elements_array_end, 217 elements_array_end,
218 result, 218 result,
219 scratch1, 219 scratch1,
220 scratch2, 220 scratch2,
(...skipping 15 matching lines...) Expand all
236 236
237 // Calculate the location of the elements array and set elements array member 237 // Calculate the location of the elements array and set elements array member
238 // of the JSArray. 238 // of the JSArray.
239 // result: JSObject 239 // result: JSObject
240 // array_size: size of array (smi) 240 // array_size: size of array (smi)
241 __ add(elements_array_storage, result, Operand(JSArray::kSize)); 241 __ add(elements_array_storage, result, Operand(JSArray::kSize));
242 __ str(elements_array_storage, 242 __ str(elements_array_storage,
243 FieldMemOperand(result, JSArray::kElementsOffset)); 243 FieldMemOperand(result, JSArray::kElementsOffset));
244 244
245 // Clear the heap tag on the elements array. 245 // Clear the heap tag on the elements array.
246 ASSERT(kSmiTag == 0); 246 STATIC_ASSERT(kSmiTag == 0);
247 __ sub(elements_array_storage, 247 __ sub(elements_array_storage,
248 elements_array_storage, 248 elements_array_storage,
249 Operand(kHeapObjectTag)); 249 Operand(kHeapObjectTag));
250 // Initialize the fixed array and fill it with holes. FixedArray length is 250 // Initialize the fixed array and fill it with holes. FixedArray length is
251 // stored as a smi. 251 // stored as a smi.
252 // result: JSObject 252 // result: JSObject
253 // elements_array_storage: elements array (untagged) 253 // elements_array_storage: elements array (untagged)
254 // array_size: size of array (smi) 254 // array_size: size of array (smi)
255 __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex); 255 __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex);
256 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset); 256 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset);
257 __ str(scratch1, MemOperand(elements_array_storage, kPointerSize, PostIndex)); 257 __ str(scratch1, MemOperand(elements_array_storage, kPointerSize, PostIndex));
258 ASSERT(kSmiTag == 0); 258 STATIC_ASSERT(kSmiTag == 0);
259 __ tst(array_size, array_size); 259 __ tst(array_size, array_size);
260 // Length of the FixedArray is the number of pre-allocated elements if 260 // Length of the FixedArray is the number of pre-allocated elements if
261 // the actual JSArray has length 0 and the size of the JSArray for non-empty 261 // the actual JSArray has length 0 and the size of the JSArray for non-empty
262 // JSArrays. The length of a FixedArray is stored as a smi. 262 // JSArrays. The length of a FixedArray is stored as a smi.
263 __ mov(array_size, 263 __ mov(array_size,
264 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)), 264 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)),
265 LeaveCC, 265 LeaveCC,
266 eq); 266 eq);
267 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset); 267 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
268 __ str(array_size, 268 __ str(array_size,
269 MemOperand(elements_array_storage, kPointerSize, PostIndex)); 269 MemOperand(elements_array_storage, kPointerSize, PostIndex));
270 270
271 // Calculate elements array and elements array end. 271 // Calculate elements array and elements array end.
272 // result: JSObject 272 // result: JSObject
273 // elements_array_storage: elements array element storage 273 // elements_array_storage: elements array element storage
274 // array_size: smi-tagged size of elements array 274 // array_size: smi-tagged size of elements array
275 ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 275 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
276 __ add(elements_array_end, 276 __ add(elements_array_end,
277 elements_array_storage, 277 elements_array_storage,
278 Operand(array_size, LSL, kPointerSizeLog2 - kSmiTagSize)); 278 Operand(array_size, LSL, kPointerSizeLog2 - kSmiTagSize));
279 279
280 // Fill the allocated FixedArray with the hole value if requested. 280 // Fill the allocated FixedArray with the hole value if requested.
281 // result: JSObject 281 // result: JSObject
282 // elements_array_storage: elements array element storage 282 // elements_array_storage: elements array element storage
283 // elements_array_end: start of next object 283 // elements_array_end: start of next object
284 if (fill_with_hole) { 284 if (fill_with_hole) {
285 Label loop, entry; 285 Label loop, entry;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // Setup return value, remove receiver from stack and return. 330 // Setup return value, remove receiver from stack and return.
331 __ mov(r0, r2); 331 __ mov(r0, r2);
332 __ add(sp, sp, Operand(kPointerSize)); 332 __ add(sp, sp, Operand(kPointerSize));
333 __ Jump(lr); 333 __ Jump(lr);
334 334
335 // Check for one argument. Bail out if argument is not smi or if it is 335 // Check for one argument. Bail out if argument is not smi or if it is
336 // negative. 336 // negative.
337 __ bind(&argc_one_or_more); 337 __ bind(&argc_one_or_more);
338 __ cmp(r0, Operand(1)); 338 __ cmp(r0, Operand(1));
339 __ b(ne, &argc_two_or_more); 339 __ b(ne, &argc_two_or_more);
340 ASSERT(kSmiTag == 0); 340 STATIC_ASSERT(kSmiTag == 0);
341 __ ldr(r2, MemOperand(sp)); // Get the argument from the stack. 341 __ ldr(r2, MemOperand(sp)); // Get the argument from the stack.
342 __ and_(r3, r2, Operand(kIntptrSignBit | kSmiTagMask), SetCC); 342 __ and_(r3, r2, Operand(kIntptrSignBit | kSmiTagMask), SetCC);
343 __ b(ne, call_generic_code); 343 __ b(ne, call_generic_code);
344 344
345 // Handle construction of an empty array of a certain size. Bail out if size 345 // Handle construction of an empty array of a certain size. Bail out if size
346 // is too large to actually allocate an elements array. 346 // is too large to actually allocate an elements array.
347 ASSERT(kSmiTag == 0); 347 STATIC_ASSERT(kSmiTag == 0);
348 __ cmp(r2, Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize)); 348 __ cmp(r2, Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize));
349 __ b(ge, call_generic_code); 349 __ b(ge, call_generic_code);
350 350
351 // r0: argc 351 // r0: argc
352 // r1: constructor 352 // r1: constructor
353 // r2: array_size (smi) 353 // r2: array_size (smi)
354 // sp[0]: argument 354 // sp[0]: argument
355 AllocateJSArray(masm, 355 AllocateJSArray(masm,
356 r1, 356 r1,
357 r2, 357 r2,
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 // The argument was not found in the number to string cache. Check 565 // The argument was not found in the number to string cache. Check
566 // if it's a string already before calling the conversion builtin. 566 // if it's a string already before calling the conversion builtin.
567 Label convert_argument; 567 Label convert_argument;
568 __ bind(&not_cached); 568 __ bind(&not_cached);
569 __ JumpIfSmi(r0, &convert_argument); 569 __ JumpIfSmi(r0, &convert_argument);
570 570
571 // Is it a String? 571 // Is it a String?
572 __ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); 572 __ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
573 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceTypeOffset)); 573 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceTypeOffset));
574 ASSERT(kNotStringTag != 0); 574 STATIC_ASSERT(kNotStringTag != 0);
575 __ tst(r3, Operand(kIsNotStringMask)); 575 __ tst(r3, Operand(kIsNotStringMask));
576 __ b(ne, &convert_argument); 576 __ b(ne, &convert_argument);
577 __ mov(argument, r0); 577 __ mov(argument, r0);
578 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); 578 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4);
579 __ b(&argument_is_string); 579 __ b(&argument_is_string);
580 580
581 // Invoke the conversion builtin and put the result into r2. 581 // Invoke the conversion builtin and put the result into r2.
582 __ bind(&convert_argument); 582 __ bind(&convert_argument);
583 __ push(function); // Preserve the function. 583 __ push(function); // Preserve the function.
584 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); 584 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4);
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 __ bind(&dont_adapt_arguments); 1642 __ bind(&dont_adapt_arguments);
1643 __ Jump(r3); 1643 __ Jump(r3);
1644 } 1644 }
1645 1645
1646 1646
1647 #undef __ 1647 #undef __
1648 1648
1649 } } // namespace v8::internal 1649 } } // namespace v8::internal
1650 1650
1651 #endif // V8_TARGET_ARCH_ARM 1651 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698