| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 // rdi: start of next object | 578 // rdi: start of next object |
| 579 __ or_(rbx, Immediate(kHeapObjectTag)); | 579 __ or_(rbx, Immediate(kHeapObjectTag)); |
| 580 __ movq(kScratchRegister, new_space_allocation_top); | 580 __ movq(kScratchRegister, new_space_allocation_top); |
| 581 __ movq(Operand(kScratchRegister, 0), rdi); | 581 __ movq(Operand(kScratchRegister, 0), rdi); |
| 582 | 582 |
| 583 // Check if a non-empty properties array is needed. | 583 // Check if a non-empty properties array is needed. |
| 584 // Allocate and initialize a FixedArray if it is. | 584 // Allocate and initialize a FixedArray if it is. |
| 585 // rax: initial map | 585 // rax: initial map |
| 586 // rbx: JSObject | 586 // rbx: JSObject |
| 587 // rdi: start of next object | 587 // rdi: start of next object |
| 588 // Calculate total properties described map. |
| 588 __ movzxbq(rdx, FieldOperand(rax, Map::kUnusedPropertyFieldsOffset)); | 589 __ movzxbq(rdx, FieldOperand(rax, Map::kUnusedPropertyFieldsOffset)); |
| 590 __ movzxbq(rcx, FieldOperand(rax, Map::kPreAllocatedPropertyFieldsOffset)); |
| 591 __ addq(rdx, rcx); |
| 592 // Calculate unused properties past the end of the in-object properties. |
| 589 __ movzxbq(rcx, FieldOperand(rax, Map::kInObjectPropertiesOffset)); | 593 __ movzxbq(rcx, FieldOperand(rax, Map::kInObjectPropertiesOffset)); |
| 590 // Calculate unused properties past the end of the in-object properties. | |
| 591 __ subq(rdx, rcx); | 594 __ subq(rdx, rcx); |
| 592 // Done if no extra properties are to be allocated. | 595 // Done if no extra properties are to be allocated. |
| 593 __ j(zero, &allocated); | 596 __ j(zero, &allocated); |
| 597 __ Assert(positive, "Property allocation count failed."); |
| 594 | 598 |
| 595 // Scale the number of elements by pointer size and add the header for | 599 // Scale the number of elements by pointer size and add the header for |
| 596 // FixedArrays to the start of the next object calculation from above. | 600 // FixedArrays to the start of the next object calculation from above. |
| 597 // rbx: JSObject | 601 // rbx: JSObject |
| 598 // rdi: start of next object (will be start of FixedArray) | 602 // rdi: start of next object (will be start of FixedArray) |
| 599 // rdx: number of elements in properties array | 603 // rdx: number of elements in properties array |
| 600 ASSERT(Heap::MaxObjectSizeInPagedSpace() > | 604 ASSERT(Heap::MaxObjectSizeInPagedSpace() > |
| 601 (FixedArray::kHeaderSize + 255*kPointerSize)); | 605 (FixedArray::kHeaderSize + 255*kPointerSize)); |
| 602 __ lea(rax, Operand(rdi, rdx, times_pointer_size, FixedArray::kHeaderSize)); | 606 __ lea(rax, Operand(rdi, rdx, times_pointer_size, FixedArray::kHeaderSize)); |
| 603 __ movq(kScratchRegister, new_space_allocation_limit); | 607 __ movq(kScratchRegister, new_space_allocation_limit); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 // Restore the arguments count and leave the construct frame. | 723 // Restore the arguments count and leave the construct frame. |
| 720 __ bind(&exit); | 724 __ bind(&exit); |
| 721 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count | 725 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count |
| 722 __ LeaveConstructFrame(); | 726 __ LeaveConstructFrame(); |
| 723 | 727 |
| 724 // Remove caller arguments from the stack and return. | 728 // Remove caller arguments from the stack and return. |
| 725 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 729 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 726 __ pop(rcx); | 730 __ pop(rcx); |
| 727 __ lea(rsp, Operand(rsp, rbx, times_4, 1 * kPointerSize)); // 1 ~ receiver | 731 __ lea(rsp, Operand(rsp, rbx, times_4, 1 * kPointerSize)); // 1 ~ receiver |
| 728 __ push(rcx); | 732 __ push(rcx); |
| 733 __ IncrementCounter(&Counters::constructed_objects, 1); |
| 729 __ ret(0); | 734 __ ret(0); |
| 730 } | 735 } |
| 731 | 736 |
| 732 | 737 |
| 733 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 738 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 734 bool is_construct) { | 739 bool is_construct) { |
| 735 // Expects five C++ function parameters. | 740 // Expects five C++ function parameters. |
| 736 // - Address entry (ignored) | 741 // - Address entry (ignored) |
| 737 // - JSFunction* function ( | 742 // - JSFunction* function ( |
| 738 // - Object* receiver | 743 // - Object* receiver |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 850 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
| 846 Generate_JSEntryTrampolineHelper(masm, false); | 851 Generate_JSEntryTrampolineHelper(masm, false); |
| 847 } | 852 } |
| 848 | 853 |
| 849 | 854 |
| 850 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 855 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| 851 Generate_JSEntryTrampolineHelper(masm, true); | 856 Generate_JSEntryTrampolineHelper(masm, true); |
| 852 } | 857 } |
| 853 | 858 |
| 854 } } // namespace v8::internal | 859 } } // namespace v8::internal |
| OLD | NEW |