| 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 614 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 __ cmp(Operand(ecx), Immediate(1 << Map::kHasIndexedInterceptor)); | 738 __ cmp(Operand(ecx), Immediate(1 << Map::kHasIndexedInterceptor)); |
| 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 = |
| 749 IC_Utility(kKeyedLoadPropertyWithInterceptor)); | 749 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), |
| 750 masm->isolate()); |
| 750 __ TailCallExternalReference(ref, 2, 1); | 751 __ TailCallExternalReference(ref, 2, 1); |
| 751 | 752 |
| 752 __ bind(&slow); | 753 __ bind(&slow); |
| 753 GenerateMiss(masm); | 754 GenerateMiss(masm); |
| 754 } | 755 } |
| 755 | 756 |
| 756 | 757 |
| 757 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 758 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 758 StrictModeFlag strict_mode) { | 759 StrictModeFlag strict_mode) { |
| 759 // ----------- S t a t e ------------- | 760 // ----------- S t a t e ------------- |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 // Enter an internal frame. | 979 // Enter an internal frame. |
| 979 __ EnterInternalFrame(); | 980 __ EnterInternalFrame(); |
| 980 | 981 |
| 981 // Push the receiver and the name of the function. | 982 // Push the receiver and the name of the function. |
| 982 __ push(edx); | 983 __ push(edx); |
| 983 __ push(ecx); | 984 __ push(ecx); |
| 984 | 985 |
| 985 // Call the entry. | 986 // Call the entry. |
| 986 CEntryStub stub(1); | 987 CEntryStub stub(1); |
| 987 __ mov(eax, Immediate(2)); | 988 __ mov(eax, Immediate(2)); |
| 988 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id)))); | 989 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id), masm->isolate()))); |
| 989 __ CallStub(&stub); | 990 __ CallStub(&stub); |
| 990 | 991 |
| 991 // Move result to edi and exit the internal frame. | 992 // Move result to edi and exit the internal frame. |
| 992 __ mov(edi, eax); | 993 __ mov(edi, eax); |
| 993 __ LeaveInternalFrame(); | 994 __ LeaveInternalFrame(); |
| 994 | 995 |
| 995 // Check if the receiver is a global object of some sort. | 996 // Check if the receiver is a global object of some sort. |
| 996 // This can happen only for regular CallIC but not KeyedCallIC. | 997 // This can happen only for regular CallIC but not KeyedCallIC. |
| 997 if (id == IC::kCallIC_Miss) { | 998 if (id == IC::kCallIC_Miss) { |
| 998 Label invoke, global; | 999 Label invoke, global; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 // ----------------------------------- | 1252 // ----------------------------------- |
| 1252 | 1253 |
| 1253 __ IncrementCounter(COUNTERS->load_miss(), 1); | 1254 __ IncrementCounter(COUNTERS->load_miss(), 1); |
| 1254 | 1255 |
| 1255 __ pop(ebx); | 1256 __ pop(ebx); |
| 1256 __ push(eax); // receiver | 1257 __ push(eax); // receiver |
| 1257 __ push(ecx); // name | 1258 __ push(ecx); // name |
| 1258 __ push(ebx); // return address | 1259 __ push(ebx); // return address |
| 1259 | 1260 |
| 1260 // Perform tail call to the entry. | 1261 // Perform tail call to the entry. |
| 1261 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss)); | 1262 ExternalReference ref = |
| 1263 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
| 1262 __ TailCallExternalReference(ref, 2, 1); | 1264 __ TailCallExternalReference(ref, 2, 1); |
| 1263 } | 1265 } |
| 1264 | 1266 |
| 1265 | 1267 |
| 1266 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { | 1268 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { |
| 1267 if (V8::UseCrankshaft()) return false; | 1269 if (V8::UseCrankshaft()) return false; |
| 1268 | 1270 |
| 1269 // The address of the instruction following the call. | 1271 // The address of the instruction following the call. |
| 1270 Address test_instruction_address = | 1272 Address test_instruction_address = |
| 1271 address + Assembler::kCallTargetAddressOffset; | 1273 address + Assembler::kCallTargetAddressOffset; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 // ----------------------------------- | 1439 // ----------------------------------- |
| 1438 | 1440 |
| 1439 __ IncrementCounter(COUNTERS->keyed_load_miss(), 1); | 1441 __ IncrementCounter(COUNTERS->keyed_load_miss(), 1); |
| 1440 | 1442 |
| 1441 __ pop(ebx); | 1443 __ pop(ebx); |
| 1442 __ push(edx); // receiver | 1444 __ push(edx); // receiver |
| 1443 __ push(eax); // name | 1445 __ push(eax); // name |
| 1444 __ push(ebx); // return address | 1446 __ push(ebx); // return address |
| 1445 | 1447 |
| 1446 // Perform tail call to the entry. | 1448 // Perform tail call to the entry. |
| 1447 ExternalReference ref = ExternalReference(IC_Utility(kKeyedLoadIC_Miss)); | 1449 ExternalReference ref = |
| 1450 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
| 1448 __ TailCallExternalReference(ref, 2, 1); | 1451 __ TailCallExternalReference(ref, 2, 1); |
| 1449 } | 1452 } |
| 1450 | 1453 |
| 1451 | 1454 |
| 1452 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1455 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 1453 // ----------- S t a t e ------------- | 1456 // ----------- S t a t e ------------- |
| 1454 // -- eax : key | 1457 // -- eax : key |
| 1455 // -- edx : receiver | 1458 // -- edx : receiver |
| 1456 // -- esp[0] : return address | 1459 // -- esp[0] : return address |
| 1457 // ----------------------------------- | 1460 // ----------------------------------- |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 // -- esp[0] : return address | 1498 // -- esp[0] : return address |
| 1496 // ----------------------------------- | 1499 // ----------------------------------- |
| 1497 | 1500 |
| 1498 __ pop(ebx); | 1501 __ pop(ebx); |
| 1499 __ push(edx); | 1502 __ push(edx); |
| 1500 __ push(ecx); | 1503 __ push(ecx); |
| 1501 __ push(eax); | 1504 __ push(eax); |
| 1502 __ push(ebx); | 1505 __ push(ebx); |
| 1503 | 1506 |
| 1504 // Perform tail call to the entry. | 1507 // Perform tail call to the entry. |
| 1505 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_Miss)); | 1508 ExternalReference ref = |
| 1509 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate()); |
| 1506 __ TailCallExternalReference(ref, 3, 1); | 1510 __ TailCallExternalReference(ref, 3, 1); |
| 1507 } | 1511 } |
| 1508 | 1512 |
| 1509 | 1513 |
| 1510 // The offset from the inlined patch site to the start of the inlined | 1514 // 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 | 1515 // store instruction. It is 7 bytes (test reg, imm) plus 6 bytes (jne |
| 1512 // slow_label). | 1516 // slow_label). |
| 1513 const int StoreIC::kOffsetToStoreInstruction = 13; | 1517 const int StoreIC::kOffsetToStoreInstruction = 13; |
| 1514 | 1518 |
| 1515 | 1519 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 // Check that value is a smi. | 1554 // Check that value is a smi. |
| 1551 __ test(value, Immediate(kSmiTagMask)); | 1555 __ test(value, Immediate(kSmiTagMask)); |
| 1552 __ j(not_zero, &miss, not_taken); | 1556 __ j(not_zero, &miss, not_taken); |
| 1553 | 1557 |
| 1554 // Prepare tail call to StoreIC_ArrayLength. | 1558 // Prepare tail call to StoreIC_ArrayLength. |
| 1555 __ pop(scratch); | 1559 __ pop(scratch); |
| 1556 __ push(receiver); | 1560 __ push(receiver); |
| 1557 __ push(value); | 1561 __ push(value); |
| 1558 __ push(scratch); // return address | 1562 __ push(scratch); // return address |
| 1559 | 1563 |
| 1560 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_ArrayLength)); | 1564 ExternalReference ref = |
| 1565 ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate()); |
| 1561 __ TailCallExternalReference(ref, 2, 1); | 1566 __ TailCallExternalReference(ref, 2, 1); |
| 1562 | 1567 |
| 1563 __ bind(&miss); | 1568 __ bind(&miss); |
| 1564 | 1569 |
| 1565 GenerateMiss(masm); | 1570 GenerateMiss(masm); |
| 1566 } | 1571 } |
| 1567 | 1572 |
| 1568 | 1573 |
| 1569 void StoreIC::GenerateNormal(MacroAssembler* masm) { | 1574 void StoreIC::GenerateNormal(MacroAssembler* masm) { |
| 1570 // ----------- S t a t e ------------- | 1575 // ----------- S t a t e ------------- |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 // -- esp[0] : return address | 1652 // -- esp[0] : return address |
| 1648 // ----------------------------------- | 1653 // ----------------------------------- |
| 1649 | 1654 |
| 1650 __ pop(ebx); | 1655 __ pop(ebx); |
| 1651 __ push(edx); | 1656 __ push(edx); |
| 1652 __ push(ecx); | 1657 __ push(ecx); |
| 1653 __ push(eax); | 1658 __ push(eax); |
| 1654 __ push(ebx); | 1659 __ push(ebx); |
| 1655 | 1660 |
| 1656 // Do tail-call to runtime routine. | 1661 // Do tail-call to runtime routine. |
| 1657 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 1662 ExternalReference ref = |
| 1663 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
| 1658 __ TailCallExternalReference(ref, 3, 1); | 1664 __ TailCallExternalReference(ref, 3, 1); |
| 1659 } | 1665 } |
| 1660 | 1666 |
| 1661 | 1667 |
| 1662 #undef __ | 1668 #undef __ |
| 1663 | 1669 |
| 1664 | 1670 |
| 1665 Condition CompareIC::ComputeCondition(Token::Value op) { | 1671 Condition CompareIC::ComputeCondition(Token::Value op) { |
| 1666 switch (op) { | 1672 switch (op) { |
| 1667 case Token::EQ_STRICT: | 1673 case Token::EQ_STRICT: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1761 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1756 ? not_zero | 1762 ? not_zero |
| 1757 : zero; | 1763 : zero; |
| 1758 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1764 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1759 } | 1765 } |
| 1760 | 1766 |
| 1761 | 1767 |
| 1762 } } // namespace v8::internal | 1768 } } // namespace v8::internal |
| 1763 | 1769 |
| 1764 #endif // V8_TARGET_ARCH_IA32 | 1770 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |