| OLD | NEW |
| 1 // Copyright 2006-2008 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 // Now allocate the JSObject on the heap. | 127 // Now allocate the JSObject on the heap. |
| 128 // edi: constructor | 128 // edi: constructor |
| 129 // eax: initial map | 129 // eax: initial map |
| 130 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset)); | 130 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset)); |
| 131 __ shl(edi, kPointerSizeLog2); | 131 __ shl(edi, kPointerSizeLog2); |
| 132 // Make sure that the maximum heap object size will never cause us | 132 // Make sure that the maximum heap object size will never cause us |
| 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() >= JSObject::kMaxInstanceSize); | 135 ASSERT(Heap::MaxObjectSizeInPagedSpace() >= JSObject::kMaxInstanceSize); |
| 136 __ AllocateObjectInNewSpace(edi, ebx, edi, no_reg, &rt_call, false); | 136 __ AllocateObjectInNewSpace(edi, |
| 137 ebx, |
| 138 edi, |
| 139 no_reg, |
| 140 &rt_call, |
| 141 NO_ALLOCATION_FLAGS); |
| 137 // Allocated the JSObject, now initialize the fields. | 142 // Allocated the JSObject, now initialize the fields. |
| 138 // eax: initial map | 143 // eax: initial map |
| 139 // ebx: JSObject | 144 // ebx: JSObject |
| 140 // edi: start of next object | 145 // edi: start of next object |
| 141 __ mov(Operand(ebx, JSObject::kMapOffset), eax); | 146 __ mov(Operand(ebx, JSObject::kMapOffset), eax); |
| 142 __ mov(ecx, Factory::empty_fixed_array()); | 147 __ mov(ecx, Factory::empty_fixed_array()); |
| 143 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx); | 148 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx); |
| 144 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx); | 149 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx); |
| 145 // Set extra fields in the newly allocated object. | 150 // Set extra fields in the newly allocated object. |
| 146 // eax: initial map | 151 // eax: initial map |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // edx: number of elements in properties array | 195 // edx: number of elements in properties array |
| 191 ASSERT(Heap::MaxObjectSizeInPagedSpace() > | 196 ASSERT(Heap::MaxObjectSizeInPagedSpace() > |
| 192 (FixedArray::kHeaderSize + 255*kPointerSize)); | 197 (FixedArray::kHeaderSize + 255*kPointerSize)); |
| 193 __ AllocateObjectInNewSpace(FixedArray::kHeaderSize, | 198 __ AllocateObjectInNewSpace(FixedArray::kHeaderSize, |
| 194 times_pointer_size, | 199 times_pointer_size, |
| 195 edx, | 200 edx, |
| 196 edi, | 201 edi, |
| 197 ecx, | 202 ecx, |
| 198 no_reg, | 203 no_reg, |
| 199 &undo_allocation, | 204 &undo_allocation, |
| 200 true); | 205 RESULT_CONTAINS_TOP); |
| 201 | 206 |
| 202 // Initialize the FixedArray. | 207 // Initialize the FixedArray. |
| 203 // ebx: JSObject | 208 // ebx: JSObject |
| 204 // edi: FixedArray | 209 // edi: FixedArray |
| 205 // edx: number of elements | 210 // edx: number of elements |
| 206 // ecx: start of next object | 211 // ecx: start of next object |
| 207 __ mov(eax, Factory::fixed_array_map()); | 212 __ mov(eax, Factory::fixed_array_map()); |
| 208 __ mov(Operand(edi, JSObject::kMapOffset), eax); // setup the map | 213 __ mov(Operand(edi, JSObject::kMapOffset), eax); // setup the map |
| 209 __ mov(Operand(edi, Array::kLengthOffset), edx); // and length | 214 __ mov(Operand(edi, Array::kLengthOffset), edx); // and length |
| 210 | 215 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 238 | 243 |
| 239 // Undo the setting of the new top so that the heap is verifiable. For | 244 // Undo the setting of the new top so that the heap is verifiable. For |
| 240 // example, the map's unused properties potentially do not match the | 245 // example, the map's unused properties potentially do not match the |
| 241 // allocated objects unused properties. | 246 // allocated objects unused properties. |
| 242 // ebx: JSObject (previous new top) | 247 // ebx: JSObject (previous new top) |
| 243 __ bind(&undo_allocation); | 248 __ bind(&undo_allocation); |
| 244 __ UndoAllocationInNewSpace(ebx); | 249 __ UndoAllocationInNewSpace(ebx); |
| 245 } | 250 } |
| 246 | 251 |
| 247 // Allocate the new receiver object using the runtime call. | 252 // Allocate the new receiver object using the runtime call. |
| 248 // edi: function (constructor) | |
| 249 __ bind(&rt_call); | 253 __ bind(&rt_call); |
| 250 // Must restore edi (constructor) before calling runtime. | 254 // Must restore edi (constructor) before calling runtime. |
| 251 __ mov(edi, Operand(esp, 0)); | 255 __ mov(edi, Operand(esp, 0)); |
| 256 // edi: function (constructor) |
| 252 __ push(edi); | 257 __ push(edi); |
| 253 __ CallRuntime(Runtime::kNewObject, 1); | 258 __ CallRuntime(Runtime::kNewObject, 1); |
| 254 __ mov(ebx, Operand(eax)); // store result in ebx | 259 __ mov(ebx, Operand(eax)); // store result in ebx |
| 255 | 260 |
| 256 // New object allocated. | 261 // New object allocated. |
| 257 // ebx: newly allocated object | 262 // ebx: newly allocated object |
| 258 __ bind(&allocated); | 263 __ bind(&allocated); |
| 259 // Retrieve the function from the stack. | 264 // Retrieve the function from the stack. |
| 260 __ pop(edi); | 265 __ pop(edi); |
| 261 | 266 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 // Dont adapt arguments. | 774 // Dont adapt arguments. |
| 770 // ------------------------------------------- | 775 // ------------------------------------------- |
| 771 __ bind(&dont_adapt_arguments); | 776 __ bind(&dont_adapt_arguments); |
| 772 __ jmp(Operand(edx)); | 777 __ jmp(Operand(edx)); |
| 773 } | 778 } |
| 774 | 779 |
| 775 | 780 |
| 776 #undef __ | 781 #undef __ |
| 777 | 782 |
| 778 } } // namespace v8::internal | 783 } } // namespace v8::internal |
| OLD | NEW |