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

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

Issue 10209027: Implement tracking and optimizations of packed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: New upload 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
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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 static void AllocateEmptyJSArray(MacroAssembler* masm, 892 static void AllocateEmptyJSArray(MacroAssembler* masm,
893 Register array_function, 893 Register array_function,
894 Register result, 894 Register result,
895 Register scratch1, 895 Register scratch1,
896 Register scratch2, 896 Register scratch2,
897 Register scratch3, 897 Register scratch3,
898 Label* gc_required) { 898 Label* gc_required) {
899 const int initial_capacity = JSArray::kPreallocatedArrayElements; 899 const int initial_capacity = JSArray::kPreallocatedArrayElements;
900 STATIC_ASSERT(initial_capacity >= 0); 900 STATIC_ASSERT(initial_capacity >= 0);
901 901
902 __ LoadInitialArrayMap(array_function, scratch2, scratch1); 902 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false);
903 903
904 // Allocate the JSArray object together with space for a fixed array with the 904 // Allocate the JSArray object together with space for a fixed array with the
905 // requested elements. 905 // requested elements.
906 int size = JSArray::kSize; 906 int size = JSArray::kSize;
907 if (initial_capacity > 0) { 907 if (initial_capacity > 0) {
908 size += FixedArray::SizeFor(initial_capacity); 908 size += FixedArray::SizeFor(initial_capacity);
909 } 909 }
910 __ AllocateInNewSpace(size, 910 __ AllocateInNewSpace(size,
911 result, 911 result,
912 scratch2, 912 scratch2,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 Register result, 995 Register result,
996 Register elements_array, 996 Register elements_array,
997 Register elements_array_end, 997 Register elements_array_end,
998 Register scratch, 998 Register scratch,
999 bool fill_with_hole, 999 bool fill_with_hole,
1000 Label* gc_required) { 1000 Label* gc_required) {
1001 ASSERT(scratch.is(edi)); // rep stos destination 1001 ASSERT(scratch.is(edi)); // rep stos destination
1002 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count 1002 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count
1003 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax 1003 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax
1004 1004
1005 __ LoadInitialArrayMap(array_function, scratch, elements_array); 1005 __ LoadInitialArrayMap(array_function, scratch,
1006 elements_array, fill_with_hole);
1006 1007
1007 // Allocate the JSArray object together with space for a FixedArray with the 1008 // Allocate the JSArray object together with space for a FixedArray with the
1008 // requested elements. 1009 // requested elements.
1009 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 1010 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
1010 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, 1011 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize,
1011 times_half_pointer_size, // array_size is a smi. 1012 times_half_pointer_size, // array_size is a smi.
1012 array_size, 1013 array_size,
1013 result, 1014 result,
1014 elements_array_end, 1015 elements_array_end,
1015 scratch, 1016 scratch,
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 masm->isolate()->factory()->heap_number_map(), 1267 masm->isolate()->factory()->heap_number_map(),
1267 &not_double, 1268 &not_double,
1268 DONT_DO_SMI_CHECK); 1269 DONT_DO_SMI_CHECK);
1269 __ bind(&cant_transition_map); 1270 __ bind(&cant_transition_map);
1270 // Throw away the array that's only been partially constructed. 1271 // Throw away the array that's only been partially constructed.
1271 __ pop(eax); 1272 __ pop(eax);
1272 __ UndoAllocationInNewSpace(eax); 1273 __ UndoAllocationInNewSpace(eax);
1273 __ jmp(&prepare_generic_code_call); 1274 __ jmp(&prepare_generic_code_call);
1274 1275
1275 __ bind(&not_double); 1276 __ bind(&not_double);
1276 // Transition FAST_SMI_ONLY_ELEMENTS to FAST_ELEMENTS. 1277 // Transition Smi-only to Object elements.
1277 __ mov(ebx, Operand(esp, 0)); 1278 __ mov(ebx, Operand(esp, 0));
1278 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset)); 1279 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset));
1280
1279 __ LoadTransitionedArrayMapConditional( 1281 __ LoadTransitionedArrayMapConditional(
1280 FAST_SMI_ONLY_ELEMENTS, 1282 FAST_SMI_ELEMENTS,
1281 FAST_ELEMENTS, 1283 FAST_ELEMENTS,
1282 edi, 1284 edi,
1283 eax, 1285 eax,
1284 &cant_transition_map); 1286 &cant_transition_map);
1285 __ mov(FieldOperand(ebx, HeapObject::kMapOffset), edi); 1287 __ mov(FieldOperand(ebx, HeapObject::kMapOffset), edi);
1286 __ RecordWriteField(ebx, HeapObject::kMapOffset, edi, eax, 1288 __ RecordWriteField(ebx, HeapObject::kMapOffset, edi, eax,
1287 kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 1289 kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1288 1290
1289 // Prepare to re-enter the loop 1291 // Prepare to re-enter the loop
1290 __ lea(edi, Operand(esp, last_arg_offset)); 1292 __ lea(edi, Operand(esp, last_arg_offset));
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1730 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1729 generator.Generate(); 1731 generator.Generate();
1730 } 1732 }
1731 1733
1732 1734
1733 #undef __ 1735 #undef __
1734 } 1736 }
1735 } // namespace v8::internal 1737 } // namespace v8::internal
1736 1738
1737 #endif // V8_TARGET_ARCH_IA32 1739 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698