OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 } | 1109 } |
1110 a->Unuse(); | 1110 a->Unuse(); |
1111 b->Unuse(); | 1111 b->Unuse(); |
1112 } | 1112 } |
1113 | 1113 |
1114 | 1114 |
1115 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { | 1115 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { |
1116 // Name and receiver are on the top of the frame. Both are dropped. | 1116 // Name and receiver are on the top of the frame. Both are dropped. |
1117 // The IC expects name in rcx and receiver in rax. | 1117 // The IC expects name in rcx and receiver in rax. |
1118 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1118 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1119 Builtins::LoadIC_Initialize)); | 1119 Builtins::kLoadIC_Initialize)); |
1120 Result name = Pop(); | 1120 Result name = Pop(); |
1121 Result receiver = Pop(); | 1121 Result receiver = Pop(); |
1122 PrepareForCall(0, 0); | 1122 PrepareForCall(0, 0); |
1123 MoveResultsToRegisters(&name, &receiver, rcx, rax); | 1123 MoveResultsToRegisters(&name, &receiver, rcx, rax); |
1124 | 1124 |
1125 return RawCallCodeObject(ic, mode); | 1125 return RawCallCodeObject(ic, mode); |
1126 } | 1126 } |
1127 | 1127 |
1128 | 1128 |
1129 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { | 1129 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { |
1130 // Key and receiver are on top of the frame. Put them in rax and rdx. | 1130 // Key and receiver are on top of the frame. Put them in rax and rdx. |
1131 Result key = Pop(); | 1131 Result key = Pop(); |
1132 Result receiver = Pop(); | 1132 Result receiver = Pop(); |
1133 PrepareForCall(0, 0); | 1133 PrepareForCall(0, 0); |
1134 MoveResultsToRegisters(&key, &receiver, rax, rdx); | 1134 MoveResultsToRegisters(&key, &receiver, rax, rdx); |
1135 | 1135 |
1136 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1136 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1137 Builtins::KeyedLoadIC_Initialize)); | 1137 Builtins::kKeyedLoadIC_Initialize)); |
1138 return RawCallCodeObject(ic, mode); | 1138 return RawCallCodeObject(ic, mode); |
1139 } | 1139 } |
1140 | 1140 |
1141 | 1141 |
1142 Result VirtualFrame::CallStoreIC(Handle<String> name, | 1142 Result VirtualFrame::CallStoreIC(Handle<String> name, |
1143 bool is_contextual, | 1143 bool is_contextual, |
1144 StrictModeFlag strict_mode) { | 1144 StrictModeFlag strict_mode) { |
1145 // Value and (if not contextual) receiver are on top of the frame. | 1145 // Value and (if not contextual) receiver are on top of the frame. |
1146 // The IC expects name in rcx, value in rax, and receiver in rdx. | 1146 // The IC expects name in rcx, value in rax, and receiver in rdx. |
1147 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1147 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1148 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict | 1148 (strict_mode == kStrictMode) ? Builtins::kStoreIC_Initialize_Strict |
1149 : Builtins::StoreIC_Initialize)); | 1149 : Builtins::kStoreIC_Initialize)); |
1150 Result value = Pop(); | 1150 Result value = Pop(); |
1151 RelocInfo::Mode mode; | 1151 RelocInfo::Mode mode; |
1152 if (is_contextual) { | 1152 if (is_contextual) { |
1153 PrepareForCall(0, 0); | 1153 PrepareForCall(0, 0); |
1154 value.ToRegister(rax); | 1154 value.ToRegister(rax); |
1155 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1155 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
1156 value.Unuse(); | 1156 value.Unuse(); |
1157 mode = RelocInfo::CODE_TARGET_CONTEXT; | 1157 mode = RelocInfo::CODE_TARGET_CONTEXT; |
1158 } else { | 1158 } else { |
1159 Result receiver = Pop(); | 1159 Result receiver = Pop(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 } else { | 1204 } else { |
1205 __ xchg(rax, rcx); | 1205 __ xchg(rax, rcx); |
1206 __ xchg(rax, rdx); | 1206 __ xchg(rax, rdx); |
1207 } | 1207 } |
1208 value.Unuse(); | 1208 value.Unuse(); |
1209 key.Unuse(); | 1209 key.Unuse(); |
1210 receiver.Unuse(); | 1210 receiver.Unuse(); |
1211 } | 1211 } |
1212 | 1212 |
1213 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1213 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1214 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 1214 (strict_mode == kStrictMode) ? Builtins::kKeyedStoreIC_Initialize_Strict |
1215 : Builtins::KeyedStoreIC_Initialize)); | 1215 : Builtins::kKeyedStoreIC_Initialize)); |
1216 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 1216 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
1217 } | 1217 } |
1218 | 1218 |
1219 | 1219 |
1220 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, | 1220 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, |
1221 int arg_count, | 1221 int arg_count, |
1222 int loop_nesting) { | 1222 int loop_nesting) { |
1223 // Function name, arguments, and receiver are found on top of the frame | 1223 // Function name, arguments, and receiver are found on top of the frame |
1224 // and dropped by the call. The IC expects the name in rcx and the rest | 1224 // and dropped by the call. The IC expects the name in rcx and the rest |
1225 // on the stack, and drops them all. | 1225 // on the stack, and drops them all. |
(...skipping 27 matching lines...) Expand all Loading... |
1253 name.Unuse(); | 1253 name.Unuse(); |
1254 return RawCallCodeObject(ic, mode); | 1254 return RawCallCodeObject(ic, mode); |
1255 } | 1255 } |
1256 | 1256 |
1257 | 1257 |
1258 Result VirtualFrame::CallConstructor(int arg_count) { | 1258 Result VirtualFrame::CallConstructor(int arg_count) { |
1259 // Arguments, receiver, and function are on top of the frame. The | 1259 // Arguments, receiver, and function are on top of the frame. The |
1260 // IC expects arg count in rax, function in rdi, and the arguments | 1260 // IC expects arg count in rax, function in rdi, and the arguments |
1261 // and receiver on the stack. | 1261 // and receiver on the stack. |
1262 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1262 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1263 Builtins::JSConstructCall)); | 1263 Builtins::kJSConstructCall)); |
1264 // Duplicate the function before preparing the frame. | 1264 // Duplicate the function before preparing the frame. |
1265 PushElementAt(arg_count); | 1265 PushElementAt(arg_count); |
1266 Result function = Pop(); | 1266 Result function = Pop(); |
1267 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args. | 1267 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args. |
1268 function.ToRegister(rdi); | 1268 function.ToRegister(rdi); |
1269 | 1269 |
1270 // Constructors are called with the number of arguments in register | 1270 // Constructors are called with the number of arguments in register |
1271 // rax for now. Another option would be to have separate construct | 1271 // rax for now. Another option would be to have separate construct |
1272 // call trampolines per different arguments counts encountered. | 1272 // call trampolines per different arguments counts encountered. |
1273 Result num_args = cgen()->allocator()->Allocate(rax); | 1273 Result num_args = cgen()->allocator()->Allocate(rax); |
(...skipping 13 matching lines...) Expand all Loading... |
1287 Adjust(kHandlerSize - 1); | 1287 Adjust(kHandlerSize - 1); |
1288 __ PushTryHandler(IN_JAVASCRIPT, type); | 1288 __ PushTryHandler(IN_JAVASCRIPT, type); |
1289 } | 1289 } |
1290 | 1290 |
1291 | 1291 |
1292 #undef __ | 1292 #undef __ |
1293 | 1293 |
1294 } } // namespace v8::internal | 1294 } } // namespace v8::internal |
1295 | 1295 |
1296 #endif // V8_TARGET_ARCH_X64 | 1296 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |