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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 return GetCode(kind(), Code::FAST, name); | 1280 return GetCode(kind(), Code::FAST, name); |
1281 } | 1281 } |
1282 | 1282 |
1283 | 1283 |
1284 #undef __ | 1284 #undef __ |
1285 #define __ ACCESS_MASM(masm) | 1285 #define __ ACCESS_MASM(masm) |
1286 | 1286 |
1287 | 1287 |
1288 void StoreStubCompiler::GenerateStoreViaSetter( | 1288 void StoreStubCompiler::GenerateStoreViaSetter( |
1289 MacroAssembler* masm, | 1289 MacroAssembler* masm, |
| 1290 Handle<HeapType> type, |
1290 Handle<JSFunction> setter) { | 1291 Handle<JSFunction> setter) { |
1291 // ----------- S t a t e ------------- | 1292 // ----------- S t a t e ------------- |
1292 // -- eax : value | 1293 // -- eax : value |
1293 // -- ecx : name | 1294 // -- ecx : name |
1294 // -- edx : receiver | 1295 // -- edx : receiver |
1295 // -- esp[0] : return address | 1296 // -- esp[0] : return address |
1296 // ----------------------------------- | 1297 // ----------------------------------- |
1297 { | 1298 { |
1298 FrameScope scope(masm, StackFrame::INTERNAL); | 1299 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1300 Register receiver = edx; |
| 1301 Register value = eax; |
1299 | 1302 |
1300 // Save value register, so we can restore it later. | 1303 // Save value register, so we can restore it later. |
1301 __ push(eax); | 1304 __ push(value); |
1302 | 1305 |
1303 if (!setter.is_null()) { | 1306 if (!setter.is_null()) { |
1304 // Call the JavaScript setter with receiver and value on the stack. | 1307 // Call the JavaScript setter with receiver and value on the stack. |
1305 __ push(edx); | 1308 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
1306 __ push(eax); | 1309 // Swap in the global receiver. |
| 1310 __ mov(receiver, |
| 1311 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
| 1312 } |
| 1313 __ push(receiver); |
| 1314 __ push(value); |
1307 ParameterCount actual(1); | 1315 ParameterCount actual(1); |
1308 ParameterCount expected(setter); | 1316 ParameterCount expected(setter); |
1309 __ InvokeFunction(setter, expected, actual, | 1317 __ InvokeFunction(setter, expected, actual, |
1310 CALL_FUNCTION, NullCallWrapper()); | 1318 CALL_FUNCTION, NullCallWrapper()); |
1311 } else { | 1319 } else { |
1312 // If we generate a global code snippet for deoptimization only, remember | 1320 // If we generate a global code snippet for deoptimization only, remember |
1313 // the place to continue after deoptimization. | 1321 // the place to continue after deoptimization. |
1314 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 1322 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
1315 } | 1323 } |
1316 | 1324 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 static Register registers[] = { edx, ecx, eax, ebx, edi, no_reg }; | 1424 static Register registers[] = { edx, ecx, eax, ebx, edi, no_reg }; |
1417 return registers; | 1425 return registers; |
1418 } | 1426 } |
1419 | 1427 |
1420 | 1428 |
1421 #undef __ | 1429 #undef __ |
1422 #define __ ACCESS_MASM(masm) | 1430 #define __ ACCESS_MASM(masm) |
1423 | 1431 |
1424 | 1432 |
1425 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, | 1433 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
| 1434 Handle<HeapType> type, |
1426 Register receiver, | 1435 Register receiver, |
1427 Handle<JSFunction> getter) { | 1436 Handle<JSFunction> getter) { |
1428 { | 1437 { |
1429 FrameScope scope(masm, StackFrame::INTERNAL); | 1438 FrameScope scope(masm, StackFrame::INTERNAL); |
1430 | 1439 |
1431 if (!getter.is_null()) { | 1440 if (!getter.is_null()) { |
1432 // Call the JavaScript getter with the receiver on the stack. | 1441 // Call the JavaScript getter with the receiver on the stack. |
| 1442 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 1443 // Swap in the global receiver. |
| 1444 __ mov(receiver, |
| 1445 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
| 1446 } |
1433 __ push(receiver); | 1447 __ push(receiver); |
1434 ParameterCount actual(0); | 1448 ParameterCount actual(0); |
1435 ParameterCount expected(getter); | 1449 ParameterCount expected(getter); |
1436 __ InvokeFunction(getter, expected, actual, | 1450 __ InvokeFunction(getter, expected, actual, |
1437 CALL_FUNCTION, NullCallWrapper()); | 1451 CALL_FUNCTION, NullCallWrapper()); |
1438 } else { | 1452 } else { |
1439 // If we generate a global code snippet for deoptimization only, remember | 1453 // If we generate a global code snippet for deoptimization only, remember |
1440 // the place to continue after deoptimization. | 1454 // the place to continue after deoptimization. |
1441 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 1455 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
1442 } | 1456 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 // ----------------------------------- | 1597 // ----------------------------------- |
1584 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1598 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1585 } | 1599 } |
1586 | 1600 |
1587 | 1601 |
1588 #undef __ | 1602 #undef __ |
1589 | 1603 |
1590 } } // namespace v8::internal | 1604 } } // namespace v8::internal |
1591 | 1605 |
1592 #endif // V8_TARGET_ARCH_IA32 | 1606 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |