| OLD | NEW |
| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 non-empty properties array is needed. | 178 // Check if a non-empty properties array is needed. |
| 179 // Allocate and initialize a FixedArray if it is. | 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 // Calculate the total number of properties described by the map. |
| 183 __ movzx_b(edx, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset)); | 184 __ movzx_b(edx, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset)); |
| 185 __ movzx_b(ecx, FieldOperand(eax, Map::kPreAllocatedPropertyFieldsOffset)); |
| 186 __ add(edx, Operand(ecx)); |
| 187 // Calculate unused properties past the end of the in-object properties. |
| 184 __ movzx_b(ecx, FieldOperand(eax, Map::kInObjectPropertiesOffset)); | 188 __ movzx_b(ecx, FieldOperand(eax, Map::kInObjectPropertiesOffset)); |
| 185 // Calculate unused properties past the end of the in-object properties. | |
| 186 __ sub(edx, Operand(ecx)); | 189 __ sub(edx, Operand(ecx)); |
| 187 // Done if no extra properties are to be allocated. | 190 // Done if no extra properties are to be allocated. |
| 188 __ j(zero, &allocated); | 191 __ j(zero, &allocated); |
| 192 __ Assert (positive, "Property allocation count failed."); |
| 189 | 193 |
| 190 // Scale the number of elements by pointer size and add the header for | 194 // Scale the number of elements by pointer size and add the header for |
| 191 // FixedArrays to the start of the next object calculation from above. | 195 // FixedArrays to the start of the next object calculation from above. |
| 192 // ebx: JSObject | 196 // ebx: JSObject |
| 193 // edi: start of next object (will be start of FixedArray) | 197 // edi: start of next object (will be start of FixedArray) |
| 194 // edx: number of elements in properties array | 198 // edx: number of elements in properties array |
| 195 ASSERT(Heap::MaxObjectSizeInPagedSpace() > | 199 ASSERT(Heap::MaxObjectSizeInPagedSpace() > |
| 196 (FixedArray::kHeaderSize + 255*kPointerSize)); | 200 (FixedArray::kHeaderSize + 255*kPointerSize)); |
| 197 __ lea(ecx, Operand(edi, edx, times_pointer_size, FixedArray::kHeaderSize)); | 201 __ lea(ecx, Operand(edi, edx, times_pointer_size, FixedArray::kHeaderSize)); |
| 198 __ cmp(ecx, Operand::StaticVariable(new_space_allocation_limit)); | 202 __ cmp(ecx, Operand::StaticVariable(new_space_allocation_limit)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // Restore the arguments count and leave the construct frame. | 318 // Restore the arguments count and leave the construct frame. |
| 315 __ bind(&exit); | 319 __ bind(&exit); |
| 316 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count | 320 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count |
| 317 __ LeaveConstructFrame(); | 321 __ LeaveConstructFrame(); |
| 318 | 322 |
| 319 // Remove caller arguments from the stack and return. | 323 // Remove caller arguments from the stack and return. |
| 320 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 324 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 321 __ pop(ecx); | 325 __ pop(ecx); |
| 322 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver | 326 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver |
| 323 __ push(ecx); | 327 __ push(ecx); |
| 328 __ IncrementCounter(&Counters::constructed_objects, 1); |
| 324 __ ret(0); | 329 __ ret(0); |
| 325 } | 330 } |
| 326 | 331 |
| 327 | 332 |
| 328 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 333 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 329 bool is_construct) { | 334 bool is_construct) { |
| 330 // Clear the context before we push it when entering the JS frame. | 335 // Clear the context before we push it when entering the JS frame. |
| 331 __ xor_(esi, Operand(esi)); // clear esi | 336 __ xor_(esi, Operand(esi)); // clear esi |
| 332 | 337 |
| 333 // Enter an internal frame. | 338 // Enter an internal frame. |
| (...skipping 435 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 |