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

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

Issue 2073018: Reverting r4703. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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/heap-inl.h ('k') | src/ia32/codegen-ia32.h » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 no_reg, 219 no_reg,
220 &undo_allocation, 220 &undo_allocation,
221 RESULT_CONTAINS_TOP); 221 RESULT_CONTAINS_TOP);
222 222
223 // Initialize the FixedArray. 223 // Initialize the FixedArray.
224 // ebx: JSObject 224 // ebx: JSObject
225 // edi: FixedArray 225 // edi: FixedArray
226 // edx: number of elements 226 // edx: number of elements
227 // ecx: start of next object 227 // ecx: start of next object
228 __ mov(eax, Factory::fixed_array_map()); 228 __ mov(eax, Factory::fixed_array_map());
229 __ mov(Operand(edi, FixedArray::kMapOffset), eax); // setup the map 229 __ mov(Operand(edi, JSObject::kMapOffset), eax); // setup the map
230 __ SmiTag(edx); 230 __ mov(Operand(edi, Array::kLengthOffset), edx); // and length
231 __ mov(Operand(edi, FixedArray::kLengthOffset), edx); // and length
232 231
233 // Initialize the fields to undefined. 232 // Initialize the fields to undefined.
234 // ebx: JSObject 233 // ebx: JSObject
235 // edi: FixedArray 234 // edi: FixedArray
236 // ecx: start of next object 235 // ecx: start of next object
237 { Label loop, entry; 236 { Label loop, entry;
238 __ mov(edx, Factory::undefined_value()); 237 __ mov(edx, Factory::undefined_value());
239 __ lea(eax, Operand(edi, FixedArray::kHeaderSize)); 238 __ lea(eax, Operand(edi, FixedArray::kHeaderSize));
240 __ jmp(&entry); 239 __ jmp(&entry);
241 __ bind(&loop); 240 __ bind(&loop);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 RelocInfo::CODE_TARGET); 541 RelocInfo::CODE_TARGET);
543 __ bind(&function); 542 __ bind(&function);
544 } 543 }
545 544
546 // 5b. Get the code to call from the function and check that the number of 545 // 5b. Get the code to call from the function and check that the number of
547 // expected arguments matches what we're providing. If so, jump 546 // expected arguments matches what we're providing. If so, jump
548 // (tail-call) to the code in register edx without checking arguments. 547 // (tail-call) to the code in register edx without checking arguments.
549 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 548 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
550 __ mov(ebx, 549 __ mov(ebx,
551 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); 550 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset));
552 __ SmiUntag(ebx);
553 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); 551 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset));
554 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); 552 __ lea(edx, FieldOperand(edx, Code::kHeaderSize));
555 __ cmp(eax, Operand(ebx)); 553 __ cmp(eax, Operand(ebx));
556 __ j(not_equal, Handle<Code>(builtin(ArgumentsAdaptorTrampoline))); 554 __ j(not_equal, Handle<Code>(builtin(ArgumentsAdaptorTrampoline)));
557 555
558 ParameterCount expected(0); 556 ParameterCount expected(0);
559 __ InvokeCode(Operand(edx), expected, expected, JUMP_FUNCTION); 557 __ InvokeCode(Operand(edx), expected, expected, JUMP_FUNCTION);
560 } 558 }
561 559
562 560
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 return; 745 return;
748 } 746 }
749 747
750 // Calculate the location of the elements array and set elements array member 748 // Calculate the location of the elements array and set elements array member
751 // of the JSArray. 749 // of the JSArray.
752 // result: JSObject 750 // result: JSObject
753 // scratch2: start of next object 751 // scratch2: start of next object
754 __ lea(scratch1, Operand(result, JSArray::kSize)); 752 __ lea(scratch1, Operand(result, JSArray::kSize));
755 __ mov(FieldOperand(result, JSArray::kElementsOffset), scratch1); 753 __ mov(FieldOperand(result, JSArray::kElementsOffset), scratch1);
756 754
757 // Initialize the FixedArray and fill it with holes. FixedArray length is 755 // Initialize the FixedArray and fill it with holes. FixedArray length is not
758 // stored as a smi. 756 // stored as a smi.
759 // result: JSObject 757 // result: JSObject
760 // scratch1: elements array 758 // scratch1: elements array
761 // scratch2: start of next object 759 // scratch2: start of next object
762 __ mov(FieldOperand(scratch1, FixedArray::kMapOffset), 760 __ mov(FieldOperand(scratch1, JSObject::kMapOffset),
763 Factory::fixed_array_map()); 761 Factory::fixed_array_map());
764 __ mov(FieldOperand(scratch1, FixedArray::kLengthOffset), 762 __ mov(FieldOperand(scratch1, Array::kLengthOffset),
765 Immediate(Smi::FromInt(initial_capacity))); 763 Immediate(initial_capacity));
766 764
767 // Fill the FixedArray with the hole value. Inline the code if short. 765 // Fill the FixedArray with the hole value. Inline the code if short.
768 // Reconsider loop unfolding if kPreallocatedArrayElements gets changed. 766 // Reconsider loop unfolding if kPreallocatedArrayElements gets changed.
769 static const int kLoopUnfoldLimit = 4; 767 static const int kLoopUnfoldLimit = 4;
770 ASSERT(kPreallocatedArrayElements <= kLoopUnfoldLimit); 768 ASSERT(kPreallocatedArrayElements <= kLoopUnfoldLimit);
771 if (initial_capacity <= kLoopUnfoldLimit) { 769 if (initial_capacity <= kLoopUnfoldLimit) {
772 // Use a scratch register here to have only one reloc info when unfolding 770 // Use a scratch register here to have only one reloc info when unfolding
773 // the loop. 771 // the loop.
774 __ mov(scratch3, Factory::the_hole_value()); 772 __ mov(scratch3, Factory::the_hole_value());
775 for (int i = 0; i < initial_capacity; i++) { 773 for (int i = 0; i < initial_capacity; i++) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 __ mov(FieldOperand(result, JSArray::kLengthOffset), array_size); 840 __ mov(FieldOperand(result, JSArray::kLengthOffset), array_size);
843 841
844 // Calculate the location of the elements array and set elements array member 842 // Calculate the location of the elements array and set elements array member
845 // of the JSArray. 843 // of the JSArray.
846 // result: JSObject 844 // result: JSObject
847 // elements_array_end: start of next object 845 // elements_array_end: start of next object
848 // array_size: size of array (smi) 846 // array_size: size of array (smi)
849 __ lea(elements_array, Operand(result, JSArray::kSize)); 847 __ lea(elements_array, Operand(result, JSArray::kSize));
850 __ mov(FieldOperand(result, JSArray::kElementsOffset), elements_array); 848 __ mov(FieldOperand(result, JSArray::kElementsOffset), elements_array);
851 849
852 // Initialize the fixed array. FixedArray length is stored as a smi. 850 // Initialize the fixed array. FixedArray length is not stored as a smi.
853 // result: JSObject 851 // result: JSObject
854 // elements_array: elements array 852 // elements_array: elements array
855 // elements_array_end: start of next object 853 // elements_array_end: start of next object
856 // array_size: size of array (smi) 854 // array_size: size of array (smi)
857 __ mov(FieldOperand(elements_array, FixedArray::kMapOffset), 855 ASSERT(kSmiTag == 0);
856 __ SmiUntag(array_size); // Convert from smi to value.
857 __ mov(FieldOperand(elements_array, JSObject::kMapOffset),
858 Factory::fixed_array_map()); 858 Factory::fixed_array_map());
859 // For non-empty JSArrays the length of the FixedArray and the JSArray is the 859 // For non-empty JSArrays the length of the FixedArray and the JSArray is the
860 // same. 860 // same.
861 __ mov(FieldOperand(elements_array, FixedArray::kLengthOffset), array_size); 861 __ mov(FieldOperand(elements_array, Array::kLengthOffset), array_size);
862 862
863 // Fill the allocated FixedArray with the hole value if requested. 863 // Fill the allocated FixedArray with the hole value if requested.
864 // result: JSObject 864 // result: JSObject
865 // elements_array: elements array 865 // elements_array: elements array
866 if (fill_with_hole) { 866 if (fill_with_hole) {
867 __ SmiUntag(array_size);
868 __ lea(edi, Operand(elements_array, 867 __ lea(edi, Operand(elements_array,
869 FixedArray::kHeaderSize - kHeapObjectTag)); 868 FixedArray::kHeaderSize - kHeapObjectTag));
870 __ mov(eax, Factory::the_hole_value()); 869 __ mov(eax, Factory::the_hole_value());
871 __ cld(); 870 __ cld();
872 // Do not use rep stos when filling less than kRepStosThreshold 871 // Do not use rep stos when filling less than kRepStosThreshold
873 // words. 872 // words.
874 const int kRepStosThreshold = 16; 873 const int kRepStosThreshold = 16;
875 Label loop, entry, done; 874 Label loop, entry, done;
876 __ cmp(ecx, kRepStosThreshold); 875 __ cmp(ecx, kRepStosThreshold);
877 __ j(below, &loop); // Note: ecx > 0. 876 __ j(below, &loop); // Note: ecx > 0.
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 __ bind(&dont_adapt_arguments); 1253 __ bind(&dont_adapt_arguments);
1255 __ jmp(Operand(edx)); 1254 __ jmp(Operand(edx));
1256 } 1255 }
1257 1256
1258 1257
1259 #undef __ 1258 #undef __
1260 1259
1261 } } // namespace v8::internal 1260 } } // namespace v8::internal
1262 1261
1263 #endif // V8_TARGET_ARCH_IA32 1262 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698