| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 &miss, // When not a number. | 604 &miss, // When not a number. |
| 605 &miss, // When index out of range. | 605 &miss, // When index out of range. |
| 606 STRING_INDEX_IS_ARRAY_INDEX); | 606 STRING_INDEX_IS_ARRAY_INDEX); |
| 607 char_at_generator.GenerateFast(masm); | 607 char_at_generator.GenerateFast(masm); |
| 608 __ ret(0); | 608 __ ret(0); |
| 609 | 609 |
| 610 StubRuntimeCallHelper call_helper; | 610 StubRuntimeCallHelper call_helper; |
| 611 char_at_generator.GenerateSlow(masm, call_helper); | 611 char_at_generator.GenerateSlow(masm, call_helper); |
| 612 | 612 |
| 613 __ bind(&miss); | 613 __ bind(&miss); |
| 614 GenerateMiss(masm, MISS); | 614 GenerateMiss(masm); |
| 615 } | 615 } |
| 616 | 616 |
| 617 | 617 |
| 618 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { | 618 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
| 619 // ----------- S t a t e ------------- | 619 // ----------- S t a t e ------------- |
| 620 // -- ecx : key | 620 // -- ecx : key |
| 621 // -- edx : receiver | 621 // -- edx : receiver |
| 622 // -- esp[0] : return address | 622 // -- esp[0] : return address |
| 623 // ----------------------------------- | 623 // ----------------------------------- |
| 624 Label slow; | 624 Label slow; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 646 __ push(ecx); // key | 646 __ push(ecx); // key |
| 647 __ push(eax); // return address | 647 __ push(eax); // return address |
| 648 | 648 |
| 649 // Perform tail call to the entry. | 649 // Perform tail call to the entry. |
| 650 ExternalReference ref = | 650 ExternalReference ref = |
| 651 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), | 651 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), |
| 652 masm->isolate()); | 652 masm->isolate()); |
| 653 __ TailCallExternalReference(ref, 2, 1); | 653 __ TailCallExternalReference(ref, 2, 1); |
| 654 | 654 |
| 655 __ bind(&slow); | 655 __ bind(&slow); |
| 656 GenerateMiss(masm, MISS); | 656 GenerateMiss(masm); |
| 657 } | 657 } |
| 658 | 658 |
| 659 | 659 |
| 660 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 660 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
| 661 // ----------- S t a t e ------------- | 661 // ----------- S t a t e ------------- |
| 662 // -- ecx : key | 662 // -- ecx : key |
| 663 // -- edx : receiver | 663 // -- edx : receiver |
| 664 // -- esp[0] : return address | 664 // -- esp[0] : return address |
| 665 // ----------------------------------- | 665 // ----------------------------------- |
| 666 Label slow, notin; | 666 Label slow, notin; |
| 667 Factory* factory = masm->isolate()->factory(); | 667 Factory* factory = masm->isolate()->factory(); |
| 668 Operand mapped_location = | 668 Operand mapped_location = |
| 669 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, eax, ¬in, &slow); | 669 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, eax, ¬in, &slow); |
| 670 __ mov(eax, mapped_location); | 670 __ mov(eax, mapped_location); |
| 671 __ Ret(); | 671 __ Ret(); |
| 672 __ bind(¬in); | 672 __ bind(¬in); |
| 673 // The unmapped lookup expects that the parameter map is in ebx. | 673 // The unmapped lookup expects that the parameter map is in ebx. |
| 674 Operand unmapped_location = | 674 Operand unmapped_location = |
| 675 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, eax, &slow); | 675 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, eax, &slow); |
| 676 __ cmp(unmapped_location, factory->the_hole_value()); | 676 __ cmp(unmapped_location, factory->the_hole_value()); |
| 677 __ j(equal, &slow); | 677 __ j(equal, &slow); |
| 678 __ mov(eax, unmapped_location); | 678 __ mov(eax, unmapped_location); |
| 679 __ Ret(); | 679 __ Ret(); |
| 680 __ bind(&slow); | 680 __ bind(&slow); |
| 681 GenerateMiss(masm, MISS); | 681 GenerateMiss(masm); |
| 682 } | 682 } |
| 683 | 683 |
| 684 | 684 |
| 685 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 685 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
| 686 // ----------- S t a t e ------------- | 686 // ----------- S t a t e ------------- |
| 687 // -- eax : value | 687 // -- eax : value |
| 688 // -- ecx : key | 688 // -- ecx : key |
| 689 // -- edx : receiver | 689 // -- edx : receiver |
| 690 // -- esp[0] : return address | 690 // -- esp[0] : return address |
| 691 // ----------------------------------- | 691 // ----------------------------------- |
| 692 Label slow, notin; | 692 Label slow, notin; |
| 693 Operand mapped_location = | 693 Operand mapped_location = |
| 694 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, edi, ¬in, &slow); | 694 GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, edi, ¬in, &slow); |
| 695 __ mov(mapped_location, eax); | 695 __ mov(mapped_location, eax); |
| 696 __ lea(ecx, mapped_location); | 696 __ lea(ecx, mapped_location); |
| 697 __ mov(edx, eax); | 697 __ mov(edx, eax); |
| 698 __ RecordWrite(ebx, ecx, edx, kDontSaveFPRegs); | 698 __ RecordWrite(ebx, ecx, edx, kDontSaveFPRegs); |
| 699 __ Ret(); | 699 __ Ret(); |
| 700 __ bind(¬in); | 700 __ bind(¬in); |
| 701 // The unmapped lookup expects that the parameter map is in ebx. | 701 // The unmapped lookup expects that the parameter map is in ebx. |
| 702 Operand unmapped_location = | 702 Operand unmapped_location = |
| 703 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, edi, &slow); | 703 GenerateUnmappedArgumentsLookup(masm, ecx, ebx, edi, &slow); |
| 704 __ mov(unmapped_location, eax); | 704 __ mov(unmapped_location, eax); |
| 705 __ lea(edi, unmapped_location); | 705 __ lea(edi, unmapped_location); |
| 706 __ mov(edx, eax); | 706 __ mov(edx, eax); |
| 707 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); | 707 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); |
| 708 __ Ret(); | 708 __ Ret(); |
| 709 __ bind(&slow); | 709 __ bind(&slow); |
| 710 GenerateMiss(masm, MISS); | 710 GenerateMiss(masm); |
| 711 } | 711 } |
| 712 | 712 |
| 713 | 713 |
| 714 static void KeyedStoreGenerateGenericHelper( | 714 static void KeyedStoreGenerateGenericHelper( |
| 715 MacroAssembler* masm, | 715 MacroAssembler* masm, |
| 716 Label* fast_object, | 716 Label* fast_object, |
| 717 Label* fast_double, | 717 Label* fast_double, |
| 718 Label* slow, | 718 Label* slow, |
| 719 KeyedStoreCheckMap check_map, | 719 KeyedStoreCheckMap check_map, |
| 720 KeyedStoreIncrementLength increment_length) { | 720 KeyedStoreIncrementLength increment_length) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 // -- esp[0] : return address | 867 // -- esp[0] : return address |
| 868 // ----------------------------------- | 868 // ----------------------------------- |
| 869 Label slow, fast_object, fast_object_grow; | 869 Label slow, fast_object, fast_object_grow; |
| 870 Label fast_double, fast_double_grow; | 870 Label fast_double, fast_double_grow; |
| 871 Label array, extra, check_if_double_array; | 871 Label array, extra, check_if_double_array; |
| 872 | 872 |
| 873 // Check that the object isn't a smi. | 873 // Check that the object isn't a smi. |
| 874 __ JumpIfSmi(edx, &slow); | 874 __ JumpIfSmi(edx, &slow); |
| 875 // Get the map from the receiver. | 875 // Get the map from the receiver. |
| 876 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 876 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
| 877 // Check that the receiver does not require access checks. We need | 877 // Check that the receiver does not require access checks and is not observed. |
| 878 // to do this because this generic stub does not perform map checks. | 878 // The generic stub does not perform map checks or handle observed objects. |
| 879 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), | 879 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), |
| 880 1 << Map::kIsAccessCheckNeeded); | 880 1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved); |
| 881 __ j(not_zero, &slow); | 881 __ j(not_zero, &slow); |
| 882 // Check that the key is a smi. | 882 // Check that the key is a smi. |
| 883 __ JumpIfNotSmi(ecx, &slow); | 883 __ JumpIfNotSmi(ecx, &slow); |
| 884 __ CmpInstanceType(edi, JS_ARRAY_TYPE); | 884 __ CmpInstanceType(edi, JS_ARRAY_TYPE); |
| 885 __ j(equal, &array); | 885 __ j(equal, &array); |
| 886 // Check that the object is some kind of JSObject. | 886 // Check that the object is some kind of JSObject. |
| 887 __ CmpInstanceType(edi, FIRST_JS_OBJECT_TYPE); | 887 __ CmpInstanceType(edi, FIRST_JS_OBJECT_TYPE); |
| 888 __ j(below, &slow); | 888 __ j(below, &slow); |
| 889 | 889 |
| 890 // Object case: Check key against length in the elements array. | 890 // Object case: Check key against length in the elements array. |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 __ pop(ebx); | 1389 __ pop(ebx); |
| 1390 __ push(edx); // receiver | 1390 __ push(edx); // receiver |
| 1391 __ push(ecx); // name | 1391 __ push(ecx); // name |
| 1392 __ push(ebx); // return address | 1392 __ push(ebx); // return address |
| 1393 | 1393 |
| 1394 // Perform tail call to the entry. | 1394 // Perform tail call to the entry. |
| 1395 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); | 1395 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 | 1398 |
| 1399 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 1399 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 1400 // ----------- S t a t e ------------- | 1400 // ----------- S t a t e ------------- |
| 1401 // -- ecx : key | 1401 // -- ecx : key |
| 1402 // -- edx : receiver | 1402 // -- edx : receiver |
| 1403 // -- esp[0] : return address | 1403 // -- esp[0] : return address |
| 1404 // ----------------------------------- | 1404 // ----------------------------------- |
| 1405 | 1405 |
| 1406 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); | 1406 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); |
| 1407 | 1407 |
| 1408 __ pop(ebx); | 1408 __ pop(ebx); |
| 1409 __ push(edx); // receiver | 1409 __ push(edx); // receiver |
| 1410 __ push(ecx); // name | 1410 __ push(ecx); // name |
| 1411 __ push(ebx); // return address | 1411 __ push(ebx); // return address |
| 1412 | 1412 |
| 1413 // Perform tail call to the entry. | 1413 // Perform tail call to the entry. |
| 1414 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 1414 ExternalReference ref = |
| 1415 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), | 1415 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
| 1416 masm->isolate()) | |
| 1417 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); | |
| 1418 __ TailCallExternalReference(ref, 2, 1); | 1416 __ TailCallExternalReference(ref, 2, 1); |
| 1419 } | 1417 } |
| 1420 | 1418 |
| 1421 | 1419 |
| 1422 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1420 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 1423 // ----------- S t a t e ------------- | 1421 // ----------- S t a t e ------------- |
| 1424 // -- ecx : key | 1422 // -- ecx : key |
| 1425 // -- edx : receiver | 1423 // -- edx : receiver |
| 1426 // -- esp[0] : return address | 1424 // -- esp[0] : return address |
| 1427 // ----------------------------------- | 1425 // ----------------------------------- |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 __ push(eax); | 1542 __ push(eax); |
| 1545 __ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes | 1543 __ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes |
| 1546 __ push(Immediate(Smi::FromInt(strict_mode))); // Strict mode. | 1544 __ push(Immediate(Smi::FromInt(strict_mode))); // Strict mode. |
| 1547 __ push(ebx); // return address | 1545 __ push(ebx); // return address |
| 1548 | 1546 |
| 1549 // Do tail-call to runtime routine. | 1547 // Do tail-call to runtime routine. |
| 1550 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 1548 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
| 1551 } | 1549 } |
| 1552 | 1550 |
| 1553 | 1551 |
| 1554 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 1552 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
| 1555 // ----------- S t a t e ------------- | 1553 // ----------- S t a t e ------------- |
| 1556 // -- eax : value | 1554 // -- eax : value |
| 1557 // -- ecx : key | 1555 // -- ecx : key |
| 1558 // -- edx : receiver | 1556 // -- edx : receiver |
| 1559 // -- esp[0] : return address | 1557 // -- esp[0] : return address |
| 1560 // ----------------------------------- | 1558 // ----------------------------------- |
| 1561 | 1559 |
| 1562 __ pop(ebx); | 1560 __ pop(ebx); |
| 1563 __ push(edx); | 1561 __ push(edx); |
| 1564 __ push(ecx); | 1562 __ push(ecx); |
| 1565 __ push(eax); | 1563 __ push(eax); |
| 1566 __ push(ebx); | 1564 __ push(ebx); |
| 1567 | 1565 |
| 1568 // Do tail-call to runtime routine. | 1566 // Do tail-call to runtime routine. |
| 1569 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 1567 ExternalReference ref = |
| 1570 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), | 1568 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
| 1571 masm->isolate()) | |
| 1572 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | |
| 1573 __ TailCallExternalReference(ref, 3, 1); | 1569 __ TailCallExternalReference(ref, 3, 1); |
| 1574 } | 1570 } |
| 1575 | 1571 |
| 1576 | 1572 |
| 1577 void StoreIC::GenerateSlow(MacroAssembler* masm) { | 1573 void StoreIC::GenerateSlow(MacroAssembler* masm) { |
| 1578 // ----------- S t a t e ------------- | 1574 // ----------- S t a t e ------------- |
| 1579 // -- eax : value | 1575 // -- eax : value |
| 1580 // -- ecx : key | 1576 // -- ecx : key |
| 1581 // -- edx : receiver | 1577 // -- edx : receiver |
| 1582 // -- esp[0] : return address | 1578 // -- esp[0] : return address |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1677 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
| 1682 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1678 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 1683 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1679 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 1684 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1680 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1685 } | 1681 } |
| 1686 | 1682 |
| 1687 | 1683 |
| 1688 } } // namespace v8::internal | 1684 } } // namespace v8::internal |
| 1689 | 1685 |
| 1690 #endif // V8_TARGET_ARCH_IA32 | 1686 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |