OLD | NEW |
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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 Result VirtualFrame::RawCallCodeObject(Handle<Code> code, | 993 Result VirtualFrame::RawCallCodeObject(Handle<Code> code, |
994 RelocInfo::Mode rmode) { | 994 RelocInfo::Mode rmode) { |
995 ASSERT(cgen()->HasValidEntryRegisters()); | 995 ASSERT(cgen()->HasValidEntryRegisters()); |
996 __ Call(code, rmode); | 996 __ Call(code, rmode); |
997 Result result = cgen()->allocator()->Allocate(rax); | 997 Result result = cgen()->allocator()->Allocate(rax); |
998 ASSERT(result.is_valid()); | 998 ASSERT(result.is_valid()); |
999 return result; | 999 return result; |
1000 } | 1000 } |
1001 | 1001 |
1002 | 1002 |
1003 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { | 1003 Result VirtualFrame::CallRuntime(const Runtime::Function* f, int arg_count) { |
1004 PrepareForCall(arg_count, arg_count); | 1004 PrepareForCall(arg_count, arg_count); |
1005 ASSERT(cgen()->HasValidEntryRegisters()); | 1005 ASSERT(cgen()->HasValidEntryRegisters()); |
1006 __ CallRuntime(f, arg_count); | 1006 __ CallRuntime(f, arg_count); |
1007 Result result = cgen()->allocator()->Allocate(rax); | 1007 Result result = cgen()->allocator()->Allocate(rax); |
1008 ASSERT(result.is_valid()); | 1008 ASSERT(result.is_valid()); |
1009 return result; | 1009 return result; |
1010 } | 1010 } |
1011 | 1011 |
1012 | 1012 |
1013 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { | 1013 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 a->ToRegister(a_reg); | 1067 a->ToRegister(a_reg); |
1068 } | 1068 } |
1069 a->Unuse(); | 1069 a->Unuse(); |
1070 b->Unuse(); | 1070 b->Unuse(); |
1071 } | 1071 } |
1072 | 1072 |
1073 | 1073 |
1074 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { | 1074 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { |
1075 // Name and receiver are on the top of the frame. Both are dropped. | 1075 // Name and receiver are on the top of the frame. Both are dropped. |
1076 // The IC expects name in rcx and receiver in rax. | 1076 // The IC expects name in rcx and receiver in rax. |
1077 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1077 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1078 Builtins::LoadIC_Initialize)); |
1078 Result name = Pop(); | 1079 Result name = Pop(); |
1079 Result receiver = Pop(); | 1080 Result receiver = Pop(); |
1080 PrepareForCall(0, 0); | 1081 PrepareForCall(0, 0); |
1081 MoveResultsToRegisters(&name, &receiver, rcx, rax); | 1082 MoveResultsToRegisters(&name, &receiver, rcx, rax); |
1082 | 1083 |
1083 return RawCallCodeObject(ic, mode); | 1084 return RawCallCodeObject(ic, mode); |
1084 } | 1085 } |
1085 | 1086 |
1086 | 1087 |
1087 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { | 1088 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { |
1088 // Key and receiver are on top of the frame. The IC expects them on | 1089 // Key and receiver are on top of the frame. The IC expects them on |
1089 // the stack. It does not drop them. | 1090 // the stack. It does not drop them. |
1090 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1091 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1092 Builtins::KeyedLoadIC_Initialize)); |
1091 Result name = Pop(); | 1093 Result name = Pop(); |
1092 Result receiver = Pop(); | 1094 Result receiver = Pop(); |
1093 PrepareForCall(0, 0); | 1095 PrepareForCall(0, 0); |
1094 MoveResultsToRegisters(&name, &receiver, rax, rdx); | 1096 MoveResultsToRegisters(&name, &receiver, rax, rdx); |
1095 return RawCallCodeObject(ic, mode); | 1097 return RawCallCodeObject(ic, mode); |
1096 } | 1098 } |
1097 | 1099 |
1098 | 1100 |
1099 Result VirtualFrame::CallCommonStoreIC(Handle<Code> ic, | 1101 Result VirtualFrame::CallCommonStoreIC(Handle<Code> ic, |
1100 Result* value, | 1102 Result* value, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 name.ToRegister(rcx); | 1182 name.ToRegister(rcx); |
1181 name.Unuse(); | 1183 name.Unuse(); |
1182 return RawCallCodeObject(ic, mode); | 1184 return RawCallCodeObject(ic, mode); |
1183 } | 1185 } |
1184 | 1186 |
1185 | 1187 |
1186 Result VirtualFrame::CallConstructor(int arg_count) { | 1188 Result VirtualFrame::CallConstructor(int arg_count) { |
1187 // Arguments, receiver, and function are on top of the frame. The | 1189 // Arguments, receiver, and function are on top of the frame. The |
1188 // IC expects arg count in rax, function in rdi, and the arguments | 1190 // IC expects arg count in rax, function in rdi, and the arguments |
1189 // and receiver on the stack. | 1191 // and receiver on the stack. |
1190 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); | 1192 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1193 Builtins::JSConstructCall)); |
1191 // Duplicate the function before preparing the frame. | 1194 // Duplicate the function before preparing the frame. |
1192 PushElementAt(arg_count + 1); | 1195 PushElementAt(arg_count + 1); |
1193 Result function = Pop(); | 1196 Result function = Pop(); |
1194 PrepareForCall(arg_count + 1, arg_count + 1); // Spill args and receiver. | 1197 PrepareForCall(arg_count + 1, arg_count + 1); // Spill args and receiver. |
1195 function.ToRegister(rdi); | 1198 function.ToRegister(rdi); |
1196 | 1199 |
1197 // Constructors are called with the number of arguments in register | 1200 // Constructors are called with the number of arguments in register |
1198 // rax for now. Another option would be to have separate construct | 1201 // rax for now. Another option would be to have separate construct |
1199 // call trampolines per different arguments counts encountered. | 1202 // call trampolines per different arguments counts encountered. |
1200 Result num_args = cgen()->allocator()->Allocate(rax); | 1203 Result num_args = cgen()->allocator()->Allocate(rax); |
(...skipping 13 matching lines...) Expand all Loading... |
1214 Adjust(kHandlerSize - 1); | 1217 Adjust(kHandlerSize - 1); |
1215 __ PushTryHandler(IN_JAVASCRIPT, type); | 1218 __ PushTryHandler(IN_JAVASCRIPT, type); |
1216 } | 1219 } |
1217 | 1220 |
1218 | 1221 |
1219 #undef __ | 1222 #undef __ |
1220 | 1223 |
1221 } } // namespace v8::internal | 1224 } } // namespace v8::internal |
1222 | 1225 |
1223 #endif // V8_TARGET_ARCH_X64 | 1226 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |