| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 __ SmiUntag(scratch, key); | 424 __ SmiUntag(scratch, key); |
| 425 return MemOperand(backing_store, scratch, LSL, kPointerSizeLog2); | 425 return MemOperand(backing_store, scratch, LSL, kPointerSizeLog2); |
| 426 } | 426 } |
| 427 | 427 |
| 428 | 428 |
| 429 Object* CallIC_Miss(Arguments args); | 429 Object* CallIC_Miss(Arguments args); |
| 430 | 430 |
| 431 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, | 431 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, |
| 432 int argc, | 432 int argc, |
| 433 Code::Kind kind, | 433 Code::Kind kind, |
| 434 Code::ExtraICState extra_state) { | 434 ExtraICState extra_state) { |
| 435 // ----------- S t a t e ------------- | 435 // ----------- S t a t e ------------- |
| 436 // -- x1 : receiver | 436 // -- x1 : receiver |
| 437 // -- x2 : name | 437 // -- x2 : name |
| 438 // ----------------------------------- | 438 // ----------------------------------- |
| 439 Register receiver = x1; | 439 Register receiver = x1; |
| 440 Register name = x2; | 440 Register name = x2; |
| 441 | 441 |
| 442 Label number, non_number, non_string, boolean, probe, miss; | 442 Label number, non_number, non_string, boolean, probe, miss; |
| 443 | 443 |
| 444 // Probe the stub cache. | 444 // Probe the stub cache. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 GenerateFunctionTailCall(masm, argc, &miss, function, x4); | 533 GenerateFunctionTailCall(masm, argc, &miss, function, x4); |
| 534 | 534 |
| 535 __ Bind(&miss); | 535 __ Bind(&miss); |
| 536 // Fall-through on miss. | 536 // Fall-through on miss. |
| 537 } | 537 } |
| 538 | 538 |
| 539 | 539 |
| 540 void CallICBase::GenerateMiss(MacroAssembler* masm, | 540 void CallICBase::GenerateMiss(MacroAssembler* masm, |
| 541 int argc, | 541 int argc, |
| 542 IC::UtilityId id, | 542 IC::UtilityId id, |
| 543 Code::ExtraICState extra_state) { | 543 ExtraICState extra_state) { |
| 544 // ----------- S t a t e ------------- | 544 // ----------- S t a t e ------------- |
| 545 // -- x2 : name | 545 // -- x2 : name |
| 546 // -- lr : return address | 546 // -- lr : return address |
| 547 // ----------------------------------- | 547 // ----------------------------------- |
| 548 Isolate* isolate = masm->isolate(); | 548 Isolate* isolate = masm->isolate(); |
| 549 | 549 |
| 550 if (id == IC::kCallIC_Miss) { | 550 if (id == IC::kCallIC_Miss) { |
| 551 __ IncrementCounter(isolate->counters()->call_miss(), 1, x3, x4); | 551 __ IncrementCounter(isolate->counters()->call_miss(), 1, x3, x4); |
| 552 } else { | 552 } else { |
| 553 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, x3, x4); | 553 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, x3, x4); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 __ InvokeFunction(x1, | 598 __ InvokeFunction(x1, |
| 599 actual, | 599 actual, |
| 600 JUMP_FUNCTION, | 600 JUMP_FUNCTION, |
| 601 NullCallWrapper(), | 601 NullCallWrapper(), |
| 602 call_kind); | 602 call_kind); |
| 603 } | 603 } |
| 604 | 604 |
| 605 | 605 |
| 606 void CallIC::GenerateMegamorphic(MacroAssembler* masm, | 606 void CallIC::GenerateMegamorphic(MacroAssembler* masm, |
| 607 int argc, | 607 int argc, |
| 608 Code::ExtraICState extra_ic_state) { | 608 ExtraICState extra_ic_state) { |
| 609 // ----------- S t a t e ------------- | 609 // ----------- S t a t e ------------- |
| 610 // -- x2 : name | 610 // -- x2 : name |
| 611 // -- lr : return address | 611 // -- lr : return address |
| 612 // ----------------------------------- | 612 // ----------------------------------- |
| 613 | 613 |
| 614 // Get the receiver of the function from the stack. | 614 // Get the receiver of the function from the stack. |
| 615 // GenerateMonomorphicCacheProbe expects the receiver to be in x1. | 615 // GenerateMonomorphicCacheProbe expects the receiver to be in x1. |
| 616 Register receiver = x1; | 616 Register receiver = x1; |
| 617 __ Peek(receiver, argc * kXRegSizeInBytes); | 617 __ Peek(receiver, argc * kXRegSizeInBytes); |
| 618 | 618 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 // Live values: | 737 // Live values: |
| 738 // x1: receiver | 738 // x1: receiver |
| 739 // x2: key | 739 // x2: key |
| 740 // These assignments are expected by GenerateMonomorphicCacheProbe. | 740 // These assignments are expected by GenerateMonomorphicCacheProbe. |
| 741 __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1, x10, x11); | 741 __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1, x10, x11); |
| 742 ASSERT(receiver.Is(x1)); | 742 ASSERT(receiver.Is(x1)); |
| 743 ASSERT(key.Is(x2)); | 743 ASSERT(key.Is(x2)); |
| 744 GenerateMonomorphicCacheProbe(masm, | 744 GenerateMonomorphicCacheProbe(masm, |
| 745 argc, | 745 argc, |
| 746 Code::KEYED_CALL_IC, | 746 Code::KEYED_CALL_IC, |
| 747 Code::kNoExtraICState); | 747 kNoExtraICState); |
| 748 // Fall through on miss. | 748 // Fall through on miss. |
| 749 | 749 |
| 750 __ Bind(&slow_call); | 750 __ Bind(&slow_call); |
| 751 // This branch is taken if: | 751 // This branch is taken if: |
| 752 // - the receiver requires boxing or access check, | 752 // - the receiver requires boxing or access check, |
| 753 // - the key is neither smi nor a unique name, | 753 // - the key is neither smi nor a unique name, |
| 754 // - the value loaded is not a function, | 754 // - the value loaded is not a function, |
| 755 // - there is hope that the runtime will create a monomorphic call stub | 755 // - there is hope that the runtime will create a monomorphic call stub |
| 756 // that will get fetched next time. | 756 // that will get fetched next time. |
| 757 __ IncrementCounter(counters->keyed_call_generic_slow(), 1, x10, x11); | 757 __ IncrementCounter(counters->keyed_call_generic_slow(), 1, x10, x11); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 789 |
| 790 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 790 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
| 791 // ----------- S t a t e ------------- | 791 // ----------- S t a t e ------------- |
| 792 // -- x2 : name | 792 // -- x2 : name |
| 793 // -- lr : return address | 793 // -- lr : return address |
| 794 // -- x0 : receiver | 794 // -- x0 : receiver |
| 795 // ----------------------------------- | 795 // ----------------------------------- |
| 796 | 796 |
| 797 // Probe the stub cache. | 797 // Probe the stub cache. |
| 798 Code::Flags flags = Code::ComputeFlags( | 798 Code::Flags flags = Code::ComputeFlags( |
| 799 Code::HANDLER, MONOMORPHIC, Code::kNoExtraICState, | 799 Code::HANDLER, MONOMORPHIC, kNoExtraICState, |
| 800 Code::NORMAL, Code::LOAD_IC); | 800 Code::NORMAL, Code::LOAD_IC); |
| 801 masm->isolate()->stub_cache()->GenerateProbe( | 801 masm->isolate()->stub_cache()->GenerateProbe( |
| 802 masm, flags, x0, x2, x3, x4, x5, x6); | 802 masm, flags, x0, x2, x3, x4, x5, x6); |
| 803 | 803 |
| 804 // Cache miss: Jump to runtime. | 804 // Cache miss: Jump to runtime. |
| 805 GenerateMiss(masm); | 805 GenerateMiss(masm); |
| 806 } | 806 } |
| 807 | 807 |
| 808 | 808 |
| 809 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 809 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1772 // function which is requesting this patch operation. | 1772 // function which is requesting this patch operation. |
| 1773 Address info_address = | 1773 Address info_address = |
| 1774 Assembler::return_address_from_call_start(address); | 1774 Assembler::return_address_from_call_start(address); |
| 1775 InlineSmiCheckInfo info(info_address); | 1775 InlineSmiCheckInfo info(info_address); |
| 1776 | 1776 |
| 1777 // Check and decode the patch information instruction. | 1777 // Check and decode the patch information instruction. |
| 1778 if (!info.HasSmiCheck()) { | 1778 if (!info.HasSmiCheck()) { |
| 1779 return; | 1779 return; |
| 1780 } | 1780 } |
| 1781 | 1781 |
| 1782 #ifdef DEBUG | |
| 1783 if (FLAG_trace_ic) { | 1782 if (FLAG_trace_ic) { |
| 1784 PrintF("[ Patching ic at %p, marker=%p, SMI check=%p\n", | 1783 PrintF("[ Patching ic at %p, marker=%p, SMI check=%p\n", |
| 1785 address, info_address, reinterpret_cast<void*>(info.SmiCheck())); | 1784 address, info_address, reinterpret_cast<void*>(info.SmiCheck())); |
| 1786 } | 1785 } |
| 1787 #endif | |
| 1788 | 1786 |
| 1789 // Patch and activate code generated by JumpPatchSite::EmitJumpIfNotSmi() | 1787 // Patch and activate code generated by JumpPatchSite::EmitJumpIfNotSmi() |
| 1790 // and JumpPatchSite::EmitJumpIfSmi(). | 1788 // and JumpPatchSite::EmitJumpIfSmi(). |
| 1791 // Changing | 1789 // Changing |
| 1792 // tb(n)z xzr, #0, <target> | 1790 // tb(n)z xzr, #0, <target> |
| 1793 // to | 1791 // to |
| 1794 // tb(!n)z test_reg, #0, <target> | 1792 // tb(!n)z test_reg, #0, <target> |
| 1795 Instruction* to_patch = info.SmiCheck(); | 1793 Instruction* to_patch = info.SmiCheck(); |
| 1796 PatchingAssembler patcher(to_patch, 1); | 1794 PatchingAssembler patcher(to_patch, 1); |
| 1797 ASSERT(to_patch->IsTestBranch()); | 1795 ASSERT(to_patch->IsTestBranch()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1819 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ); | 1817 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ); |
| 1820 // This is JumpIfSmi(smi_reg, branch_imm). | 1818 // This is JumpIfSmi(smi_reg, branch_imm). |
| 1821 patcher.tbz(smi_reg, 0, branch_imm); | 1819 patcher.tbz(smi_reg, 0, branch_imm); |
| 1822 } | 1820 } |
| 1823 } | 1821 } |
| 1824 | 1822 |
| 1825 | 1823 |
| 1826 } } // namespace v8::internal | 1824 } } // namespace v8::internal |
| 1827 | 1825 |
| 1828 #endif // V8_TARGET_ARCH_A64 | 1826 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |