| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 rax, | 573 rax, |
| 574 rcx, | 574 rcx, |
| 575 rbx, | 575 rbx, |
| 576 rax, | 576 rax, |
| 577 NULL, | 577 NULL, |
| 578 &slow); | 578 &slow); |
| 579 __ IncrementCounter(COUNTERS->keyed_load_generic_smi(), 1); | 579 __ IncrementCounter(COUNTERS->keyed_load_generic_smi(), 1); |
| 580 __ ret(0); | 580 __ ret(0); |
| 581 | 581 |
| 582 __ bind(&check_pixel_array); | 582 __ bind(&check_pixel_array); |
| 583 // Check whether the elements object is a pixel array. | 583 GenerateFastPixelArrayLoad(masm, |
| 584 // rdx: receiver | 584 rdx, |
| 585 // rax: key | 585 rax, |
| 586 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); | 586 rcx, |
| 587 __ SmiToInteger32(rbx, rax); // Used on both directions of next branch. | 587 rbx, |
| 588 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), | 588 rax, |
| 589 Heap::kPixelArrayMapRootIndex); | 589 &check_number_dictionary, |
| 590 __ j(not_equal, &check_number_dictionary); | 590 NULL, |
| 591 __ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset)); | 591 &slow); |
| 592 __ j(above_equal, &slow); | |
| 593 __ movq(rax, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); | |
| 594 __ movzxbq(rax, Operand(rax, rbx, times_1, 0)); | |
| 595 __ Integer32ToSmi(rax, rax); | |
| 596 __ ret(0); | |
| 597 | 592 |
| 598 __ bind(&check_number_dictionary); | 593 __ bind(&check_number_dictionary); |
| 599 // Check whether the elements is a number dictionary. | 594 // Check whether the elements is a number dictionary. |
| 600 // rdx: receiver | 595 // rdx: receiver |
| 601 // rax: key | 596 // rax: key |
| 602 // rbx: key as untagged int32 | 597 // rbx: key as untagged int32 |
| 603 // rcx: elements | 598 // rcx: elements |
| 604 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), | 599 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
| 605 Heap::kHashTableMapRootIndex); | 600 Heap::kHashTableMapRootIndex); |
| 606 __ j(not_equal, &slow); | 601 __ j(not_equal, &slow); |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 return greater_equal; | 1670 return greater_equal; |
| 1676 case Token::GTE: | 1671 case Token::GTE: |
| 1677 return greater_equal; | 1672 return greater_equal; |
| 1678 default: | 1673 default: |
| 1679 UNREACHABLE(); | 1674 UNREACHABLE(); |
| 1680 return no_condition; | 1675 return no_condition; |
| 1681 } | 1676 } |
| 1682 } | 1677 } |
| 1683 | 1678 |
| 1684 | 1679 |
| 1680 static bool HasInlinedSmiCode(Address address) { |
| 1681 // The address of the instruction following the call. |
| 1682 Address test_instruction_address = |
| 1683 address + Assembler::kCallTargetAddressOffset; |
| 1684 |
| 1685 // If the instruction following the call is not a test al, nothing |
| 1686 // was inlined. |
| 1687 return *test_instruction_address == Assembler::kTestAlByte; |
| 1688 } |
| 1689 |
| 1690 |
| 1685 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { | 1691 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { |
| 1686 HandleScope scope; | 1692 HandleScope scope; |
| 1687 Handle<Code> rewritten; | 1693 Handle<Code> rewritten; |
| 1688 State previous_state = GetState(); | 1694 State previous_state = GetState(); |
| 1689 State state = TargetState(previous_state, false, x, y); | 1695 |
| 1696 State state = TargetState(previous_state, HasInlinedSmiCode(address()), x, y); |
| 1690 if (state == GENERIC) { | 1697 if (state == GENERIC) { |
| 1691 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); | 1698 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); |
| 1692 rewritten = stub.GetCode(); | 1699 rewritten = stub.GetCode(); |
| 1693 } else { | 1700 } else { |
| 1694 ICCompareStub stub(op_, state); | 1701 ICCompareStub stub(op_, state); |
| 1695 rewritten = stub.GetCode(); | 1702 rewritten = stub.GetCode(); |
| 1696 } | 1703 } |
| 1697 set_target(*rewritten); | 1704 set_target(*rewritten); |
| 1698 | 1705 |
| 1699 #ifdef DEBUG | 1706 #ifdef DEBUG |
| 1700 if (FLAG_trace_ic) { | 1707 if (FLAG_trace_ic) { |
| 1701 PrintF("[CompareIC (%s->%s)#%s]\n", | 1708 PrintF("[CompareIC (%s->%s)#%s]\n", |
| 1702 GetStateName(previous_state), | 1709 GetStateName(previous_state), |
| 1703 GetStateName(state), | 1710 GetStateName(state), |
| 1704 Token::Name(op_)); | 1711 Token::Name(op_)); |
| 1705 } | 1712 } |
| 1706 #endif | 1713 #endif |
| 1707 } | 1714 } |
| 1708 | 1715 |
| 1709 void PatchInlinedSmiCode(Address address) { | 1716 void PatchInlinedSmiCode(Address address) { |
| 1710 UNIMPLEMENTED(); | 1717 // Disabled, then patched inline smi code is not implemented on X64. |
| 1718 // So we do nothing in this case. |
| 1711 } | 1719 } |
| 1712 | 1720 |
| 1713 | 1721 |
| 1714 } } // namespace v8::internal | 1722 } } // namespace v8::internal |
| 1715 | 1723 |
| 1716 #endif // V8_TARGET_ARCH_X64 | 1724 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |