Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: src/arm/builtins-arm.cc

Issue 9304001: Implement inlining of constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Vyacheslav Egorov. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/deoptimizer-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 // r1: constructor function 889 // r1: constructor function
890 __ bind(&rt_call); 890 __ bind(&rt_call);
891 __ push(r1); // argument for Runtime_NewObject 891 __ push(r1); // argument for Runtime_NewObject
892 __ CallRuntime(Runtime::kNewObject, 1); 892 __ CallRuntime(Runtime::kNewObject, 1);
893 __ mov(r4, r0); 893 __ mov(r4, r0);
894 894
895 // Receiver for constructor call allocated. 895 // Receiver for constructor call allocated.
896 // r4: JSObject 896 // r4: JSObject
897 __ bind(&allocated); 897 __ bind(&allocated);
898 __ push(r4); 898 __ push(r4);
899 __ push(r4);
899 900
900 // Push the function and the allocated receiver from the stack. 901 // Reload the number of arguments and the constructor from the stack.
901 // sp[0]: receiver (newly allocated object)
902 // sp[1]: constructor function
903 // sp[2]: number of arguments (smi-tagged)
904 __ ldr(r1, MemOperand(sp, kPointerSize));
905 __ push(r1); // Constructor function.
906 __ push(r4); // Receiver.
907
908 // Reload the number of arguments from the stack.
909 // r1: constructor function
910 // sp[0]: receiver 902 // sp[0]: receiver
911 // sp[1]: constructor function 903 // sp[1]: receiver
912 // sp[2]: receiver 904 // sp[2]: constructor function
913 // sp[3]: constructor function 905 // sp[3]: number of arguments (smi-tagged)
914 // sp[4]: number of arguments (smi-tagged) 906 __ ldr(r1, MemOperand(sp, 2 * kPointerSize));
915 __ ldr(r3, MemOperand(sp, 4 * kPointerSize)); 907 __ ldr(r3, MemOperand(sp, 3 * kPointerSize));
916 908
917 // Set up pointer to last argument. 909 // Set up pointer to last argument.
918 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); 910 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
919 911
920 // Set up number of arguments for function call below 912 // Set up number of arguments for function call below
921 __ mov(r0, Operand(r3, LSR, kSmiTagSize)); 913 __ mov(r0, Operand(r3, LSR, kSmiTagSize));
922 914
923 // Copy arguments and receiver to the expression stack. 915 // Copy arguments and receiver to the expression stack.
924 // r0: number of arguments 916 // r0: number of arguments
917 // r1: constructor function
925 // r2: address of last argument (caller sp) 918 // r2: address of last argument (caller sp)
926 // r1: constructor function
927 // r3: number of arguments (smi-tagged) 919 // r3: number of arguments (smi-tagged)
928 // sp[0]: receiver 920 // sp[0]: receiver
929 // sp[1]: constructor function 921 // sp[1]: receiver
930 // sp[2]: receiver 922 // sp[2]: constructor function
931 // sp[3]: constructor function 923 // sp[3]: number of arguments (smi-tagged)
932 // sp[4]: number of arguments (smi-tagged)
933 Label loop, entry; 924 Label loop, entry;
934 __ b(&entry); 925 __ b(&entry);
935 __ bind(&loop); 926 __ bind(&loop);
936 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1)); 927 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1));
937 __ push(ip); 928 __ push(ip);
938 __ bind(&entry); 929 __ bind(&entry);
939 __ sub(r3, r3, Operand(2), SetCC); 930 __ sub(r3, r3, Operand(2), SetCC);
940 __ b(ge, &loop); 931 __ b(ge, &loop);
941 932
942 // Call the function. 933 // Call the function.
943 // r0: number of arguments 934 // r0: number of arguments
944 // r1: constructor function 935 // r1: constructor function
945 if (is_api_function) { 936 if (is_api_function) {
946 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 937 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
947 Handle<Code> code = 938 Handle<Code> code =
948 masm->isolate()->builtins()->HandleApiCallConstruct(); 939 masm->isolate()->builtins()->HandleApiCallConstruct();
949 ParameterCount expected(0); 940 ParameterCount expected(0);
950 __ InvokeCode(code, expected, expected, 941 __ InvokeCode(code, expected, expected,
951 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); 942 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD);
952 } else { 943 } else {
953 ParameterCount actual(r0); 944 ParameterCount actual(r0);
954 __ InvokeFunction(r1, actual, CALL_FUNCTION, 945 __ InvokeFunction(r1, actual, CALL_FUNCTION,
955 NullCallWrapper(), CALL_AS_METHOD); 946 NullCallWrapper(), CALL_AS_METHOD);
956 } 947 }
957 948
958 // Pop the function from the stack. 949 // Store offset of return address for deoptimizer.
959 // sp[0]: constructor function 950 if (!is_api_function && !count_constructions) {
960 // sp[2]: receiver 951 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
961 // sp[3]: constructor function 952 }
962 // sp[4]: number of arguments (smi-tagged)
963 __ pop();
964 953
965 // Restore context from the frame. 954 // Restore context from the frame.
966 // r0: result 955 // r0: result
967 // sp[0]: receiver 956 // sp[0]: receiver
968 // sp[1]: constructor function 957 // sp[1]: constructor function
969 // sp[2]: number of arguments (smi-tagged) 958 // sp[2]: number of arguments (smi-tagged)
970 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 959 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
971 960
972 // If the result is an object (in the ECMA sense), we should get rid 961 // If the result is an object (in the ECMA sense), we should get rid
973 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 962 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 __ bind(&fill); 1706 __ bind(&fill);
1718 __ push(ip); 1707 __ push(ip);
1719 __ cmp(sp, r2); 1708 __ cmp(sp, r2);
1720 __ b(ne, &fill); 1709 __ b(ne, &fill);
1721 } 1710 }
1722 1711
1723 // Call the entry point. 1712 // Call the entry point.
1724 __ bind(&invoke); 1713 __ bind(&invoke);
1725 __ Call(r3); 1714 __ Call(r3);
1726 1715
1716 // Store offset of return address for deoptimizer.
1727 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset()); 1717 masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset());
1718
1728 // Exit frame and return. 1719 // Exit frame and return.
1729 LeaveArgumentsAdaptorFrame(masm); 1720 LeaveArgumentsAdaptorFrame(masm);
1730 __ Jump(lr); 1721 __ Jump(lr);
1731 1722
1732 1723
1733 // ------------------------------------------- 1724 // -------------------------------------------
1734 // Dont adapt arguments. 1725 // Dont adapt arguments.
1735 // ------------------------------------------- 1726 // -------------------------------------------
1736 __ bind(&dont_adapt_arguments); 1727 __ bind(&dont_adapt_arguments);
1737 __ Jump(r3); 1728 __ Jump(r3);
1738 } 1729 }
1739 1730
1740 1731
1741 #undef __ 1732 #undef __
1742 1733
1743 } } // namespace v8::internal 1734 } } // namespace v8::internal
1744 1735
1745 #endif // V8_TARGET_ARCH_ARM 1736 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/deoptimizer-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698