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

Side by Side Diff: src/x64/ic-x64.cc

Issue 596036: Port change in CallIC interface to x64 platform. Name of called function is ... (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 | « src/x64/full-codegen-x64.cc ('k') | src/x64/stub-cache-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 __ ret(0); 923 __ ret(0);
924 } 924 }
925 925
926 // Slow case: call runtime. 926 // Slow case: call runtime.
927 __ bind(&slow); 927 __ bind(&slow);
928 GenerateRuntimeSetProperty(masm); 928 GenerateRuntimeSetProperty(masm);
929 } 929 }
930 930
931 931
932 void CallIC::GenerateMiss(MacroAssembler* masm, int argc) { 932 void CallIC::GenerateMiss(MacroAssembler* masm, int argc) {
933 // ----------- S t a t e -------------
934 // rcx : function name
935 // rsp[0] : return address
936 // rsp[8] : argument argc
937 // rsp[16] : argument argc - 1
938 // ...
939 // rsp[argc * 8] : argument 1
940 // rsp[(argc + 1) * 8] : argument 0 = receiver
941 // -----------------------------------
933 // Get the receiver of the function from the stack; 1 ~ return address. 942 // Get the receiver of the function from the stack; 1 ~ return address.
934 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 943 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
935 // Get the name of the function to call from the stack.
936 // 2 ~ receiver, return address.
937 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize));
938 944
939 // Enter an internal frame. 945 // Enter an internal frame.
940 __ EnterInternalFrame(); 946 __ EnterInternalFrame();
941 947
942 // Push the receiver and the name of the function. 948 // Push the receiver and the name of the function.
943 __ push(rdx); 949 __ push(rdx);
944 __ push(rbx); 950 __ push(rcx);
945 951
946 // Call the entry. 952 // Call the entry.
947 CEntryStub stub(1); 953 CEntryStub stub(1);
948 __ movq(rax, Immediate(2)); 954 __ movq(rax, Immediate(2));
949 __ movq(rbx, ExternalReference(IC_Utility(kCallIC_Miss))); 955 __ movq(rbx, ExternalReference(IC_Utility(kCallIC_Miss)));
950 __ CallStub(&stub); 956 __ CallStub(&stub);
951 957
952 // Move result to rdi and exit the internal frame. 958 // Move result to rdi and exit the internal frame.
953 __ movq(rdi, rax); 959 __ movq(rdi, rax);
954 __ LeaveInternalFrame(); 960 __ LeaveInternalFrame();
(...skipping 17 matching lines...) Expand all
972 __ bind(&invoke); 978 __ bind(&invoke);
973 __ InvokeFunction(rdi, actual, JUMP_FUNCTION); 979 __ InvokeFunction(rdi, actual, JUMP_FUNCTION);
974 } 980 }
975 981
976 982
977 // Defined in ic.cc. 983 // Defined in ic.cc.
978 Object* CallIC_Miss(Arguments args); 984 Object* CallIC_Miss(Arguments args);
979 985
980 void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { 986 void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
981 // ----------- S t a t e ------------- 987 // ----------- S t a t e -------------
982 // rsp[0] return address 988 // rcx : function name
983 // rsp[8] argument argc 989 // rsp[0] : return address
984 // rsp[16] argument argc - 1 990 // rsp[8] : argument argc
991 // rsp[16] : argument argc - 1
985 // ... 992 // ...
986 // rsp[argc * 8] argument 1 993 // rsp[argc * 8] : argument 1
987 // rsp[(argc + 1) * 8] argument 0 = receiver 994 // rsp[(argc + 1) * 8] : argument 0 = receiver
988 // rsp[(argc + 2) * 8] function name
989 // ----------------------------------- 995 // -----------------------------------
990 Label number, non_number, non_string, boolean, probe, miss; 996 Label number, non_number, non_string, boolean, probe, miss;
991 997
992 // Get the receiver of the function from the stack; 1 ~ return address. 998 // Get the receiver of the function from the stack; 1 ~ return address.
993 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 999 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
994 // Get the name of the function from the stack; 2 ~ return address, receiver
995 __ movq(rcx, Operand(rsp, (argc + 2) * kPointerSize));
996 1000
997 // Probe the stub cache. 1001 // Probe the stub cache.
998 Code::Flags flags = 1002 Code::Flags flags =
999 Code::ComputeFlags(Code::CALL_IC, NOT_IN_LOOP, MONOMORPHIC, NORMAL, argc); 1003 Code::ComputeFlags(Code::CALL_IC, NOT_IN_LOOP, MONOMORPHIC, NORMAL, argc);
1000 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, rax); 1004 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, rax);
1001 1005
1002 // If the stub cache probing failed, the receiver might be a value. 1006 // If the stub cache probing failed, the receiver might be a value.
1003 // For value objects, we use the map of the prototype objects for 1007 // For value objects, we use the map of the prototype objects for
1004 // the corresponding JSValue for the cache and that is what we need 1008 // the corresponding JSValue for the cache and that is what we need
1005 // to probe. 1009 // to probe.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 // Cache miss: Jump to runtime. 1042 // Cache miss: Jump to runtime.
1039 __ bind(&miss); 1043 __ bind(&miss);
1040 GenerateMiss(masm, argc); 1044 GenerateMiss(masm, argc);
1041 } 1045 }
1042 1046
1043 1047
1044 static void GenerateNormalHelper(MacroAssembler* masm, 1048 static void GenerateNormalHelper(MacroAssembler* masm,
1045 int argc, 1049 int argc,
1046 bool is_global_object, 1050 bool is_global_object,
1047 Label* miss) { 1051 Label* miss) {
1052 // ----------- S t a t e -------------
1053 // rcx : function name
1054 // rdx : receiver
1055 // rsp[0] : return address
1056 // rsp[8] : argument argc
1057 // rsp[16] : argument argc - 1
1058 // ...
1059 // rsp[argc * 8] : argument 1
1060 // rsp[(argc + 1) * 8] : argument 0 = receiver
1061 // -----------------------------------
1048 // Search dictionary - put result in register rdx. 1062 // Search dictionary - put result in register rdx.
1049 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); 1063 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY);
1050 1064
1051 // Move the result to register rdi and check that it isn't a smi. 1065 // Move the result to register rdi and check that it isn't a smi.
1052 __ movq(rdi, rdx); 1066 __ movq(rdi, rdx);
1053 __ JumpIfSmi(rdx, miss); 1067 __ JumpIfSmi(rdx, miss);
1054 1068
1055 // Check that the value is a JavaScript function. 1069 // Check that the value is a JavaScript function.
1056 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rdx); 1070 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rdx);
1057 __ j(not_equal, miss); 1071 __ j(not_equal, miss);
(...skipping 10 matching lines...) Expand all
1068 } 1082 }
1069 1083
1070 // Invoke the function. 1084 // Invoke the function.
1071 ParameterCount actual(argc); 1085 ParameterCount actual(argc);
1072 __ InvokeFunction(rdi, actual, JUMP_FUNCTION); 1086 __ InvokeFunction(rdi, actual, JUMP_FUNCTION);
1073 } 1087 }
1074 1088
1075 1089
1076 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { 1090 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
1077 // ----------- S t a t e ------------- 1091 // ----------- S t a t e -------------
1078 // rsp[0] return address 1092 // rcx : function name
1079 // rsp[8] argument argc 1093 // rsp[0] : return address
1080 // rsp[16] argument argc - 1 1094 // rsp[8] : argument argc
1095 // rsp[16] : argument argc - 1
1081 // ... 1096 // ...
1082 // rsp[argc * 8] argument 1 1097 // rsp[argc * 8] : argument 1
1083 // rsp[(argc + 1) * 8] argument 0 = receiver 1098 // rsp[(argc + 1) * 8] : argument 0 = receiver
1084 // rsp[(argc + 2) * 8] function name
1085 // ----------------------------------- 1099 // -----------------------------------
1086 Label miss, global_object, non_global_object; 1100 Label miss, global_object, non_global_object;
1087 1101
1088 // Get the receiver of the function from the stack. 1102 // Get the receiver of the function from the stack.
1089 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 1103 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
1090 // Get the name of the function from the stack.
1091 __ movq(rcx, Operand(rsp, (argc + 2) * kPointerSize));
1092 1104
1093 // Check that the receiver isn't a smi. 1105 // Check that the receiver isn't a smi.
1094 __ JumpIfSmi(rdx, &miss); 1106 __ JumpIfSmi(rdx, &miss);
1095 1107
1096 // Check that the receiver is a valid JS object. 1108 // Check that the receiver is a valid JS object.
1097 // Because there are so many map checks and type checks, do not 1109 // Because there are so many map checks and type checks, do not
1098 // use CmpObjectType, but load map and type into registers. 1110 // use CmpObjectType, but load map and type into registers.
1099 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); 1111 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset));
1100 __ movb(rax, FieldOperand(rbx, Map::kInstanceTypeOffset)); 1112 __ movb(rax, FieldOperand(rbx, Map::kInstanceTypeOffset));
1101 __ cmpb(rax, Immediate(FIRST_JS_OBJECT_TYPE)); 1113 __ cmpb(rax, Immediate(FIRST_JS_OBJECT_TYPE));
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 1362
1351 // Cache miss: Jump to runtime. 1363 // Cache miss: Jump to runtime.
1352 GenerateMiss(masm); 1364 GenerateMiss(masm);
1353 } 1365 }
1354 1366
1355 1367
1356 #undef __ 1368 #undef __
1357 1369
1358 1370
1359 } } // namespace v8::internal 1371 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698