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 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 | 1820 |
1821 // rax: argc | 1821 // rax: argc |
1822 // rcx: first argument | 1822 // rcx: first argument |
1823 // rdx: JSObject (untagged) | 1823 // rdx: JSObject (untagged) |
1824 // r8: undefined | 1824 // r8: undefined |
1825 // r9: first in-object property of the JSObject | 1825 // r9: first in-object property of the JSObject |
1826 // Fill the initialized properties with a constant value or a passed argument | 1826 // Fill the initialized properties with a constant value or a passed argument |
1827 // depending on the this.x = ...; assignment in the function. | 1827 // depending on the this.x = ...; assignment in the function. |
1828 for (int i = 0; i < shared->this_property_assignments_count(); i++) { | 1828 for (int i = 0; i < shared->this_property_assignments_count(); i++) { |
1829 if (shared->IsThisPropertyAssignmentArgument(i)) { | 1829 if (shared->IsThisPropertyAssignmentArgument(i)) { |
1830 Label not_passed; | |
1831 // Set the property to undefined. | |
1832 __ movq(Operand(r9, i * kPointerSize), r8); | |
1833 // Check if the argument assigned to the property is actually passed. | 1830 // Check if the argument assigned to the property is actually passed. |
| 1831 // If argument is not passed the property is set to undefined, |
| 1832 // otherwise find it on the stack. |
1834 int arg_number = shared->GetThisPropertyAssignmentArgument(i); | 1833 int arg_number = shared->GetThisPropertyAssignmentArgument(i); |
| 1834 __ movq(rbx, r8); |
1835 __ cmpq(rax, Immediate(arg_number)); | 1835 __ cmpq(rax, Immediate(arg_number)); |
1836 __ j(below_equal, ¬_passed); | 1836 __ cmovq(above, rbx, Operand(rcx, arg_number * -kPointerSize)); |
1837 // Argument passed - find it on the stack. | 1837 // Store value in the property. |
1838 __ movq(rbx, Operand(rcx, arg_number * -kPointerSize)); | |
1839 __ movq(Operand(r9, i * kPointerSize), rbx); | 1838 __ movq(Operand(r9, i * kPointerSize), rbx); |
1840 __ bind(¬_passed); | |
1841 } else { | 1839 } else { |
1842 // Set the property to the constant value. | 1840 // Set the property to the constant value. |
1843 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); | 1841 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); |
1844 __ Move(Operand(r9, i * kPointerSize), constant); | 1842 __ Move(Operand(r9, i * kPointerSize), constant); |
1845 } | 1843 } |
1846 } | 1844 } |
1847 | 1845 |
1848 // Fill the unused in-object property fields with undefined. | 1846 // Fill the unused in-object property fields with undefined. |
1849 for (int i = shared->this_property_assignments_count(); | 1847 for (int i = shared->this_property_assignments_count(); |
1850 i < shared->CalculateInObjectProperties(); | 1848 i < shared->CalculateInObjectProperties(); |
(...skipping 26 matching lines...) Expand all Loading... |
1877 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1875 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1878 | 1876 |
1879 // Return the generated code. | 1877 // Return the generated code. |
1880 return GetCode(); | 1878 return GetCode(); |
1881 } | 1879 } |
1882 | 1880 |
1883 | 1881 |
1884 #undef __ | 1882 #undef __ |
1885 | 1883 |
1886 } } // namespace v8::internal | 1884 } } // namespace v8::internal |
OLD | NEW |