OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 return GetCode(kind(), Code::FAST, name); | 1175 return GetCode(kind(), Code::FAST, name); |
1176 } | 1176 } |
1177 | 1177 |
1178 | 1178 |
1179 #undef __ | 1179 #undef __ |
1180 #define __ ACCESS_MASM(masm) | 1180 #define __ ACCESS_MASM(masm) |
1181 | 1181 |
1182 | 1182 |
1183 void StoreStubCompiler::GenerateStoreViaSetter( | 1183 void StoreStubCompiler::GenerateStoreViaSetter( |
1184 MacroAssembler* masm, | 1184 MacroAssembler* masm, |
| 1185 Handle<HeapType> type, |
1185 Handle<JSFunction> setter) { | 1186 Handle<JSFunction> setter) { |
1186 // ----------- S t a t e ------------- | 1187 // ----------- S t a t e ------------- |
1187 // -- rax : value | 1188 // -- rax : value |
1188 // -- rcx : name | 1189 // -- rcx : name |
1189 // -- rdx : receiver | 1190 // -- rdx : receiver |
1190 // -- rsp[0] : return address | 1191 // -- rsp[0] : return address |
1191 // ----------------------------------- | 1192 // ----------------------------------- |
1192 { | 1193 { |
1193 FrameScope scope(masm, StackFrame::INTERNAL); | 1194 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1195 Register receiver = rdx; |
| 1196 Register value = rax; |
1194 | 1197 |
1195 // Save value register, so we can restore it later. | 1198 // Save value register, so we can restore it later. |
1196 __ push(rax); | 1199 __ push(value); |
1197 | 1200 |
1198 if (!setter.is_null()) { | 1201 if (!setter.is_null()) { |
1199 // Call the JavaScript setter with receiver and value on the stack. | 1202 // Call the JavaScript setter with receiver and value on the stack. |
1200 __ push(rdx); | 1203 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
1201 __ push(rax); | 1204 // Swap in the global receiver. |
| 1205 __ movp(receiver, |
| 1206 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
| 1207 } |
| 1208 __ push(receiver); |
| 1209 __ push(value); |
1202 ParameterCount actual(1); | 1210 ParameterCount actual(1); |
1203 ParameterCount expected(setter); | 1211 ParameterCount expected(setter); |
1204 __ InvokeFunction(setter, expected, actual, | 1212 __ InvokeFunction(setter, expected, actual, |
1205 CALL_FUNCTION, NullCallWrapper()); | 1213 CALL_FUNCTION, NullCallWrapper()); |
1206 } else { | 1214 } else { |
1207 // If we generate a global code snippet for deoptimization only, remember | 1215 // If we generate a global code snippet for deoptimization only, remember |
1208 // the place to continue after deoptimization. | 1216 // the place to continue after deoptimization. |
1209 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 1217 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
1210 } | 1218 } |
1211 | 1219 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 static Register registers[] = { rdx, rcx, rax, rbx, rdi, r8 }; | 1326 static Register registers[] = { rdx, rcx, rax, rbx, rdi, r8 }; |
1319 return registers; | 1327 return registers; |
1320 } | 1328 } |
1321 | 1329 |
1322 | 1330 |
1323 #undef __ | 1331 #undef __ |
1324 #define __ ACCESS_MASM(masm) | 1332 #define __ ACCESS_MASM(masm) |
1325 | 1333 |
1326 | 1334 |
1327 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, | 1335 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
| 1336 Handle<HeapType> type, |
1328 Register receiver, | 1337 Register receiver, |
1329 Handle<JSFunction> getter) { | 1338 Handle<JSFunction> getter) { |
1330 // ----------- S t a t e ------------- | 1339 // ----------- S t a t e ------------- |
1331 // -- rax : receiver | 1340 // -- rax : receiver |
1332 // -- rcx : name | 1341 // -- rcx : name |
1333 // -- rsp[0] : return address | 1342 // -- rsp[0] : return address |
1334 // ----------------------------------- | 1343 // ----------------------------------- |
1335 { | 1344 { |
1336 FrameScope scope(masm, StackFrame::INTERNAL); | 1345 FrameScope scope(masm, StackFrame::INTERNAL); |
1337 | 1346 |
1338 if (!getter.is_null()) { | 1347 if (!getter.is_null()) { |
1339 // Call the JavaScript getter with the receiver on the stack. | 1348 // Call the JavaScript getter with the receiver on the stack. |
| 1349 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 1350 // Swap in the global receiver. |
| 1351 __ movp(receiver, |
| 1352 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
| 1353 } |
1340 __ push(receiver); | 1354 __ push(receiver); |
1341 ParameterCount actual(0); | 1355 ParameterCount actual(0); |
1342 ParameterCount expected(getter); | 1356 ParameterCount expected(getter); |
1343 __ InvokeFunction(getter, expected, actual, | 1357 __ InvokeFunction(getter, expected, actual, |
1344 CALL_FUNCTION, NullCallWrapper()); | 1358 CALL_FUNCTION, NullCallWrapper()); |
1345 } else { | 1359 } else { |
1346 // If we generate a global code snippet for deoptimization only, remember | 1360 // If we generate a global code snippet for deoptimization only, remember |
1347 // the place to continue after deoptimization. | 1361 // the place to continue after deoptimization. |
1348 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 1362 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
1349 } | 1363 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 // ----------------------------------- | 1502 // ----------------------------------- |
1489 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1503 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1490 } | 1504 } |
1491 | 1505 |
1492 | 1506 |
1493 #undef __ | 1507 #undef __ |
1494 | 1508 |
1495 } } // namespace v8::internal | 1509 } } // namespace v8::internal |
1496 | 1510 |
1497 #endif // V8_TARGET_ARCH_X64 | 1511 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |