OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 // r1: constructor function | 888 // r1: constructor function |
889 __ bind(&rt_call); | 889 __ bind(&rt_call); |
890 __ push(r1); // argument for Runtime_NewObject | 890 __ push(r1); // argument for Runtime_NewObject |
891 __ CallRuntime(Runtime::kNewObject, 1); | 891 __ CallRuntime(Runtime::kNewObject, 1); |
892 __ mov(r4, r0); | 892 __ mov(r4, r0); |
893 | 893 |
894 // Receiver for constructor call allocated. | 894 // Receiver for constructor call allocated. |
895 // r4: JSObject | 895 // r4: JSObject |
896 __ bind(&allocated); | 896 __ bind(&allocated); |
897 __ push(r4); | 897 __ push(r4); |
| 898 __ push(r4); |
898 | 899 |
899 // Push the function and the allocated receiver from the stack. | 900 // Reload the number of arguments and the constructor from the stack. |
900 // sp[0]: receiver (newly allocated object) | |
901 // sp[1]: constructor function | |
902 // sp[2]: number of arguments (smi-tagged) | |
903 __ ldr(r1, MemOperand(sp, kPointerSize)); | |
904 __ push(r1); // Constructor function. | |
905 __ push(r4); // Receiver. | |
906 | |
907 // Reload the number of arguments from the stack. | |
908 // r1: constructor function | |
909 // sp[0]: receiver | 901 // sp[0]: receiver |
910 // sp[1]: constructor function | 902 // sp[1]: receiver |
911 // sp[2]: receiver | 903 // sp[2]: constructor function |
912 // sp[3]: constructor function | 904 // sp[3]: number of arguments (smi-tagged) |
913 // sp[4]: number of arguments (smi-tagged) | 905 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); |
914 __ ldr(r3, MemOperand(sp, 4 * kPointerSize)); | 906 __ ldr(r3, MemOperand(sp, 3 * kPointerSize)); |
915 | 907 |
916 // Set up pointer to last argument. | 908 // Set up pointer to last argument. |
917 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 909 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
918 | 910 |
919 // Set up number of arguments for function call below | 911 // Set up number of arguments for function call below |
920 __ mov(r0, Operand(r3, LSR, kSmiTagSize)); | 912 __ mov(r0, Operand(r3, LSR, kSmiTagSize)); |
921 | 913 |
922 // Copy arguments and receiver to the expression stack. | 914 // Copy arguments and receiver to the expression stack. |
923 // r0: number of arguments | 915 // r0: number of arguments |
| 916 // r1: constructor function |
924 // r2: address of last argument (caller sp) | 917 // r2: address of last argument (caller sp) |
925 // r1: constructor function | |
926 // r3: number of arguments (smi-tagged) | 918 // r3: number of arguments (smi-tagged) |
927 // sp[0]: receiver | 919 // sp[0]: receiver |
928 // sp[1]: constructor function | 920 // sp[1]: receiver |
929 // sp[2]: receiver | 921 // sp[2]: constructor function |
930 // sp[3]: constructor function | 922 // sp[3]: number of arguments (smi-tagged) |
931 // sp[4]: number of arguments (smi-tagged) | |
932 Label loop, entry; | 923 Label loop, entry; |
933 __ b(&entry); | 924 __ b(&entry); |
934 __ bind(&loop); | 925 __ bind(&loop); |
935 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1)); | 926 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1)); |
936 __ push(ip); | 927 __ push(ip); |
937 __ bind(&entry); | 928 __ bind(&entry); |
938 __ sub(r3, r3, Operand(2), SetCC); | 929 __ sub(r3, r3, Operand(2), SetCC); |
939 __ b(ge, &loop); | 930 __ b(ge, &loop); |
940 | 931 |
941 // Call the function. | 932 // Call the function. |
942 // r0: number of arguments | 933 // r0: number of arguments |
943 // r1: constructor function | 934 // r1: constructor function |
944 if (is_api_function) { | 935 if (is_api_function) { |
945 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 936 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
946 Handle<Code> code = | 937 Handle<Code> code = |
947 masm->isolate()->builtins()->HandleApiCallConstruct(); | 938 masm->isolate()->builtins()->HandleApiCallConstruct(); |
948 ParameterCount expected(0); | 939 ParameterCount expected(0); |
949 __ InvokeCode(code, expected, expected, | 940 __ InvokeCode(code, expected, expected, |
950 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); | 941 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); |
951 } else { | 942 } else { |
952 ParameterCount actual(r0); | 943 ParameterCount actual(r0); |
953 __ InvokeFunction(r1, actual, CALL_FUNCTION, | 944 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
954 NullCallWrapper(), CALL_AS_METHOD); | 945 NullCallWrapper(), CALL_AS_METHOD); |
955 } | 946 } |
956 | 947 |
957 // Pop the function from the stack. | |
958 // sp[0]: constructor function | |
959 // sp[2]: receiver | |
960 // sp[3]: constructor function | |
961 // sp[4]: number of arguments (smi-tagged) | |
962 __ pop(); | |
963 | |
964 // Restore context from the frame. | 948 // Restore context from the frame. |
965 // r0: result | 949 // r0: result |
966 // sp[0]: receiver | 950 // sp[0]: receiver |
967 // sp[1]: constructor function | 951 // sp[1]: constructor function |
968 // sp[2]: number of arguments (smi-tagged) | 952 // sp[2]: number of arguments (smi-tagged) |
969 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 953 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
970 | 954 |
971 // If the result is an object (in the ECMA sense), we should get rid | 955 // If the result is an object (in the ECMA sense), we should get rid |
972 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 956 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
973 // on page 74. | 957 // on page 74. |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 __ bind(&dont_adapt_arguments); | 1719 __ bind(&dont_adapt_arguments); |
1736 __ Jump(r3); | 1720 __ Jump(r3); |
1737 } | 1721 } |
1738 | 1722 |
1739 | 1723 |
1740 #undef __ | 1724 #undef __ |
1741 | 1725 |
1742 } } // namespace v8::internal | 1726 } } // namespace v8::internal |
1743 | 1727 |
1744 #endif // V8_TARGET_ARCH_ARM | 1728 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |