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

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

Issue 164144: Implement inline constructors for X64. Fix ia32 inline constructors a little... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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 | src/x64/builtins-x64.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // problem here, because it is always greater than the maximum 133 // problem here, because it is always greater than the maximum
134 // instance size that can be represented in a byte. 134 // instance size that can be represented in a byte.
135 ASSERT(Heap::MaxObjectSizeInPagedSpace() >= (1 << kBitsPerByte)); 135 ASSERT(Heap::MaxObjectSizeInPagedSpace() >= (1 << kBitsPerByte));
136 ExternalReference new_space_allocation_top = 136 ExternalReference new_space_allocation_top =
137 ExternalReference::new_space_allocation_top_address(); 137 ExternalReference::new_space_allocation_top_address();
138 __ mov(ebx, Operand::StaticVariable(new_space_allocation_top)); 138 __ mov(ebx, Operand::StaticVariable(new_space_allocation_top));
139 __ add(edi, Operand(ebx)); // Calculate new top 139 __ add(edi, Operand(ebx)); // Calculate new top
140 ExternalReference new_space_allocation_limit = 140 ExternalReference new_space_allocation_limit =
141 ExternalReference::new_space_allocation_limit_address(); 141 ExternalReference::new_space_allocation_limit_address();
142 __ cmp(edi, Operand::StaticVariable(new_space_allocation_limit)); 142 __ cmp(edi, Operand::StaticVariable(new_space_allocation_limit));
143 __ j(greater_equal, &rt_call); 143 __ j(above_equal, &rt_call);
144 // Allocated the JSObject, now initialize the fields. 144 // Allocated the JSObject, now initialize the fields.
145 // eax: initial map 145 // eax: initial map
146 // ebx: JSObject 146 // ebx: JSObject
147 // edi: start of next object 147 // edi: start of next object
148 __ mov(Operand(ebx, JSObject::kMapOffset), eax); 148 __ mov(Operand(ebx, JSObject::kMapOffset), eax);
149 __ mov(ecx, Factory::empty_fixed_array()); 149 __ mov(ecx, Factory::empty_fixed_array());
150 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx); 150 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx);
151 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx); 151 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx);
152 // Set extra fields in the newly allocated object. 152 // Set extra fields in the newly allocated object.
153 // eax: initial map 153 // eax: initial map
(...skipping 14 matching lines...) Expand all
168 // Mostly done with the JSObject. Add the heap tag and store the new top, so 168 // Mostly done with the JSObject. Add the heap tag and store the new top, so
169 // that we can continue and jump into the continuation code at any time from 169 // that we can continue and jump into the continuation code at any time from
170 // now on. Any failures need to undo the setting of the new top, so that the 170 // now on. Any failures need to undo the setting of the new top, so that the
171 // heap is in a consistent state and verifiable. 171 // heap is in a consistent state and verifiable.
172 // eax: initial map 172 // eax: initial map
173 // ebx: JSObject 173 // ebx: JSObject
174 // edi: start of next object 174 // edi: start of next object
175 __ or_(Operand(ebx), Immediate(kHeapObjectTag)); 175 __ or_(Operand(ebx), Immediate(kHeapObjectTag));
176 __ mov(Operand::StaticVariable(new_space_allocation_top), edi); 176 __ mov(Operand::StaticVariable(new_space_allocation_top), edi);
177 177
178 // Check if a properties array should be setup and allocate one if needed. 178 // Check if a non-empty properties array is needed.
179 // Otherwise initialize the properties to the empty_fixed_array as well. 179 // Allocate and initialize a FixedArray if it is.
180 // eax: initial map 180 // eax: initial map
181 // ebx: JSObject 181 // ebx: JSObject
182 // edi: start of next object 182 // edi: start of next object
183 __ movzx_b(edx, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset)); 183 __ movzx_b(edx, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset));
184 __ movzx_b(ecx, FieldOperand(eax, Map::kInObjectPropertiesOffset)); 184 __ movzx_b(ecx, FieldOperand(eax, Map::kInObjectPropertiesOffset));
185 // Calculate unused properties past the end of the in-object properties. 185 // Calculate unused properties past the end of the in-object properties.
186 __ sub(edx, Operand(ecx)); 186 __ sub(edx, Operand(ecx));
187 __ test(edx, Operand(edx));
188 // Done if no extra properties are to be allocated. 187 // Done if no extra properties are to be allocated.
189 __ j(zero, &allocated); 188 __ j(zero, &allocated);
190 189
191 // Scale the number of elements by pointer size and add the header for 190 // Scale the number of elements by pointer size and add the header for
192 // FixedArrays to the start of the next object calculation from above. 191 // FixedArrays to the start of the next object calculation from above.
193 // eax: initial map
194 // ebx: JSObject 192 // ebx: JSObject
195 // edi: start of next object (will be start of FixedArray) 193 // edi: start of next object (will be start of FixedArray)
196 // edx: number of elements in properties array 194 // edx: number of elements in properties array
197 ASSERT(Heap::MaxObjectSizeInPagedSpace() > 195 ASSERT(Heap::MaxObjectSizeInPagedSpace() >
198 (FixedArray::kHeaderSize + 255*kPointerSize)); 196 (FixedArray::kHeaderSize + 255*kPointerSize));
199 __ lea(ecx, Operand(edi, edx, times_4, FixedArray::kHeaderSize)); 197 __ lea(ecx, Operand(edi, edx, times_pointer_size, FixedArray::kHeaderSize));
200 __ cmp(ecx, Operand::StaticVariable(new_space_allocation_limit)); 198 __ cmp(ecx, Operand::StaticVariable(new_space_allocation_limit));
201 __ j(greater_equal, &undo_allocation); 199 __ j(above_equal, &undo_allocation);
202 __ mov(Operand::StaticVariable(new_space_allocation_top), ecx); 200 __ mov(Operand::StaticVariable(new_space_allocation_top), ecx);
203 201
204 // Initialize the FixedArray. 202 // Initialize the FixedArray.
205 // ebx: JSObject 203 // ebx: JSObject
206 // edi: FixedArray 204 // edi: FixedArray
207 // edx: number of elements 205 // edx: number of elements
208 // ecx: start of next object 206 // ecx: start of next object
209 __ mov(eax, Factory::fixed_array_map()); 207 __ mov(eax, Factory::fixed_array_map());
210 __ mov(Operand(edi, JSObject::kMapOffset), eax); // setup the map 208 __ mov(Operand(edi, JSObject::kMapOffset), eax); // setup the map
211 __ mov(Operand(edi, Array::kLengthOffset), edx); // and length 209 __ mov(Operand(edi, Array::kLengthOffset), edx); // and length
212 210
213 // Initialize the fields to undefined. 211 // Initialize the fields to undefined.
214 // ebx: JSObject 212 // ebx: JSObject
215 // edi: FixedArray 213 // edi: FixedArray
216 // ecx: start of next object 214 // ecx: start of next object
217 { Label loop, entry; 215 { Label loop, entry;
218 __ mov(edx, Factory::undefined_value()); 216 __ mov(edx, Factory::undefined_value());
219 __ lea(eax, Operand(edi, FixedArray::kHeaderSize)); 217 __ lea(eax, Operand(edi, FixedArray::kHeaderSize));
220 __ jmp(&entry); 218 __ jmp(&entry);
221 __ bind(&loop); 219 __ bind(&loop);
222 __ mov(Operand(eax, 0), edx); 220 __ mov(Operand(eax, 0), edx);
223 __ add(Operand(eax), Immediate(kPointerSize)); 221 __ add(Operand(eax), Immediate(kPointerSize));
224 __ bind(&entry); 222 __ bind(&entry);
225 __ cmp(eax, Operand(ecx)); 223 __ cmp(eax, Operand(ecx));
226 __ j(less, &loop); 224 __ j(below, &loop);
227 } 225 }
228 226
229 // Store the initialized FixedArray into the properties field of 227 // Store the initialized FixedArray into the properties field of
230 // the JSObject 228 // the JSObject
231 // ebx: JSObject 229 // ebx: JSObject
232 // edi: FixedArray 230 // edi: FixedArray
233 __ or_(Operand(edi), Immediate(kHeapObjectTag)); // add the heap tag 231 __ or_(Operand(edi), Immediate(kHeapObjectTag)); // add the heap tag
234 __ mov(FieldOperand(ebx, JSObject::kPropertiesOffset), edi); 232 __ mov(FieldOperand(ebx, JSObject::kPropertiesOffset), edi);
235 233
236 234
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 // Dont adapt arguments. 769 // Dont adapt arguments.
772 // ------------------------------------------- 770 // -------------------------------------------
773 __ bind(&dont_adapt_arguments); 771 __ bind(&dont_adapt_arguments);
774 __ jmp(Operand(edx)); 772 __ jmp(Operand(edx));
775 } 773 }
776 774
777 775
778 #undef __ 776 #undef __
779 777
780 } } // namespace v8::internal 778 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698