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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1117 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
1118 return RawCallCodeObject(ic, mode); | 1118 return RawCallCodeObject(ic, mode); |
1119 } | 1119 } |
1120 | 1120 |
1121 | 1121 |
1122 Result VirtualFrame::CallStoreIC(Handle<String> name, | 1122 Result VirtualFrame::CallStoreIC(Handle<String> name, |
1123 bool is_contextual, | 1123 bool is_contextual, |
1124 StrictModeFlag strict_mode) { | 1124 StrictModeFlag strict_mode) { |
1125 // Value and (if not contextual) receiver are on top of the frame. | 1125 // Value and (if not contextual) receiver are on top of the frame. |
1126 // The IC expects name in rcx, value in rax, and receiver in rdx. | 1126 // The IC expects name in rcx, value in rax, and receiver in rdx. |
1127 Handle<Code> ic(Builtins::builtin(strict_mode == kStrictMode | 1127 Handle<Code> ic(Builtins::builtin( |
1128 ? Builtins::StoreIC_Initialize_Strict | 1128 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict |
1129 : Builtins::StoreIC_Initialize)); | 1129 : Builtins::StoreIC_Initialize)); |
1130 Result value = Pop(); | 1130 Result value = Pop(); |
1131 RelocInfo::Mode mode; | 1131 RelocInfo::Mode mode; |
1132 if (is_contextual) { | 1132 if (is_contextual) { |
1133 PrepareForCall(0, 0); | 1133 PrepareForCall(0, 0); |
1134 value.ToRegister(rax); | 1134 value.ToRegister(rax); |
1135 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1135 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
1136 value.Unuse(); | 1136 value.Unuse(); |
1137 mode = RelocInfo::CODE_TARGET_CONTEXT; | 1137 mode = RelocInfo::CODE_TARGET_CONTEXT; |
1138 } else { | 1138 } else { |
1139 Result receiver = Pop(); | 1139 Result receiver = Pop(); |
1140 PrepareForCall(0, 0); | 1140 PrepareForCall(0, 0); |
1141 MoveResultsToRegisters(&value, &receiver, rax, rdx); | 1141 MoveResultsToRegisters(&value, &receiver, rax, rdx); |
1142 mode = RelocInfo::CODE_TARGET; | 1142 mode = RelocInfo::CODE_TARGET; |
1143 } | 1143 } |
1144 __ Move(rcx, name); | 1144 __ Move(rcx, name); |
1145 return RawCallCodeObject(ic, mode); | 1145 return RawCallCodeObject(ic, mode); |
1146 } | 1146 } |
1147 | 1147 |
1148 | 1148 |
1149 Result VirtualFrame::CallKeyedStoreIC() { | 1149 Result VirtualFrame::CallKeyedStoreIC(StrictModeFlag strict_mode) { |
1150 // Value, key, and receiver are on the top of the frame. The IC | 1150 // Value, key, and receiver are on the top of the frame. The IC |
1151 // expects value in rax, key in rcx, and receiver in rdx. | 1151 // expects value in rax, key in rcx, and receiver in rdx. |
1152 Result value = Pop(); | 1152 Result value = Pop(); |
1153 Result key = Pop(); | 1153 Result key = Pop(); |
1154 Result receiver = Pop(); | 1154 Result receiver = Pop(); |
1155 PrepareForCall(0, 0); | 1155 PrepareForCall(0, 0); |
1156 if (!cgen()->allocator()->is_used(rax) || | 1156 if (!cgen()->allocator()->is_used(rax) || |
1157 (value.is_register() && value.reg().is(rax))) { | 1157 (value.is_register() && value.reg().is(rax))) { |
1158 if (!cgen()->allocator()->is_used(rax)) { | 1158 if (!cgen()->allocator()->is_used(rax)) { |
1159 value.ToRegister(rax); | 1159 value.ToRegister(rax); |
(...skipping 23 matching lines...) Expand all Loading... |
1183 __ xchg(rax, rcx); | 1183 __ xchg(rax, rcx); |
1184 } else { | 1184 } else { |
1185 __ xchg(rax, rcx); | 1185 __ xchg(rax, rcx); |
1186 __ xchg(rax, rdx); | 1186 __ xchg(rax, rdx); |
1187 } | 1187 } |
1188 value.Unuse(); | 1188 value.Unuse(); |
1189 key.Unuse(); | 1189 key.Unuse(); |
1190 receiver.Unuse(); | 1190 receiver.Unuse(); |
1191 } | 1191 } |
1192 | 1192 |
1193 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 1193 Handle<Code> ic(Builtins::builtin( |
| 1194 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict |
| 1195 : Builtins::KeyedStoreIC_Initialize)); |
1194 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 1196 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
1195 } | 1197 } |
1196 | 1198 |
1197 | 1199 |
1198 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, | 1200 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, |
1199 int arg_count, | 1201 int arg_count, |
1200 int loop_nesting) { | 1202 int loop_nesting) { |
1201 // Function name, arguments, and receiver are found on top of the frame | 1203 // Function name, arguments, and receiver are found on top of the frame |
1202 // and dropped by the call. The IC expects the name in rcx and the rest | 1204 // and dropped by the call. The IC expects the name in rcx and the rest |
1203 // on the stack, and drops them all. | 1205 // on the stack, and drops them all. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 Adjust(kHandlerSize - 1); | 1265 Adjust(kHandlerSize - 1); |
1264 __ PushTryHandler(IN_JAVASCRIPT, type); | 1266 __ PushTryHandler(IN_JAVASCRIPT, type); |
1265 } | 1267 } |
1266 | 1268 |
1267 | 1269 |
1268 #undef __ | 1270 #undef __ |
1269 | 1271 |
1270 } } // namespace v8::internal | 1272 } } // namespace v8::internal |
1271 | 1273 |
1272 #endif // V8_TARGET_ARCH_X64 | 1274 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |