| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 __ mov(ecx, ebx); | 615 __ mov(ecx, ebx); |
| 616 __ shr(ecx, KeyedLookupCache::kMapHashShift); | 616 __ shr(ecx, KeyedLookupCache::kMapHashShift); |
| 617 __ mov(edi, FieldOperand(eax, String::kHashFieldOffset)); | 617 __ mov(edi, FieldOperand(eax, String::kHashFieldOffset)); |
| 618 __ shr(edi, String::kHashShift); | 618 __ shr(edi, String::kHashShift); |
| 619 __ xor_(ecx, Operand(edi)); | 619 __ xor_(ecx, Operand(edi)); |
| 620 __ and_(ecx, KeyedLookupCache::kCapacityMask); | 620 __ and_(ecx, KeyedLookupCache::kCapacityMask); |
| 621 | 621 |
| 622 // Load the key (consisting of map and symbol) from the cache and | 622 // Load the key (consisting of map and symbol) from the cache and |
| 623 // check for match. | 623 // check for match. |
| 624 ExternalReference cache_keys | 624 ExternalReference cache_keys |
| 625 = ExternalReference::keyed_lookup_cache_keys(); | 625 = ExternalReference::keyed_lookup_cache_keys(masm->isolate()); |
| 626 __ mov(edi, ecx); | 626 __ mov(edi, ecx); |
| 627 __ shl(edi, kPointerSizeLog2 + 1); | 627 __ shl(edi, kPointerSizeLog2 + 1); |
| 628 __ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys)); | 628 __ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys)); |
| 629 __ j(not_equal, &slow); | 629 __ j(not_equal, &slow); |
| 630 __ add(Operand(edi), Immediate(kPointerSize)); | 630 __ add(Operand(edi), Immediate(kPointerSize)); |
| 631 __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys)); | 631 __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys)); |
| 632 __ j(not_equal, &slow); | 632 __ j(not_equal, &slow); |
| 633 | 633 |
| 634 // Get field offset. | 634 // Get field offset. |
| 635 // edx : receiver | 635 // edx : receiver |
| 636 // ebx : receiver's map | 636 // ebx : receiver's map |
| 637 // eax : key | 637 // eax : key |
| 638 // ecx : lookup cache index | 638 // ecx : lookup cache index |
| 639 ExternalReference cache_field_offsets | 639 ExternalReference cache_field_offsets |
| 640 = ExternalReference::keyed_lookup_cache_field_offsets(); | 640 = ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate()); |
| 641 __ mov(edi, | 641 __ mov(edi, |
| 642 Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets)); | 642 Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets)); |
| 643 __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset)); | 643 __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset)); |
| 644 __ sub(edi, Operand(ecx)); | 644 __ sub(edi, Operand(ecx)); |
| 645 __ j(above_equal, &property_array_property); | 645 __ j(above_equal, &property_array_property); |
| 646 | 646 |
| 647 // Load in-object property. | 647 // Load in-object property. |
| 648 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); | 648 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); |
| 649 __ add(ecx, Operand(edi)); | 649 __ add(ecx, Operand(edi)); |
| 650 __ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0)); | 650 __ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 __ j(not_zero, &slow, not_taken); | 739 __ j(not_zero, &slow, not_taken); |
| 740 | 740 |
| 741 // Everything is fine, call runtime. | 741 // Everything is fine, call runtime. |
| 742 __ pop(ecx); | 742 __ pop(ecx); |
| 743 __ push(edx); // receiver | 743 __ push(edx); // receiver |
| 744 __ push(eax); // key | 744 __ push(eax); // key |
| 745 __ push(ecx); // return address | 745 __ push(ecx); // return address |
| 746 | 746 |
| 747 // Perform tail call to the entry. | 747 // Perform tail call to the entry. |
| 748 ExternalReference ref = ExternalReference( | 748 ExternalReference ref = ExternalReference( |
| 749 IC_Utility(kKeyedLoadPropertyWithInterceptor)); | 749 IC_Utility(kKeyedLoadPropertyWithInterceptor), masm->isolate()); |
| 750 __ TailCallExternalReference(ref, 2, 1); | 750 __ TailCallExternalReference(ref, 2, 1); |
| 751 | 751 |
| 752 __ bind(&slow); | 752 __ bind(&slow); |
| 753 GenerateMiss(masm); | 753 GenerateMiss(masm); |
| 754 } | 754 } |
| 755 | 755 |
| 756 | 756 |
| 757 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 757 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 758 StrictModeFlag strict_mode) { | 758 StrictModeFlag strict_mode) { |
| 759 // ----------- S t a t e ------------- | 759 // ----------- S t a t e ------------- |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 // Enter an internal frame. | 978 // Enter an internal frame. |
| 979 __ EnterInternalFrame(); | 979 __ EnterInternalFrame(); |
| 980 | 980 |
| 981 // Push the receiver and the name of the function. | 981 // Push the receiver and the name of the function. |
| 982 __ push(edx); | 982 __ push(edx); |
| 983 __ push(ecx); | 983 __ push(ecx); |
| 984 | 984 |
| 985 // Call the entry. | 985 // Call the entry. |
| 986 CEntryStub stub(1); | 986 CEntryStub stub(1); |
| 987 __ mov(eax, Immediate(2)); | 987 __ mov(eax, Immediate(2)); |
| 988 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id)))); | 988 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id), masm->isolate()))); |
| 989 __ CallStub(&stub); | 989 __ CallStub(&stub); |
| 990 | 990 |
| 991 // Move result to edi and exit the internal frame. | 991 // Move result to edi and exit the internal frame. |
| 992 __ mov(edi, eax); | 992 __ mov(edi, eax); |
| 993 __ LeaveInternalFrame(); | 993 __ LeaveInternalFrame(); |
| 994 | 994 |
| 995 // Check if the receiver is a global object of some sort. | 995 // Check if the receiver is a global object of some sort. |
| 996 // This can happen only for regular CallIC but not KeyedCallIC. | 996 // This can happen only for regular CallIC but not KeyedCallIC. |
| 997 if (id == IC::kCallIC_Miss) { | 997 if (id == IC::kCallIC_Miss) { |
| 998 Label invoke, global; | 998 Label invoke, global; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 // ----------------------------------- | 1251 // ----------------------------------- |
| 1252 | 1252 |
| 1253 __ IncrementCounter(COUNTERS->load_miss(), 1); | 1253 __ IncrementCounter(COUNTERS->load_miss(), 1); |
| 1254 | 1254 |
| 1255 __ pop(ebx); | 1255 __ pop(ebx); |
| 1256 __ push(eax); // receiver | 1256 __ push(eax); // receiver |
| 1257 __ push(ecx); // name | 1257 __ push(ecx); // name |
| 1258 __ push(ebx); // return address | 1258 __ push(ebx); // return address |
| 1259 | 1259 |
| 1260 // Perform tail call to the entry. | 1260 // Perform tail call to the entry. |
| 1261 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss)); | 1261 ExternalReference ref |
| 1262 = ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
| 1262 __ TailCallExternalReference(ref, 2, 1); | 1263 __ TailCallExternalReference(ref, 2, 1); |
| 1263 } | 1264 } |
| 1264 | 1265 |
| 1265 | 1266 |
| 1266 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { | 1267 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { |
| 1267 if (V8::UseCrankshaft()) return false; | 1268 if (V8::UseCrankshaft()) return false; |
| 1268 | 1269 |
| 1269 // The address of the instruction following the call. | 1270 // The address of the instruction following the call. |
| 1270 Address test_instruction_address = | 1271 Address test_instruction_address = |
| 1271 address + Assembler::kCallTargetAddressOffset; | 1272 address + Assembler::kCallTargetAddressOffset; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 // ----------------------------------- | 1438 // ----------------------------------- |
| 1438 | 1439 |
| 1439 __ IncrementCounter(COUNTERS->keyed_load_miss(), 1); | 1440 __ IncrementCounter(COUNTERS->keyed_load_miss(), 1); |
| 1440 | 1441 |
| 1441 __ pop(ebx); | 1442 __ pop(ebx); |
| 1442 __ push(edx); // receiver | 1443 __ push(edx); // receiver |
| 1443 __ push(eax); // name | 1444 __ push(eax); // name |
| 1444 __ push(ebx); // return address | 1445 __ push(ebx); // return address |
| 1445 | 1446 |
| 1446 // Perform tail call to the entry. | 1447 // Perform tail call to the entry. |
| 1447 ExternalReference ref = ExternalReference(IC_Utility(kKeyedLoadIC_Miss)); | 1448 ExternalReference ref |
| 1449 = ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
| 1448 __ TailCallExternalReference(ref, 2, 1); | 1450 __ TailCallExternalReference(ref, 2, 1); |
| 1449 } | 1451 } |
| 1450 | 1452 |
| 1451 | 1453 |
| 1452 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1454 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 1453 // ----------- S t a t e ------------- | 1455 // ----------- S t a t e ------------- |
| 1454 // -- eax : key | 1456 // -- eax : key |
| 1455 // -- edx : receiver | 1457 // -- edx : receiver |
| 1456 // -- esp[0] : return address | 1458 // -- esp[0] : return address |
| 1457 // ----------------------------------- | 1459 // ----------------------------------- |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 // -- esp[0] : return address | 1497 // -- esp[0] : return address |
| 1496 // ----------------------------------- | 1498 // ----------------------------------- |
| 1497 | 1499 |
| 1498 __ pop(ebx); | 1500 __ pop(ebx); |
| 1499 __ push(edx); | 1501 __ push(edx); |
| 1500 __ push(ecx); | 1502 __ push(ecx); |
| 1501 __ push(eax); | 1503 __ push(eax); |
| 1502 __ push(ebx); | 1504 __ push(ebx); |
| 1503 | 1505 |
| 1504 // Perform tail call to the entry. | 1506 // Perform tail call to the entry. |
| 1505 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_Miss)); | 1507 ExternalReference ref |
| 1508 = ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate()); |
| 1506 __ TailCallExternalReference(ref, 3, 1); | 1509 __ TailCallExternalReference(ref, 3, 1); |
| 1507 } | 1510 } |
| 1508 | 1511 |
| 1509 | 1512 |
| 1510 // The offset from the inlined patch site to the start of the inlined | 1513 // The offset from the inlined patch site to the start of the inlined |
| 1511 // store instruction. It is 7 bytes (test reg, imm) plus 6 bytes (jne | 1514 // store instruction. It is 7 bytes (test reg, imm) plus 6 bytes (jne |
| 1512 // slow_label). | 1515 // slow_label). |
| 1513 const int StoreIC::kOffsetToStoreInstruction = 13; | 1516 const int StoreIC::kOffsetToStoreInstruction = 13; |
| 1514 | 1517 |
| 1515 | 1518 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 // Check that value is a smi. | 1553 // Check that value is a smi. |
| 1551 __ test(value, Immediate(kSmiTagMask)); | 1554 __ test(value, Immediate(kSmiTagMask)); |
| 1552 __ j(not_zero, &miss, not_taken); | 1555 __ j(not_zero, &miss, not_taken); |
| 1553 | 1556 |
| 1554 // Prepare tail call to StoreIC_ArrayLength. | 1557 // Prepare tail call to StoreIC_ArrayLength. |
| 1555 __ pop(scratch); | 1558 __ pop(scratch); |
| 1556 __ push(receiver); | 1559 __ push(receiver); |
| 1557 __ push(value); | 1560 __ push(value); |
| 1558 __ push(scratch); // return address | 1561 __ push(scratch); // return address |
| 1559 | 1562 |
| 1560 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_ArrayLength)); | 1563 ExternalReference ref |
| 1564 = ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate()); |
| 1561 __ TailCallExternalReference(ref, 2, 1); | 1565 __ TailCallExternalReference(ref, 2, 1); |
| 1562 | 1566 |
| 1563 __ bind(&miss); | 1567 __ bind(&miss); |
| 1564 | 1568 |
| 1565 GenerateMiss(masm); | 1569 GenerateMiss(masm); |
| 1566 } | 1570 } |
| 1567 | 1571 |
| 1568 | 1572 |
| 1569 void StoreIC::GenerateNormal(MacroAssembler* masm) { | 1573 void StoreIC::GenerateNormal(MacroAssembler* masm) { |
| 1570 // ----------- S t a t e ------------- | 1574 // ----------- S t a t e ------------- |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 // -- esp[0] : return address | 1651 // -- esp[0] : return address |
| 1648 // ----------------------------------- | 1652 // ----------------------------------- |
| 1649 | 1653 |
| 1650 __ pop(ebx); | 1654 __ pop(ebx); |
| 1651 __ push(edx); | 1655 __ push(edx); |
| 1652 __ push(ecx); | 1656 __ push(ecx); |
| 1653 __ push(eax); | 1657 __ push(eax); |
| 1654 __ push(ebx); | 1658 __ push(ebx); |
| 1655 | 1659 |
| 1656 // Do tail-call to runtime routine. | 1660 // Do tail-call to runtime routine. |
| 1657 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 1661 ExternalReference ref |
| 1662 = ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
| 1658 __ TailCallExternalReference(ref, 3, 1); | 1663 __ TailCallExternalReference(ref, 3, 1); |
| 1659 } | 1664 } |
| 1660 | 1665 |
| 1661 | 1666 |
| 1662 #undef __ | 1667 #undef __ |
| 1663 | 1668 |
| 1664 | 1669 |
| 1665 Condition CompareIC::ComputeCondition(Token::Value op) { | 1670 Condition CompareIC::ComputeCondition(Token::Value op) { |
| 1666 switch (op) { | 1671 switch (op) { |
| 1667 case Token::EQ_STRICT: | 1672 case Token::EQ_STRICT: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1760 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1756 ? not_zero | 1761 ? not_zero |
| 1757 : zero; | 1762 : zero; |
| 1758 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1763 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1759 } | 1764 } |
| 1760 | 1765 |
| 1761 | 1766 |
| 1762 } } // namespace v8::internal | 1767 } } // namespace v8::internal |
| 1763 | 1768 |
| 1764 #endif // V8_TARGET_ARCH_IA32 | 1769 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |