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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 &miss, // When not a number. | 640 &miss, // When not a number. |
641 &miss, // When index out of range. | 641 &miss, // When index out of range. |
642 STRING_INDEX_IS_ARRAY_INDEX); | 642 STRING_INDEX_IS_ARRAY_INDEX); |
643 char_at_generator.GenerateFast(masm); | 643 char_at_generator.GenerateFast(masm); |
644 __ ret(0); | 644 __ ret(0); |
645 | 645 |
646 StubRuntimeCallHelper call_helper; | 646 StubRuntimeCallHelper call_helper; |
647 char_at_generator.GenerateSlow(masm, call_helper); | 647 char_at_generator.GenerateSlow(masm, call_helper); |
648 | 648 |
649 __ bind(&miss); | 649 __ bind(&miss); |
650 GenerateMiss(masm, false); | 650 GenerateMiss(masm, MISS); |
651 } | 651 } |
652 | 652 |
653 | 653 |
654 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { | 654 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
655 // ----------- S t a t e ------------- | 655 // ----------- S t a t e ------------- |
656 // -- ecx : key | 656 // -- ecx : key |
657 // -- edx : receiver | 657 // -- edx : receiver |
658 // -- esp[0] : return address | 658 // -- esp[0] : return address |
659 // ----------------------------------- | 659 // ----------------------------------- |
660 Label slow; | 660 Label slow; |
(...skipping 21 matching lines...) Expand all Loading... |
682 __ push(ecx); // key | 682 __ push(ecx); // key |
683 __ push(eax); // return address | 683 __ push(eax); // return address |
684 | 684 |
685 // Perform tail call to the entry. | 685 // Perform tail call to the entry. |
686 ExternalReference ref = | 686 ExternalReference ref = |
687 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), | 687 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), |
688 masm->isolate()); | 688 masm->isolate()); |
689 __ TailCallExternalReference(ref, 2, 1); | 689 __ TailCallExternalReference(ref, 2, 1); |
690 | 690 |
691 __ bind(&slow); | 691 __ bind(&slow); |
692 GenerateMiss(masm, false); | 692 GenerateMiss(masm, MISS); |
693 } | 693 } |
694 | 694 |
695 | 695 |
696 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 696 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
697 // ----------- S t a t e ------------- | 697 // ----------- S t a t e ------------- |
698 // -- ecx : key | 698 // -- ecx : key |
699 // -- edx : receiver | 699 // -- edx : receiver |
700 // -- esp[0] : return address | 700 // -- esp[0] : return address |
701 // ----------------------------------- | 701 // ----------------------------------- |
702 Label slow, notin; | 702 Label slow, notin; |
703 Factory* factory = masm->isolate()->factory(); | 703 Factory* factory = masm->isolate()->factory(); |
704 Operand mapped_location = | 704 Operand mapped_location = |
705 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, eax, ¬in, &slow); | 705 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, eax, ¬in, &slow); |
706 __ mov(eax, mapped_location); | 706 __ mov(eax, mapped_location); |
707 __ Ret(); | 707 __ Ret(); |
708 __ bind(¬in); | 708 __ bind(¬in); |
709 // The unmapped lookup expects that the parameter map is in ebx. | 709 // The unmapped lookup expects that the parameter map is in ebx. |
710 Operand unmapped_location = | 710 Operand unmapped_location = |
711 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, eax, &slow); | 711 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, eax, &slow); |
712 __ cmp(unmapped_location, factory->the_hole_value()); | 712 __ cmp(unmapped_location, factory->the_hole_value()); |
713 __ j(equal, &slow); | 713 __ j(equal, &slow); |
714 __ mov(eax, unmapped_location); | 714 __ mov(eax, unmapped_location); |
715 __ Ret(); | 715 __ Ret(); |
716 __ bind(&slow); | 716 __ bind(&slow); |
717 GenerateMiss(masm, false); | 717 GenerateMiss(masm, MISS); |
718 } | 718 } |
719 | 719 |
720 | 720 |
721 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 721 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
722 // ----------- S t a t e ------------- | 722 // ----------- S t a t e ------------- |
723 // -- eax : value | 723 // -- eax : value |
724 // -- ecx : key | 724 // -- ecx : key |
725 // -- edx : receiver | 725 // -- edx : receiver |
726 // -- esp[0] : return address | 726 // -- esp[0] : return address |
727 // ----------------------------------- | 727 // ----------------------------------- |
728 Label slow, notin; | 728 Label slow, notin; |
729 Operand mapped_location = | 729 Operand mapped_location = |
730 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, edi, ¬in, &slow); | 730 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, edi, ¬in, &slow); |
731 __ mov(mapped_location, eax); | 731 __ mov(mapped_location, eax); |
732 __ lea(ecx, mapped_location); | 732 __ lea(ecx, mapped_location); |
733 __ mov(edx, eax); | 733 __ mov(edx, eax); |
734 __ RecordWrite(ebx, ecx, edx, kDontSaveFPRegs); | 734 __ RecordWrite(ebx, ecx, edx, kDontSaveFPRegs); |
735 __ Ret(); | 735 __ Ret(); |
736 __ bind(¬in); | 736 __ bind(¬in); |
737 // The unmapped lookup expects that the parameter map is in ebx. | 737 // The unmapped lookup expects that the parameter map is in ebx. |
738 Operand unmapped_location = | 738 Operand unmapped_location = |
739 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, edi, &slow); | 739 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, edi, &slow); |
740 __ mov(unmapped_location, eax); | 740 __ mov(unmapped_location, eax); |
741 __ lea(edi, unmapped_location); | 741 __ lea(edi, unmapped_location); |
742 __ mov(edx, eax); | 742 __ mov(edx, eax); |
743 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); | 743 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); |
744 __ Ret(); | 744 __ Ret(); |
745 __ bind(&slow); | 745 __ bind(&slow); |
746 GenerateMiss(masm, false); | 746 GenerateMiss(masm, MISS); |
747 } | 747 } |
748 | 748 |
749 | 749 |
750 static void KeyedStoreGenerateGenericHelper( | 750 static void KeyedStoreGenerateGenericHelper( |
751 MacroAssembler* masm, | 751 MacroAssembler* masm, |
752 Label* fast_object, | 752 Label* fast_object, |
753 Label* fast_double, | 753 Label* fast_double, |
754 Label* slow, | 754 Label* slow, |
755 KeyedStoreCheckMap check_map, | 755 KeyedStoreCheckMap check_map, |
756 KeyedStoreIncrementLength increment_length) { | 756 KeyedStoreIncrementLength increment_length) { |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 __ push(ecx); // name | 1378 __ push(ecx); // name |
1379 __ push(ebx); // return address | 1379 __ push(ebx); // return address |
1380 | 1380 |
1381 // Perform tail call to the entry. | 1381 // Perform tail call to the entry. |
1382 ExternalReference ref = | 1382 ExternalReference ref = |
1383 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); | 1383 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
1384 __ TailCallExternalReference(ref, 2, 1); | 1384 __ TailCallExternalReference(ref, 2, 1); |
1385 } | 1385 } |
1386 | 1386 |
1387 | 1387 |
1388 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) { | 1388 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { |
1389 // ----------- S t a t e ------------- | 1389 // ----------- S t a t e ------------- |
1390 // -- ecx : key | 1390 // -- ecx : key |
1391 // -- edx : receiver | 1391 // -- edx : receiver |
1392 // -- esp[0] : return address | 1392 // -- esp[0] : return address |
1393 // ----------------------------------- | 1393 // ----------------------------------- |
1394 | 1394 |
1395 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); | 1395 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); |
1396 | 1396 |
1397 __ pop(ebx); | 1397 __ pop(ebx); |
1398 __ push(edx); // receiver | 1398 __ push(edx); // receiver |
1399 __ push(ecx); // name | 1399 __ push(ecx); // name |
1400 __ push(ebx); // return address | 1400 __ push(ebx); // return address |
1401 | 1401 |
1402 // Perform tail call to the entry. | 1402 // Perform tail call to the entry. |
1403 ExternalReference ref = force_generic | 1403 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC |
1404 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), | 1404 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), |
1405 masm->isolate()) | 1405 masm->isolate()) |
1406 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); | 1406 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
1407 __ TailCallExternalReference(ref, 2, 1); | 1407 __ TailCallExternalReference(ref, 2, 1); |
1408 } | 1408 } |
1409 | 1409 |
1410 | 1410 |
1411 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1411 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
1412 // ----------- S t a t e ------------- | 1412 // ----------- S t a t e ------------- |
1413 // -- ecx : key | 1413 // -- ecx : key |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 __ push(eax); | 1591 __ push(eax); |
1592 __ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes | 1592 __ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes |
1593 __ push(Immediate(Smi::FromInt(strict_mode))); // Strict mode. | 1593 __ push(Immediate(Smi::FromInt(strict_mode))); // Strict mode. |
1594 __ push(ebx); // return address | 1594 __ push(ebx); // return address |
1595 | 1595 |
1596 // Do tail-call to runtime routine. | 1596 // Do tail-call to runtime routine. |
1597 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 1597 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
1598 } | 1598 } |
1599 | 1599 |
1600 | 1600 |
1601 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) { | 1601 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { |
1602 // ----------- S t a t e ------------- | 1602 // ----------- S t a t e ------------- |
1603 // -- eax : value | 1603 // -- eax : value |
1604 // -- ecx : key | 1604 // -- ecx : key |
1605 // -- edx : receiver | 1605 // -- edx : receiver |
1606 // -- esp[0] : return address | 1606 // -- esp[0] : return address |
1607 // ----------------------------------- | 1607 // ----------------------------------- |
1608 | 1608 |
1609 __ pop(ebx); | 1609 __ pop(ebx); |
1610 __ push(edx); | 1610 __ push(edx); |
1611 __ push(ecx); | 1611 __ push(ecx); |
1612 __ push(eax); | 1612 __ push(eax); |
1613 __ push(ebx); | 1613 __ push(ebx); |
1614 | 1614 |
1615 // Do tail-call to runtime routine. | 1615 // Do tail-call to runtime routine. |
1616 ExternalReference ref = force_generic | 1616 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC |
1617 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), | 1617 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), |
1618 masm->isolate()) | 1618 masm->isolate()) |
1619 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | 1619 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
1620 __ TailCallExternalReference(ref, 3, 1); | 1620 __ TailCallExternalReference(ref, 3, 1); |
1621 } | 1621 } |
1622 | 1622 |
1623 | 1623 |
1624 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { | 1624 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { |
1625 // ----------- S t a t e ------------- | 1625 // ----------- S t a t e ------------- |
1626 // -- eax : value | 1626 // -- eax : value |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1759 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
1760 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1760 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1761 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1761 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1762 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1762 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1763 } | 1763 } |
1764 | 1764 |
1765 | 1765 |
1766 } } // namespace v8::internal | 1766 } } // namespace v8::internal |
1767 | 1767 |
1768 #endif // V8_TARGET_ARCH_IA32 | 1768 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |