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

Side by Side Diff: src/mips/builtins-mips.cc

Issue 7740073: MIPS: Convert a bunch of ASSERTs to STATIC_ASSERTs (Closed)
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
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 result, 203 result,
204 elements_array_end, 204 elements_array_end,
205 scratch1, 205 scratch1,
206 gc_required, 206 gc_required,
207 TAG_OBJECT); 207 TAG_OBJECT);
208 __ Branch(&allocated); 208 __ Branch(&allocated);
209 209
210 // Allocate the JSArray object together with space for a FixedArray with the 210 // Allocate the JSArray object together with space for a FixedArray with the
211 // requested number of elements. 211 // requested number of elements.
212 __ bind(&not_empty); 212 __ bind(&not_empty);
213 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 213 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
214 __ li(elements_array_end, 214 __ li(elements_array_end,
215 (JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize); 215 (JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize);
216 __ sra(scratch1, array_size, kSmiTagSize); 216 __ sra(scratch1, array_size, kSmiTagSize);
217 __ Addu(elements_array_end, elements_array_end, scratch1); 217 __ Addu(elements_array_end, elements_array_end, scratch1);
218 __ AllocateInNewSpace( 218 __ AllocateInNewSpace(
219 elements_array_end, 219 elements_array_end,
220 result, 220 result,
221 scratch1, 221 scratch1,
222 scratch2, 222 scratch2,
223 gc_required, 223 gc_required,
(...skipping 30 matching lines...) Expand all
254 // elements_array_storage: elements array (untagged) 254 // elements_array_storage: elements array (untagged)
255 // array_size: size of array (smi) 255 // array_size: size of array (smi)
256 __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex); 256 __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex);
257 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset); 257 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset);
258 __ sw(scratch1, MemOperand(elements_array_storage)); 258 __ sw(scratch1, MemOperand(elements_array_storage));
259 __ Addu(elements_array_storage, elements_array_storage, kPointerSize); 259 __ Addu(elements_array_storage, elements_array_storage, kPointerSize);
260 260
261 // Length of the FixedArray is the number of pre-allocated elements if 261 // Length of the FixedArray is the number of pre-allocated elements if
262 // the actual JSArray has length 0 and the size of the JSArray for non-empty 262 // the actual JSArray has length 0 and the size of the JSArray for non-empty
263 // JSArrays. The length of a FixedArray is stored as a smi. 263 // JSArrays. The length of a FixedArray is stored as a smi.
264 ASSERT(kSmiTag == 0); 264 STATIC_ASSERT(kSmiTag == 0);
265 __ li(at, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); 265 __ li(at, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
266 __ movz(array_size, at, array_size); 266 __ movz(array_size, at, array_size);
267 267
268 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset); 268 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
269 __ sw(array_size, MemOperand(elements_array_storage)); 269 __ sw(array_size, MemOperand(elements_array_storage));
270 __ Addu(elements_array_storage, elements_array_storage, kPointerSize); 270 __ Addu(elements_array_storage, elements_array_storage, kPointerSize);
271 271
272 // Calculate elements array and elements array end. 272 // Calculate elements array and elements array end.
273 // result: JSObject 273 // result: JSObject
274 // elements_array_storage: elements array element storage 274 // elements_array_storage: elements array element storage
275 // array_size: smi-tagged size of elements array 275 // array_size: smi-tagged size of elements array
276 ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 276 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
277 __ sll(elements_array_end, array_size, kPointerSizeLog2 - kSmiTagSize); 277 __ sll(elements_array_end, array_size, kPointerSizeLog2 - kSmiTagSize);
278 __ Addu(elements_array_end, elements_array_storage, elements_array_end); 278 __ Addu(elements_array_end, elements_array_storage, elements_array_end);
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;
286 __ LoadRoot(scratch1, Heap::kTheHoleValueRootIndex); 286 __ LoadRoot(scratch1, Heap::kTheHoleValueRootIndex);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Setup return value, remove receiver from stack and return. 329 // Setup return value, remove receiver from stack and return.
330 __ mov(v0, a2); 330 __ mov(v0, a2);
331 __ Addu(sp, sp, Operand(kPointerSize)); 331 __ Addu(sp, sp, Operand(kPointerSize));
332 __ Ret(); 332 __ Ret();
333 333
334 // Check for one argument. Bail out if argument is not smi or if it is 334 // Check for one argument. Bail out if argument is not smi or if it is
335 // negative. 335 // negative.
336 __ bind(&argc_one_or_more); 336 __ bind(&argc_one_or_more);
337 __ Branch(&argc_two_or_more, ne, a0, Operand(1)); 337 __ Branch(&argc_two_or_more, ne, a0, Operand(1));
338 338
339 ASSERT(kSmiTag == 0); 339 STATIC_ASSERT(kSmiTag == 0);
340 __ lw(a2, MemOperand(sp)); // Get the argument from the stack. 340 __ lw(a2, MemOperand(sp)); // Get the argument from the stack.
341 __ And(a3, a2, Operand(kIntptrSignBit | kSmiTagMask)); 341 __ And(a3, a2, Operand(kIntptrSignBit | kSmiTagMask));
342 __ Branch(call_generic_code, eq, a3, Operand(zero_reg)); 342 __ Branch(call_generic_code, eq, a3, Operand(zero_reg));
343 343
344 // Handle construction of an empty array of a certain size. Bail out if size 344 // Handle construction of an empty array of a certain size. Bail out if size
345 // is too large to actually allocate an elements array. 345 // is too large to actually allocate an elements array.
346 ASSERT(kSmiTag == 0); 346 STATIC_ASSERT(kSmiTag == 0);
347 __ Branch(call_generic_code, Ugreater_equal, a2, 347 __ Branch(call_generic_code, Ugreater_equal, a2,
348 Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize)); 348 Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize));
349 349
350 // a0: argc 350 // a0: argc
351 // a1: constructor 351 // a1: constructor
352 // a2: array_size (smi) 352 // a2: array_size (smi)
353 // sp[0]: argument 353 // sp[0]: argument
354 AllocateJSArray(masm, 354 AllocateJSArray(masm,
355 a1, 355 a1,
356 a2, 356 a2,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 569
570 // The argument was not found in the number to string cache. Check 570 // The argument was not found in the number to string cache. Check
571 // if it's a string already before calling the conversion builtin. 571 // if it's a string already before calling the conversion builtin.
572 Label convert_argument; 572 Label convert_argument;
573 __ bind(&not_cached); 573 __ bind(&not_cached);
574 __ JumpIfSmi(a0, &convert_argument); 574 __ JumpIfSmi(a0, &convert_argument);
575 575
576 // Is it a String? 576 // Is it a String?
577 __ lw(a2, FieldMemOperand(a0, HeapObject::kMapOffset)); 577 __ lw(a2, FieldMemOperand(a0, HeapObject::kMapOffset));
578 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceTypeOffset)); 578 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceTypeOffset));
579 ASSERT(kNotStringTag != 0); 579 STATIC_ASSERT(kNotStringTag != 0);
580 __ And(t0, a3, Operand(kIsNotStringMask)); 580 __ And(t0, a3, Operand(kIsNotStringMask));
581 __ Branch(&convert_argument, ne, t0, Operand(zero_reg)); 581 __ Branch(&convert_argument, ne, t0, Operand(zero_reg));
582 __ mov(argument, a0); 582 __ mov(argument, a0);
583 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, t0); 583 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, t0);
584 __ Branch(&argument_is_string); 584 __ Branch(&argument_is_string);
585 585
586 // Invoke the conversion builtin and put the result into a2. 586 // Invoke the conversion builtin and put the result into a2.
587 __ bind(&convert_argument); 587 __ bind(&convert_argument);
588 __ push(function); // Preserve the function. 588 __ push(function); // Preserve the function.
589 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, t0); 589 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, t0);
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 __ bind(&dont_adapt_arguments); 1618 __ bind(&dont_adapt_arguments);
1619 __ Jump(a3); 1619 __ Jump(a3);
1620 } 1620 }
1621 1621
1622 1622
1623 #undef __ 1623 #undef __
1624 1624
1625 } } // namespace v8::internal 1625 } } // namespace v8::internal
1626 1626
1627 #endif // V8_TARGET_ARCH_MIPS 1627 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698