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

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

Issue 10170030: Implement tracking and optimizations of packed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 7 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/lithium.cc ('k') | src/mips/code-stubs-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // and filled with the hole values. 111 // and filled with the hole values.
112 static void AllocateEmptyJSArray(MacroAssembler* masm, 112 static void AllocateEmptyJSArray(MacroAssembler* masm,
113 Register array_function, 113 Register array_function,
114 Register result, 114 Register result,
115 Register scratch1, 115 Register scratch1,
116 Register scratch2, 116 Register scratch2,
117 Register scratch3, 117 Register scratch3,
118 Label* gc_required) { 118 Label* gc_required) {
119 const int initial_capacity = JSArray::kPreallocatedArrayElements; 119 const int initial_capacity = JSArray::kPreallocatedArrayElements;
120 STATIC_ASSERT(initial_capacity >= 0); 120 STATIC_ASSERT(initial_capacity >= 0);
121 __ LoadInitialArrayMap(array_function, scratch2, scratch1); 121 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false);
122 122
123 // Allocate the JSArray object together with space for a fixed array with the 123 // Allocate the JSArray object together with space for a fixed array with the
124 // requested elements. 124 // requested elements.
125 int size = JSArray::kSize; 125 int size = JSArray::kSize;
126 if (initial_capacity > 0) { 126 if (initial_capacity > 0) {
127 size += FixedArray::SizeFor(initial_capacity); 127 size += FixedArray::SizeFor(initial_capacity);
128 } 128 }
129 __ AllocateInNewSpace(size, 129 __ AllocateInNewSpace(size,
130 result, 130 result,
131 scratch2, 131 scratch2,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 Register array_function, // Array function. 207 Register array_function, // Array function.
208 Register array_size, // As a smi, cannot be 0. 208 Register array_size, // As a smi, cannot be 0.
209 Register result, 209 Register result,
210 Register elements_array_storage, 210 Register elements_array_storage,
211 Register elements_array_end, 211 Register elements_array_end,
212 Register scratch1, 212 Register scratch1,
213 Register scratch2, 213 Register scratch2,
214 bool fill_with_hole, 214 bool fill_with_hole,
215 Label* gc_required) { 215 Label* gc_required) {
216 // Load the initial map from the array function. 216 // Load the initial map from the array function.
217 __ LoadInitialArrayMap(array_function, scratch2, elements_array_storage); 217 __ LoadInitialArrayMap(array_function, scratch2,
218 elements_array_storage, fill_with_hole);
218 219
219 if (FLAG_debug_code) { // Assert that array size is not zero. 220 if (FLAG_debug_code) { // Assert that array size is not zero.
220 __ Assert( 221 __ Assert(
221 ne, "array size is unexpectedly 0", array_size, Operand(zero_reg)); 222 ne, "array size is unexpectedly 0", array_size, Operand(zero_reg));
222 } 223 }
223 224
224 // Allocate the JSArray object together with space for a FixedArray with the 225 // Allocate the JSArray object together with space for a FixedArray with the
225 // requested number of elements. 226 // requested number of elements.
226 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 227 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
227 __ li(elements_array_end, 228 __ li(elements_array_end,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 443
443 __ bind(&has_non_smi_element); 444 __ bind(&has_non_smi_element);
444 // Double values are handled by the runtime. 445 // Double values are handled by the runtime.
445 __ CheckMap( 446 __ CheckMap(
446 a2, t5, Heap::kHeapNumberMapRootIndex, &not_double, DONT_DO_SMI_CHECK); 447 a2, t5, Heap::kHeapNumberMapRootIndex, &not_double, DONT_DO_SMI_CHECK);
447 __ bind(&cant_transition_map); 448 __ bind(&cant_transition_map);
448 __ UndoAllocationInNewSpace(a3, t0); 449 __ UndoAllocationInNewSpace(a3, t0);
449 __ Branch(call_generic_code); 450 __ Branch(call_generic_code);
450 451
451 __ bind(&not_double); 452 __ bind(&not_double);
452 // Transition FAST_SMI_ONLY_ELEMENTS to FAST_ELEMENTS. 453 // Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS.
453 // a3: JSArray 454 // a3: JSArray
454 __ lw(a2, FieldMemOperand(a3, HeapObject::kMapOffset)); 455 __ lw(a2, FieldMemOperand(a3, HeapObject::kMapOffset));
455 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, 456 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
456 FAST_ELEMENTS, 457 FAST_ELEMENTS,
457 a2, 458 a2,
458 t5, 459 t5,
459 &cant_transition_map); 460 &cant_transition_map);
460 __ sw(a2, FieldMemOperand(a3, HeapObject::kMapOffset)); 461 __ sw(a2, FieldMemOperand(a3, HeapObject::kMapOffset));
461 __ RecordWriteField(a3, 462 __ RecordWriteField(a3,
462 HeapObject::kMapOffset, 463 HeapObject::kMapOffset,
463 a2, 464 a2,
464 t5, 465 t5,
465 kRAHasNotBeenSaved, 466 kRAHasNotBeenSaved,
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 __ bind(&dont_adapt_arguments); 1797 __ bind(&dont_adapt_arguments);
1797 __ Jump(a3); 1798 __ Jump(a3);
1798 } 1799 }
1799 1800
1800 1801
1801 #undef __ 1802 #undef __
1802 1803
1803 } } // namespace v8::internal 1804 } } // namespace v8::internal
1804 1805
1805 #endif // V8_TARGET_ARCH_MIPS 1806 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/lithium.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698