OLD | NEW |
1 // Copyright 2006-2009 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 |
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 __ mov(edi, Factory::undefined_value()); | 1893 __ mov(edi, Factory::undefined_value()); |
1894 | 1894 |
1895 // eax: argc | 1895 // eax: argc |
1896 // ecx: first argument | 1896 // ecx: first argument |
1897 // edx: first in-object property of the JSObject | 1897 // edx: first in-object property of the JSObject |
1898 // edi: undefined | 1898 // edi: undefined |
1899 // Fill the initialized properties with a constant value or a passed argument | 1899 // Fill the initialized properties with a constant value or a passed argument |
1900 // depending on the this.x = ...; assignment in the function. | 1900 // depending on the this.x = ...; assignment in the function. |
1901 for (int i = 0; i < shared->this_property_assignments_count(); i++) { | 1901 for (int i = 0; i < shared->this_property_assignments_count(); i++) { |
1902 if (shared->IsThisPropertyAssignmentArgument(i)) { | 1902 if (shared->IsThisPropertyAssignmentArgument(i)) { |
1903 Label not_passed; | |
1904 // Set the property to undefined. | |
1905 __ mov(Operand(edx, i * kPointerSize), edi); | |
1906 // Check if the argument assigned to the property is actually passed. | 1903 // Check if the argument assigned to the property is actually passed. |
| 1904 // If argument is not passed the property is set to undefined, |
| 1905 // otherwise find it on the stack. |
1907 int arg_number = shared->GetThisPropertyAssignmentArgument(i); | 1906 int arg_number = shared->GetThisPropertyAssignmentArgument(i); |
| 1907 __ mov(ebx, edi); |
1908 __ cmp(eax, arg_number); | 1908 __ cmp(eax, arg_number); |
1909 __ j(below_equal, ¬_passed); | 1909 if (CpuFeatures::IsSupported(CMOV)) { |
1910 // Argument passed - find it on the stack. | 1910 CpuFeatures::Scope use_cmov(CMOV); |
1911 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize)); | 1911 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize)); |
| 1912 } else { |
| 1913 Label not_passed; |
| 1914 __ j(below_equal, ¬_passed); |
| 1915 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize)); |
| 1916 __ bind(¬_passed); |
| 1917 } |
| 1918 // Store value in the property. |
1912 __ mov(Operand(edx, i * kPointerSize), ebx); | 1919 __ mov(Operand(edx, i * kPointerSize), ebx); |
1913 __ bind(¬_passed); | |
1914 } else { | 1920 } else { |
1915 // Set the property to the constant value. | 1921 // Set the property to the constant value. |
1916 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); | 1922 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); |
1917 __ mov(Operand(edx, i * kPointerSize), Immediate(constant)); | 1923 __ mov(Operand(edx, i * kPointerSize), Immediate(constant)); |
1918 } | 1924 } |
1919 } | 1925 } |
1920 | 1926 |
1921 // Fill the unused in-object property fields with undefined. | 1927 // Fill the unused in-object property fields with undefined. |
1922 for (int i = shared->this_property_assignments_count(); | 1928 for (int i = shared->this_property_assignments_count(); |
1923 i < shared->CalculateInObjectProperties(); | 1929 i < shared->CalculateInObjectProperties(); |
(...skipping 22 matching lines...) Expand all Loading... |
1946 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1952 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
1947 | 1953 |
1948 // Return the generated code. | 1954 // Return the generated code. |
1949 return GetCode(); | 1955 return GetCode(); |
1950 } | 1956 } |
1951 | 1957 |
1952 | 1958 |
1953 #undef __ | 1959 #undef __ |
1954 | 1960 |
1955 } } // namespace v8::internal | 1961 } } // namespace v8::internal |
OLD | NEW |