| 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 __ movl(rcx, rbx); | 623 __ movl(rcx, rbx); |
| 624 __ shr(rcx, Immediate(KeyedLookupCache::kMapHashShift)); | 624 __ shr(rcx, Immediate(KeyedLookupCache::kMapHashShift)); |
| 625 __ movl(rdi, FieldOperand(rax, String::kHashFieldOffset)); | 625 __ movl(rdi, FieldOperand(rax, String::kHashFieldOffset)); |
| 626 __ shr(rdi, Immediate(String::kHashShift)); | 626 __ shr(rdi, Immediate(String::kHashShift)); |
| 627 __ xor_(rcx, rdi); | 627 __ xor_(rcx, rdi); |
| 628 __ and_(rcx, Immediate(KeyedLookupCache::kCapacityMask)); | 628 __ and_(rcx, Immediate(KeyedLookupCache::kCapacityMask)); |
| 629 | 629 |
| 630 // Load the key (consisting of map and symbol) from the cache and | 630 // Load the key (consisting of map and symbol) from the cache and |
| 631 // check for match. | 631 // check for match. |
| 632 ExternalReference cache_keys | 632 ExternalReference cache_keys |
| 633 = ExternalReference::keyed_lookup_cache_keys(); | 633 = ExternalReference::keyed_lookup_cache_keys(masm->isolate()); |
| 634 __ movq(rdi, rcx); | 634 __ movq(rdi, rcx); |
| 635 __ shl(rdi, Immediate(kPointerSizeLog2 + 1)); | 635 __ shl(rdi, Immediate(kPointerSizeLog2 + 1)); |
| 636 __ movq(kScratchRegister, cache_keys); | 636 __ movq(kScratchRegister, cache_keys); |
| 637 __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); | 637 __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); |
| 638 __ j(not_equal, &slow); | 638 __ j(not_equal, &slow); |
| 639 __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize)); | 639 __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize)); |
| 640 __ j(not_equal, &slow); | 640 __ j(not_equal, &slow); |
| 641 | 641 |
| 642 // Get field offset, which is a 32-bit integer. | 642 // Get field offset, which is a 32-bit integer. |
| 643 ExternalReference cache_field_offsets | 643 ExternalReference cache_field_offsets |
| 644 = ExternalReference::keyed_lookup_cache_field_offsets(); | 644 = ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate()); |
| 645 __ movq(kScratchRegister, cache_field_offsets); | 645 __ movq(kScratchRegister, cache_field_offsets); |
| 646 __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); | 646 __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); |
| 647 __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); | 647 __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); |
| 648 __ subq(rdi, rcx); | 648 __ subq(rdi, rcx); |
| 649 __ j(above_equal, &property_array_property); | 649 __ j(above_equal, &property_array_property); |
| 650 | 650 |
| 651 // Load in-object property. | 651 // Load in-object property. |
| 652 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); | 652 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
| 653 __ addq(rcx, rdi); | 653 __ addq(rcx, rdi); |
| 654 __ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0)); | 654 __ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 __ cmpb(rcx, Immediate(1 << Map::kHasIndexedInterceptor)); | 743 __ cmpb(rcx, Immediate(1 << Map::kHasIndexedInterceptor)); |
| 744 __ j(not_zero, &slow); | 744 __ j(not_zero, &slow); |
| 745 | 745 |
| 746 // Everything is fine, call runtime. | 746 // Everything is fine, call runtime. |
| 747 __ pop(rcx); | 747 __ pop(rcx); |
| 748 __ push(rdx); // receiver | 748 __ push(rdx); // receiver |
| 749 __ push(rax); // key | 749 __ push(rax); // key |
| 750 __ push(rcx); // return address | 750 __ push(rcx); // return address |
| 751 | 751 |
| 752 // Perform tail call to the entry. | 752 // Perform tail call to the entry. |
| 753 __ TailCallExternalReference(ExternalReference( | 753 __ TailCallExternalReference( |
| 754 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1); | 754 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), |
| 755 masm->isolate()), |
| 756 2, |
| 757 1); |
| 755 | 758 |
| 756 __ bind(&slow); | 759 __ bind(&slow); |
| 757 GenerateMiss(masm); | 760 GenerateMiss(masm); |
| 758 } | 761 } |
| 759 | 762 |
| 760 | 763 |
| 761 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 764 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 762 StrictModeFlag strict_mode) { | 765 StrictModeFlag strict_mode) { |
| 763 // ----------- S t a t e ------------- | 766 // ----------- S t a t e ------------- |
| 764 // -- rax : value | 767 // -- rax : value |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 // Enter an internal frame. | 1002 // Enter an internal frame. |
| 1000 __ EnterInternalFrame(); | 1003 __ EnterInternalFrame(); |
| 1001 | 1004 |
| 1002 // Push the receiver and the name of the function. | 1005 // Push the receiver and the name of the function. |
| 1003 __ push(rdx); | 1006 __ push(rdx); |
| 1004 __ push(rcx); | 1007 __ push(rcx); |
| 1005 | 1008 |
| 1006 // Call the entry. | 1009 // Call the entry. |
| 1007 CEntryStub stub(1); | 1010 CEntryStub stub(1); |
| 1008 __ movq(rax, Immediate(2)); | 1011 __ movq(rax, Immediate(2)); |
| 1009 __ movq(rbx, ExternalReference(IC_Utility(id))); | 1012 __ movq(rbx, ExternalReference(IC_Utility(id), masm->isolate())); |
| 1010 __ CallStub(&stub); | 1013 __ CallStub(&stub); |
| 1011 | 1014 |
| 1012 // Move result to rdi and exit the internal frame. | 1015 // Move result to rdi and exit the internal frame. |
| 1013 __ movq(rdi, rax); | 1016 __ movq(rdi, rax); |
| 1014 __ LeaveInternalFrame(); | 1017 __ LeaveInternalFrame(); |
| 1015 | 1018 |
| 1016 // Check if the receiver is a global object of some sort. | 1019 // Check if the receiver is a global object of some sort. |
| 1017 // This can happen only for regular CallIC but not KeyedCallIC. | 1020 // This can happen only for regular CallIC but not KeyedCallIC. |
| 1018 if (id == IC::kCallIC_Miss) { | 1021 if (id == IC::kCallIC_Miss) { |
| 1019 Label invoke, global; | 1022 Label invoke, global; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 // ----------------------------------- | 1280 // ----------------------------------- |
| 1278 | 1281 |
| 1279 __ IncrementCounter(COUNTERS->load_miss(), 1); | 1282 __ IncrementCounter(COUNTERS->load_miss(), 1); |
| 1280 | 1283 |
| 1281 __ pop(rbx); | 1284 __ pop(rbx); |
| 1282 __ push(rax); // receiver | 1285 __ push(rax); // receiver |
| 1283 __ push(rcx); // name | 1286 __ push(rcx); // name |
| 1284 __ push(rbx); // return address | 1287 __ push(rbx); // return address |
| 1285 | 1288 |
| 1286 // Perform tail call to the entry. | 1289 // Perform tail call to the entry. |
| 1287 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss)); | 1290 ExternalReference ref = |
| 1291 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
| 1288 __ TailCallExternalReference(ref, 2, 1); | 1292 __ TailCallExternalReference(ref, 2, 1); |
| 1289 } | 1293 } |
| 1290 | 1294 |
| 1291 | 1295 |
| 1292 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { | 1296 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { |
| 1293 if (V8::UseCrankshaft()) return false; | 1297 if (V8::UseCrankshaft()) return false; |
| 1294 | 1298 |
| 1295 // The address of the instruction following the call. | 1299 // The address of the instruction following the call. |
| 1296 Address test_instruction_address = | 1300 Address test_instruction_address = |
| 1297 address + Assembler::kCallTargetAddressOffset; | 1301 address + Assembler::kCallTargetAddressOffset; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 // ----------------------------------- | 1425 // ----------------------------------- |
| 1422 | 1426 |
| 1423 __ IncrementCounter(COUNTERS->keyed_load_miss(), 1); | 1427 __ IncrementCounter(COUNTERS->keyed_load_miss(), 1); |
| 1424 | 1428 |
| 1425 __ pop(rbx); | 1429 __ pop(rbx); |
| 1426 __ push(rdx); // receiver | 1430 __ push(rdx); // receiver |
| 1427 __ push(rax); // name | 1431 __ push(rax); // name |
| 1428 __ push(rbx); // return address | 1432 __ push(rbx); // return address |
| 1429 | 1433 |
| 1430 // Perform tail call to the entry. | 1434 // Perform tail call to the entry. |
| 1431 ExternalReference ref = ExternalReference(IC_Utility(kKeyedLoadIC_Miss)); | 1435 ExternalReference ref |
| 1436 = ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
| 1432 __ TailCallExternalReference(ref, 2, 1); | 1437 __ TailCallExternalReference(ref, 2, 1); |
| 1433 } | 1438 } |
| 1434 | 1439 |
| 1435 | 1440 |
| 1436 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1441 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 1437 // ----------- S t a t e ------------- | 1442 // ----------- S t a t e ------------- |
| 1438 // -- rax : key | 1443 // -- rax : key |
| 1439 // -- rdx : receiver | 1444 // -- rdx : receiver |
| 1440 // -- rsp[0] : return address | 1445 // -- rsp[0] : return address |
| 1441 // ----------------------------------- | 1446 // ----------------------------------- |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 // -- rsp[0] : return address | 1485 // -- rsp[0] : return address |
| 1481 // ----------------------------------- | 1486 // ----------------------------------- |
| 1482 | 1487 |
| 1483 __ pop(rbx); | 1488 __ pop(rbx); |
| 1484 __ push(rdx); // receiver | 1489 __ push(rdx); // receiver |
| 1485 __ push(rcx); // name | 1490 __ push(rcx); // name |
| 1486 __ push(rax); // value | 1491 __ push(rax); // value |
| 1487 __ push(rbx); // return address | 1492 __ push(rbx); // return address |
| 1488 | 1493 |
| 1489 // Perform tail call to the entry. | 1494 // Perform tail call to the entry. |
| 1490 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_Miss)); | 1495 ExternalReference ref = |
| 1496 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate()); |
| 1491 __ TailCallExternalReference(ref, 3, 1); | 1497 __ TailCallExternalReference(ref, 3, 1); |
| 1492 } | 1498 } |
| 1493 | 1499 |
| 1494 | 1500 |
| 1495 // The offset from the inlined patch site to the start of the inlined | 1501 // The offset from the inlined patch site to the start of the inlined |
| 1496 // store instruction. | 1502 // store instruction. |
| 1497 const int StoreIC::kOffsetToStoreInstruction = 20; | 1503 const int StoreIC::kOffsetToStoreInstruction = 20; |
| 1498 | 1504 |
| 1499 | 1505 |
| 1500 void StoreIC::GenerateArrayLength(MacroAssembler* masm) { | 1506 void StoreIC::GenerateArrayLength(MacroAssembler* masm) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 | 1539 |
| 1534 // Check that value is a smi. | 1540 // Check that value is a smi. |
| 1535 __ JumpIfNotSmi(value, &miss); | 1541 __ JumpIfNotSmi(value, &miss); |
| 1536 | 1542 |
| 1537 // Prepare tail call to StoreIC_ArrayLength. | 1543 // Prepare tail call to StoreIC_ArrayLength. |
| 1538 __ pop(scratch); | 1544 __ pop(scratch); |
| 1539 __ push(receiver); | 1545 __ push(receiver); |
| 1540 __ push(value); | 1546 __ push(value); |
| 1541 __ push(scratch); // return address | 1547 __ push(scratch); // return address |
| 1542 | 1548 |
| 1543 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_ArrayLength)); | 1549 ExternalReference ref = |
| 1550 ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate()); |
| 1544 __ TailCallExternalReference(ref, 2, 1); | 1551 __ TailCallExternalReference(ref, 2, 1); |
| 1545 | 1552 |
| 1546 __ bind(&miss); | 1553 __ bind(&miss); |
| 1547 | 1554 |
| 1548 GenerateMiss(masm); | 1555 GenerateMiss(masm); |
| 1549 } | 1556 } |
| 1550 | 1557 |
| 1551 | 1558 |
| 1552 void StoreIC::GenerateNormal(MacroAssembler* masm) { | 1559 void StoreIC::GenerateNormal(MacroAssembler* masm) { |
| 1553 // ----------- S t a t e ------------- | 1560 // ----------- S t a t e ------------- |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 // -- rsp[0] : return address | 1629 // -- rsp[0] : return address |
| 1623 // ----------------------------------- | 1630 // ----------------------------------- |
| 1624 | 1631 |
| 1625 __ pop(rbx); | 1632 __ pop(rbx); |
| 1626 __ push(rdx); // receiver | 1633 __ push(rdx); // receiver |
| 1627 __ push(rcx); // key | 1634 __ push(rcx); // key |
| 1628 __ push(rax); // value | 1635 __ push(rax); // value |
| 1629 __ push(rbx); // return address | 1636 __ push(rbx); // return address |
| 1630 | 1637 |
| 1631 // Do tail-call to runtime routine. | 1638 // Do tail-call to runtime routine. |
| 1632 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 1639 ExternalReference ref = |
| 1640 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
| 1633 __ TailCallExternalReference(ref, 3, 1); | 1641 __ TailCallExternalReference(ref, 3, 1); |
| 1634 } | 1642 } |
| 1635 | 1643 |
| 1636 | 1644 |
| 1637 #undef __ | 1645 #undef __ |
| 1638 | 1646 |
| 1639 | 1647 |
| 1640 Condition CompareIC::ComputeCondition(Token::Value op) { | 1648 Condition CompareIC::ComputeCondition(Token::Value op) { |
| 1641 switch (op) { | 1649 switch (op) { |
| 1642 case Token::EQ_STRICT: | 1650 case Token::EQ_STRICT: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1737 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1730 ? not_zero | 1738 ? not_zero |
| 1731 : zero; | 1739 : zero; |
| 1732 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1740 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1733 } | 1741 } |
| 1734 | 1742 |
| 1735 | 1743 |
| 1736 } } // namespace v8::internal | 1744 } } // namespace v8::internal |
| 1737 | 1745 |
| 1738 #endif // V8_TARGET_ARCH_X64 | 1746 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |