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

Side by Side Diff: src/arm/builtins-arm.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/api.cc ('k') | src/arm/code-stubs-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 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // and filled with the hole values. 107 // and filled with the hole values.
108 static void AllocateEmptyJSArray(MacroAssembler* masm, 108 static void AllocateEmptyJSArray(MacroAssembler* masm,
109 Register array_function, 109 Register array_function,
110 Register result, 110 Register result,
111 Register scratch1, 111 Register scratch1,
112 Register scratch2, 112 Register scratch2,
113 Register scratch3, 113 Register scratch3,
114 Label* gc_required) { 114 Label* gc_required) {
115 const int initial_capacity = JSArray::kPreallocatedArrayElements; 115 const int initial_capacity = JSArray::kPreallocatedArrayElements;
116 STATIC_ASSERT(initial_capacity >= 0); 116 STATIC_ASSERT(initial_capacity >= 0);
117 __ LoadInitialArrayMap(array_function, scratch2, scratch1); 117 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false);
118 118
119 // Allocate the JSArray object together with space for a fixed array with the 119 // Allocate the JSArray object together with space for a fixed array with the
120 // requested elements. 120 // requested elements.
121 int size = JSArray::kSize; 121 int size = JSArray::kSize;
122 if (initial_capacity > 0) { 122 if (initial_capacity > 0) {
123 size += FixedArray::SizeFor(initial_capacity); 123 size += FixedArray::SizeFor(initial_capacity);
124 } 124 }
125 __ AllocateInNewSpace(size, 125 __ AllocateInNewSpace(size,
126 result, 126 result,
127 scratch2, 127 scratch2,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 Register array_function, // Array function. 201 Register array_function, // Array function.
202 Register array_size, // As a smi, cannot be 0. 202 Register array_size, // As a smi, cannot be 0.
203 Register result, 203 Register result,
204 Register elements_array_storage, 204 Register elements_array_storage,
205 Register elements_array_end, 205 Register elements_array_end,
206 Register scratch1, 206 Register scratch1,
207 Register scratch2, 207 Register scratch2,
208 bool fill_with_hole, 208 bool fill_with_hole,
209 Label* gc_required) { 209 Label* gc_required) {
210 // Load the initial map from the array function. 210 // Load the initial map from the array function.
211 __ LoadInitialArrayMap(array_function, scratch2, elements_array_storage); 211 __ LoadInitialArrayMap(array_function, scratch2,
212 elements_array_storage, fill_with_hole);
212 213
213 if (FLAG_debug_code) { // Assert that array size is not zero. 214 if (FLAG_debug_code) { // Assert that array size is not zero.
214 __ tst(array_size, array_size); 215 __ tst(array_size, array_size);
215 __ Assert(ne, "array size is unexpectedly 0"); 216 __ Assert(ne, "array size is unexpectedly 0");
216 } 217 }
217 218
218 // Allocate the JSArray object together with space for a FixedArray with the 219 // Allocate the JSArray object together with space for a FixedArray with the
219 // requested number of elements. 220 // requested number of elements.
220 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 221 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
221 __ mov(elements_array_end, 222 __ mov(elements_array_end,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 434
434 __ bind(&has_non_smi_element); 435 __ bind(&has_non_smi_element);
435 // Double values are handled by the runtime. 436 // Double values are handled by the runtime.
436 __ CheckMap( 437 __ CheckMap(
437 r2, r9, Heap::kHeapNumberMapRootIndex, &not_double, DONT_DO_SMI_CHECK); 438 r2, r9, Heap::kHeapNumberMapRootIndex, &not_double, DONT_DO_SMI_CHECK);
438 __ bind(&cant_transition_map); 439 __ bind(&cant_transition_map);
439 __ UndoAllocationInNewSpace(r3, r4); 440 __ UndoAllocationInNewSpace(r3, r4);
440 __ b(call_generic_code); 441 __ b(call_generic_code);
441 442
442 __ bind(&not_double); 443 __ bind(&not_double);
443 // Transition FAST_SMI_ONLY_ELEMENTS to FAST_ELEMENTS. 444 // Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS.
444 // r3: JSArray 445 // r3: JSArray
445 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); 446 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset));
446 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, 447 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
447 FAST_ELEMENTS, 448 FAST_ELEMENTS,
448 r2, 449 r2,
449 r9, 450 r9,
450 &cant_transition_map); 451 &cant_transition_map);
451 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); 452 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset));
452 __ RecordWriteField(r3, 453 __ RecordWriteField(r3,
453 HeapObject::kMapOffset, 454 HeapObject::kMapOffset,
454 r2, 455 r2,
455 r9, 456 r9,
456 kLRHasNotBeenSaved, 457 kLRHasNotBeenSaved,
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 __ bind(&dont_adapt_arguments); 1760 __ bind(&dont_adapt_arguments);
1760 __ Jump(r3); 1761 __ Jump(r3);
1761 } 1762 }
1762 1763
1763 1764
1764 #undef __ 1765 #undef __
1765 1766
1766 } } // namespace v8::internal 1767 } } // namespace v8::internal
1767 1768
1768 #endif // V8_TARGET_ARCH_ARM 1769 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698