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

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

Issue 207010: Minor changes to the native array construct code (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 // Initialize the FixedArray and fill it with holes. FixedArray length is not 733 // Initialize the FixedArray and fill it with holes. FixedArray length is not
734 // stored as a smi. 734 // stored as a smi.
735 // result: JSObject 735 // result: JSObject
736 // scratch1: elements array 736 // scratch1: elements array
737 // scratch2: start of next object 737 // scratch2: start of next object
738 __ mov(FieldOperand(scratch1, JSObject::kMapOffset), 738 __ mov(FieldOperand(scratch1, JSObject::kMapOffset),
739 Factory::fixed_array_map()); 739 Factory::fixed_array_map());
740 __ mov(FieldOperand(scratch1, Array::kLengthOffset), Immediate(holes)); 740 __ mov(FieldOperand(scratch1, Array::kLengthOffset), Immediate(holes));
741 741
742 // Fill the FixedArray with the hole value. Inline the code if short. 742 // Fill the FixedArray with the hole value. Inline the code if short.
743 if (holes <= 4) { 743 // Reconsider loop unfolding if kPreallocatedArrayElements gets changed.
744 static const int kLoopUnfoldLimit = 4
745 ASSERT(kPreallocatedArrayElements <= kLoopUnfoldLimit);
746 if (holes <= kLoopUnfoldLimit) {
744 // Use a scratch register here to have only one reloc info when unfolding 747 // Use a scratch register here to have only one reloc info when unfolding
745 // the loop. 748 // the loop.
746 __ mov(scratch3, Factory::the_hole_value()); 749 __ mov(scratch3, Factory::the_hole_value());
747 for (int i = 0; i < holes; i++) { 750 for (int i = 0; i < holes; i++) {
748 __ mov(FieldOperand(scratch1, 751 __ mov(FieldOperand(scratch1,
749 FixedArray::kHeaderSize + i * kPointerSize), 752 FixedArray::kHeaderSize + i * kPointerSize),
750 scratch3); 753 scratch3);
751 } 754 }
752 } else { 755 } else {
753 Label loop, entry; 756 Label loop, entry;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 if (FLAG_debug_code) { 1064 if (FLAG_debug_code) {
1062 // Initial map for the builtin Array function shoud be a map. 1065 // Initial map for the builtin Array function shoud be a map.
1063 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); 1066 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
1064 // Will both indicate a NULL and a Smi. 1067 // Will both indicate a NULL and a Smi.
1065 __ test(ebx, Immediate(kSmiTagMask)); 1068 __ test(ebx, Immediate(kSmiTagMask));
1066 __ Assert(not_zero, "Unexpected initial map for Array function"); 1069 __ Assert(not_zero, "Unexpected initial map for Array function");
1067 __ CmpObjectType(ebx, MAP_TYPE, ecx); 1070 __ CmpObjectType(ebx, MAP_TYPE, ecx);
1068 __ Assert(equal, "Unexpected initial map for Array function"); 1071 __ Assert(equal, "Unexpected initial map for Array function");
1069 } 1072 }
1070 1073
1071 // Run the native code for the Array function called as constructor. 1074 // Run the native code for the Array function called as a normal function.
1072 ArrayNativeCode(masm, false, &generic_array_code); 1075 ArrayNativeCode(masm, false, &generic_array_code);
1073 1076
1074 // Jump to the generic array code in case the specialized code cannot handle 1077 // Jump to the generic array code in case the specialized code cannot handle
1075 // the construction. 1078 // the construction.
1076 __ bind(&generic_array_code); 1079 __ bind(&generic_array_code);
1077 Code* code = Builtins::builtin(Builtins::ArrayCodeGeneric); 1080 Code* code = Builtins::builtin(Builtins::ArrayCodeGeneric);
1078 Handle<Code> array_code(code); 1081 Handle<Code> array_code(code);
1079 __ jmp(array_code, RelocInfo::CODE_TARGET); 1082 __ jmp(array_code, RelocInfo::CODE_TARGET);
1080 } 1083 }
1081 1084
(...skipping 21 matching lines...) Expand all
1103 __ CmpObjectType(ebx, MAP_TYPE, ecx); 1106 __ CmpObjectType(ebx, MAP_TYPE, ecx);
1104 __ Assert(equal, "Unexpected initial map for Array function"); 1107 __ Assert(equal, "Unexpected initial map for Array function");
1105 } 1108 }
1106 1109
1107 // Run the native code for the Array function called as constructor. 1110 // Run the native code for the Array function called as constructor.
1108 ArrayNativeCode(masm, false, &generic_constructor); 1111 ArrayNativeCode(masm, false, &generic_constructor);
1109 1112
1110 // Jump to the generic construct code in case the specialized code cannot 1113 // Jump to the generic construct code in case the specialized code cannot
1111 // handle the construction. 1114 // handle the construction.
1112 __ bind(&generic_constructor); 1115 __ bind(&generic_constructor);
1113 GenerateLoadArrayFunction(masm, edi);
1114 Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric); 1116 Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric);
1115 Handle<Code> generic_construct_stub(code); 1117 Handle<Code> generic_construct_stub(code);
1116 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); 1118 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);
1117 } 1119 }
1118 1120
1119 1121
1120 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { 1122 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1121 __ push(ebp); 1123 __ push(ebp);
1122 __ mov(ebp, Operand(esp)); 1124 __ mov(ebp, Operand(esp));
1123 1125
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 // Dont adapt arguments. 1229 // Dont adapt arguments.
1228 // ------------------------------------------- 1230 // -------------------------------------------
1229 __ bind(&dont_adapt_arguments); 1231 __ bind(&dont_adapt_arguments);
1230 __ jmp(Operand(edx)); 1232 __ jmp(Operand(edx));
1231 } 1233 }
1232 1234
1233 1235
1234 #undef __ 1236 #undef __
1235 1237
1236 } } // namespace v8::internal 1238 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698