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

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

Issue 598065: Change CallIC interface on ARM. Remove name from the stack, and pass it in r... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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/codegen-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 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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 { Label done; 908 { Label done;
909 __ tst(r0, Operand(r0)); 909 __ tst(r0, Operand(r0));
910 __ b(ne, &done); 910 __ b(ne, &done);
911 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 911 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
912 __ push(r2); 912 __ push(r2);
913 __ add(r0, r0, Operand(1)); 913 __ add(r0, r0, Operand(1));
914 __ bind(&done); 914 __ bind(&done);
915 } 915 }
916 916
917 // 2. Get the function to call from the stack. 917 // 2. Get the function to call from the stack.
918 // r0: actual number of argument 918 // r0: actual number of arguments
919 { Label done, non_function, function; 919 { Label done, non_function, function;
920 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); 920 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
921 __ tst(r1, Operand(kSmiTagMask)); 921 __ tst(r1, Operand(kSmiTagMask));
922 __ b(eq, &non_function); 922 __ b(eq, &non_function);
923 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); 923 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE);
924 __ b(eq, &function); 924 __ b(eq, &function);
925 925
926 // Non-function called: Clear the function to force exception. 926 // Non-function called: Clear the function to force exception.
927 __ bind(&non_function); 927 __ bind(&non_function);
928 __ mov(r1, Operand(0)); 928 __ mov(r1, Operand(0));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 __ ldr(r2, FieldMemOperand(r2, kGlobalIndex)); 990 __ ldr(r2, FieldMemOperand(r2, kGlobalIndex));
991 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); 991 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
992 992
993 __ bind(&patch_receiver); 993 __ bind(&patch_receiver);
994 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); 994 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2));
995 __ str(r2, MemOperand(r3, -kPointerSize)); 995 __ str(r2, MemOperand(r3, -kPointerSize));
996 996
997 __ bind(&done); 997 __ bind(&done);
998 } 998 }
999 999
1000 // 4. Shift stuff one slot down the stack 1000 // 4. Handle non-functions.
1001 // r0: actual number of arguments (including call() receiver) 1001 // r0: actual number of arguments (including call() receiver)
1002 // r1: function 1002 // r1: function
1003 { Label done;
1004 __ tst(r1, r1);
1005 __ b(ne, &done);
1006 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION
1007 // Transfer the receiver from the first argument to the top of the
1008 // caller's expression stack simply by decrementing argc.
1009 __ sub(r0, r0, Operand(1));
1010 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
1011 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
1012 RelocInfo::CODE_TARGET);
1013 __ bind(&done);
1014 }
1015
1016 // 5. Shift arguments one slot toward the bottom of the
1017 // stack, overwriting the receiver.
1003 { Label loop; 1018 { Label loop;
1004 // Calculate the copy start address (destination). Copy end address is sp. 1019 // Calculate the copy start address (destination). Copy end address is sp.
1005 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); 1020 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1006 __ add(r2, r2, Operand(kPointerSize)); // copy receiver too
1007 1021
1008 __ bind(&loop); 1022 __ bind(&loop);
1009 __ ldr(ip, MemOperand(r2, -kPointerSize)); 1023 __ ldr(ip, MemOperand(r2, -kPointerSize));
1010 __ str(ip, MemOperand(r2)); 1024 __ str(ip, MemOperand(r2));
1011 __ sub(r2, r2, Operand(kPointerSize)); 1025 __ sub(r2, r2, Operand(kPointerSize));
1012 __ cmp(r2, sp); 1026 __ cmp(r2, sp);
1013 __ b(ne, &loop); 1027 __ b(ne, &loop);
1028 // Adjust the actual number of arguments and remove the top element.
1029 __ sub(r0, r0, Operand(1));
1030 __ pop();
1014 } 1031 }
1015 1032
1016 // 5. Adjust the actual number of arguments and remove the top element.
1017 // r0: actual number of arguments (including call() receiver)
1018 // r1: function
1019 __ sub(r0, r0, Operand(1));
1020 __ add(sp, sp, Operand(kPointerSize));
1021
1022 // 6. Get the code for the function or the non-function builtin. 1033 // 6. Get the code for the function or the non-function builtin.
1023 // If number of expected arguments matches, then call. Otherwise restart 1034 // If number of expected arguments matches, then call. Otherwise restart
1024 // the arguments adaptor stub. 1035 // the arguments adaptor stub.
1025 // r0: actual number of arguments 1036 // r0: actual number of arguments
1026 // r1: function 1037 // r1: function
1027 { Label invoke; 1038 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1028 __ tst(r1, r1); 1039 __ ldr(r2,
1029 __ b(ne, &invoke); 1040 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1030 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION 1041 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset));
1031 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 1042 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
1032 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), 1043 __ cmp(r2, r0); // Check formal and actual parameter counts.
1033 RelocInfo::CODE_TARGET); 1044 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
1045 RelocInfo::CODE_TARGET, ne);
1034 1046
1035 __ bind(&invoke); 1047 // 7. Jump (tail-call) to the code in r3 without checking arguments.
1036 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1048 ParameterCount expected(0);
1037 __ ldr(r2, 1049 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION);
1038 FieldMemOperand(r3,
1039 SharedFunctionInfo::kFormalParameterCountOffset));
1040 __ ldr(r3,
1041 MemOperand(r3, SharedFunctionInfo::kCodeOffset - kHeapObjectTag));
1042 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
1043 __ cmp(r2, r0); // Check formal and actual parameter counts.
1044 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
1045 RelocInfo::CODE_TARGET, ne);
1046
1047 // 7. Jump to the code in r3 without checking arguments.
1048 ParameterCount expected(0);
1049 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION);
1050 }
1051 } 1050 }
1052 1051
1053 1052
1054 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1053 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1055 const int kIndexOffset = -5 * kPointerSize; 1054 const int kIndexOffset = -5 * kPointerSize;
1056 const int kLimitOffset = -4 * kPointerSize; 1055 const int kLimitOffset = -4 * kPointerSize;
1057 const int kArgsOffset = 2 * kPointerSize; 1056 const int kArgsOffset = 2 * kPointerSize;
1058 const int kRecvOffset = 3 * kPointerSize; 1057 const int kRecvOffset = 3 * kPointerSize;
1059 const int kFunctionOffset = 4 * kPointerSize; 1058 const int kFunctionOffset = 4 * kPointerSize;
1060 1059
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 // Dont adapt arguments. 1298 // Dont adapt arguments.
1300 // ------------------------------------------- 1299 // -------------------------------------------
1301 __ bind(&dont_adapt_arguments); 1300 __ bind(&dont_adapt_arguments);
1302 __ Jump(r3); 1301 __ Jump(r3);
1303 } 1302 }
1304 1303
1305 1304
1306 #undef __ 1305 #undef __
1307 1306
1308 } } // namespace v8::internal 1307 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698