Changeset 131552 in webkit for trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
- Timestamp:
- Oct 16, 2012, 11:22:17 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r131516 r131552 55 55 const tagTypeNumber = csr1 56 56 const tagMask = csr2 57 58 macro loadisFromInstruction(offset, dest)59 loadis offset * 8[PB, PC, 8], dest60 end61 62 macro loadpFromInstruction(offset, dest)63 loadp offset * 8[PB, PC, 8], dest64 end65 66 macro storepToInstruction(value, offset)67 storep value, offset * 8[PB, PC, 8]68 end69 70 57 else 71 58 const PC = t4 72 macro loadisFromInstruction(offset, dest)73 loadis offset * 4[PC], dest74 end75 76 macro loadpFromInstruction(offset, dest)77 loadp offset * 4[PC], dest78 end79 59 end 80 60 … … 120 100 # Copied from PropertyOffset.h 121 101 const firstOutOfLineOffset = 100 122 123 # From ResolveOperations.h124 const ResolveOperationFail = 0125 const ResolveOperationSetBaseToUndefined = 1126 const ResolveOperationReturnScopeAsBase = 2127 const ResolveOperationSetBaseToScope = 3128 const ResolveOperationSetBaseToGlobal = 4129 const ResolveOperationGetAndReturnScopedVar = 5130 const ResolveOperationGetAndReturnGlobalVar = 6131 const ResolveOperationGetAndReturnGlobalVarWatchable = 7132 const ResolveOperationSkipTopScopeNode = 8133 const ResolveOperationSkipScopes = 9134 const ResolveOperationReturnGlobalObjectAsBase = 10135 const ResolveOperationGetAndReturnGlobalProperty = 11136 const ResolveOperationCheckForDynamicEntriesBeforeGlobalScope = 12137 138 const PutToBaseOperationKindUninitialised = 0139 const PutToBaseOperationKindGeneric = 1140 const PutToBaseOperationKindReadonly = 2141 const PutToBaseOperationKindGlobalVariablePut = 3142 const PutToBaseOperationKindGlobalVariablePutChecked = 4143 const PutToBaseOperationKindGlobalPropertyPut = 5144 const PutToBaseOperationKindVariablePut = 6145 102 146 103 # Allocation constants … … 537 494 dispatch(4) 538 495 539 macro getPutToBaseOperationField(scratch, scratch1, fieldOffset, fieldGetter) 540 loadisFromInstruction(4, scratch) 541 mulp sizeof PutToBaseOperation, scratch, scratch 542 loadp CodeBlock[cfr], scratch1 543 loadp VectorBufferOffset + CodeBlock::m_putToBaseOperations[scratch1], scratch1 544 fieldGetter(fieldOffset[scratch1, scratch, 1]) 545 end 546 547 macro moveJSValueFromRegisterWithoutProfiling(value, destBuffer, destOffsetReg) 548 storep value, [destBuffer, destOffsetReg, 8] 549 end 550 551 552 macro moveJSValueFromRegistersWithoutProfiling(tag, payload, destBuffer, destOffsetReg) 553 storep tag, TagOffset[destBuffer, destOffsetReg, 8] 554 storep payload, PayloadOffset[destBuffer, destOffsetReg, 8] 555 end 556 557 macro putToBaseVariableBody(variableOffset, scratch1, scratch2, scratch3) 558 loadisFromInstruction(1, scratch1) 559 loadp PayloadOffset[cfr, scratch1, 8], scratch1 560 loadp JSVariableObject::m_registers[scratch1], scratch1 561 loadisFromInstruction(3, scratch2) 562 if JSVALUE64 563 loadConstantOrVariable(scratch2, scratch3) 564 moveJSValueFromRegisterWithoutProfiling(scratch3, scratch1, variableOffset) 565 else 566 loadConstantOrVariable(scratch2, scratch3, scratch2) # scratch3=tag, scratch2=payload 567 moveJSValueFromRegistersWithoutProfiling(scratch3, scratch2, scratch1, variableOffset) 568 end 569 end 570 571 _llint_op_put_to_base_variable: 572 traceExecution() 573 getPutToBaseOperationField(t0, t1, PutToBaseOperation::m_offset, macro(addr) 574 loadis addr, t0 575 end) 576 putToBaseVariableBody(t0, t1, t2, t3) 496 497 _llint_op_resolve: 498 traceExecution() 499 callSlowPath(_llint_slow_path_resolve) 500 dispatch(4) 501 502 503 _llint_op_resolve_skip: 504 traceExecution() 505 callSlowPath(_llint_slow_path_resolve_skip) 577 506 dispatch(5) 578 507 579 _llint_op_put_to_base: 580 traceExecution() 581 getPutToBaseOperationField(t0, t1, 0, macro(addr) 582 leap addr, t0 583 bbneq PutToBaseOperation::m_kindAsUint8[t0], PutToBaseOperationKindVariablePut, .notPutToBaseVariable 584 loadis PutToBaseOperation::m_offset[t0], t0 585 putToBaseVariableBody(t0, t1, t2, t3) 586 dispatch(5) 587 .notPutToBaseVariable: 588 end) 589 callSlowPath(_llint_slow_path_put_to_base) 508 509 _llint_op_resolve_base: 510 traceExecution() 511 callSlowPath(_llint_slow_path_resolve_base) 590 512 dispatch(5) 591 513 592 macro getResolveOperation(resolveOperationIndex, dest, scratch)593 loadisFromInstruction(resolveOperationIndex, dest)594 mulp sizeof ResolveOperations, dest, dest595 loadp CodeBlock[cfr], scratch596 loadp VectorBufferOffset + CodeBlock::m_resolveOperations[scratch], scratch597 loadp VectorBufferOffset[scratch, dest, 1], dest598 end599 600 macro getScope(loadInitialScope, scopeCount, dest, scratch)601 loadInitialScope(dest)602 loadi scopeCount, scratch603 604 btiz scratch, .done605 .loop:606 loadp JSScope::m_next[dest], dest607 subi 1, scratch608 btinz scratch, .loop609 610 .done:611 end612 613 macro moveJSValue(sourceBuffer, sourceOffsetReg, destBuffer, destOffsetReg, profileOffset, scratchRegister)614 if JSVALUE64615 loadp [sourceBuffer, sourceOffsetReg, 8], scratchRegister616 storep scratchRegister, [destBuffer, destOffsetReg, 8]617 loadpFromInstruction(profileOffset, destOffsetReg)618 valueProfile(scratchRegister, destOffsetReg)619 else620 loadp PayloadOffset[sourceBuffer, sourceOffsetReg, 8], scratchRegister621 storep scratchRegister, PayloadOffset[destBuffer, destOffsetReg, 8]622 loadp TagOffset[sourceBuffer, sourceOffsetReg, 8], sourceOffsetReg623 storep sourceOffsetReg, TagOffset[destBuffer, destOffsetReg, 8]624 loadpFromInstruction(profileOffset, destOffsetReg)625 valueProfile(sourceOffsetReg, scratchRegister, destOffsetReg)626 end627 end628 629 macro moveJSValueFromSlot(slot, destBuffer, destOffsetReg, profileOffset, scratchRegister)630 if JSVALUE64631 loadp [slot], scratchRegister632 storep scratchRegister, [destBuffer, destOffsetReg, 8]633 loadpFromInstruction(profileOffset, destOffsetReg)634 valueProfile(scratchRegister, destOffsetReg)635 else636 loadp PayloadOffset[slot], scratchRegister637 storep scratchRegister, PayloadOffset[destBuffer, destOffsetReg, 8]638 loadp TagOffset[slot], slot639 storep slot, TagOffset[destBuffer, destOffsetReg, 8]640 loadpFromInstruction(profileOffset, destOffsetReg)641 valueProfile(slot, scratchRegister, destOffsetReg)642 end643 end644 645 macro moveJSValueFromRegister(value, destBuffer, destOffsetReg, profileOffset)646 storep value, [destBuffer, destOffsetReg, 8]647 loadpFromInstruction(profileOffset, destOffsetReg)648 valueProfile(value, destOffsetReg)649 end650 651 macro moveJSValueFromRegisters(tag, payload, destBuffer, destOffsetReg, profileOffset)652 storep tag, TagOffset[destBuffer, destOffsetReg, 8]653 storep payload, PayloadOffset[destBuffer, destOffsetReg, 8]654 loadpFromInstruction(profileOffset, destOffsetReg)655 valueProfile(tag, payload, destOffsetReg)656 end657 658 _llint_op_resolve_global_property:659 traceExecution()660 getResolveOperation(3, t0, t1)661 loadp CodeBlock[cfr], t1662 loadp CodeBlock::m_globalObject[t1], t1663 loadp ResolveOperation::m_structure[t0], t2664 bpneq JSCell::m_structure[t1], t2, _llint_op_resolve665 loadis ResolveOperation::m_offset[t0], t0666 if JSVALUE64667 loadPropertyAtVariableOffsetKnownNotInline(t0, t1, t2)668 loadisFromInstruction(1, t0)669 moveJSValueFromRegister(t2, cfr, t0, 4)670 else671 loadPropertyAtVariableOffsetKnownNotInline(t0, t1, t2, t3)672 loadisFromInstruction(1, t0)673 moveJSValueFromRegisters(t2, t3, cfr, t0, 4)674 end675 dispatch(5)676 677 _llint_op_resolve_global_var:678 traceExecution()679 getResolveOperation(3, t0, t1)680 loadp ResolveOperation::m_registerAddress[t0], t0681 loadisFromInstruction(1, t1)682 moveJSValueFromSlot(t0, cfr, t1, 4, t3)683 dispatch(5)684 685 macro resolveScopedVarBody(resolveOperations)686 # First ResolveOperation is to skip scope chain nodes687 getScope(macro(dest)688 loadp ScopeChain + PayloadOffset[cfr], dest689 end,690 ResolveOperation::m_scopesToSkip[resolveOperations], t1, t2)691 loadp JSVariableObject::m_registers[t1], t1 # t1 now contains the activation registers692 693 # Second ResolveOperation tells us what offset to use694 loadis ResolveOperation::m_offset + sizeof ResolveOperation[resolveOperations], t2695 loadisFromInstruction(1, t3)696 moveJSValue(t1, t2, cfr, t3, 4, t0)697 end698 699 _llint_op_resolve_scoped_var:700 traceExecution()701 getResolveOperation(3, t0, t1)702 resolveScopedVarBody(t0)703 dispatch(5)704 705 _llint_op_resolve_scoped_var_on_top_scope:706 traceExecution()707 getResolveOperation(3, t0, t1)708 709 # Load destination index710 loadisFromInstruction(1, t3)711 712 # We know we want the top scope chain entry713 loadp ScopeChain + PayloadOffset[cfr], t1714 loadp JSVariableObject::m_registers[t1], t1 # t1 now contains the activation registers715 716 # Second ResolveOperation tells us what offset to use717 loadis ResolveOperation::m_offset + sizeof ResolveOperation[t0], t2718 719 moveJSValue(t1, t2, cfr, t3, 4, t0)720 dispatch(5)721 722 _llint_op_resolve_scoped_var_with_top_scope_check:723 traceExecution()724 getResolveOperation(3, t0, t1)725 # First ResolveOperation tells us what register to check726 loadis ResolveOperation::m_activationRegister[t0], t1727 728 loadp PayloadOffset[cfr, t1, 8], t1729 730 getScope(macro(dest)731 btpz t1, .scopeChainNotCreated732 loadp JSScope::m_next[t1], dest733 jmp .done734 .scopeChainNotCreated:735 loadp ScopeChain + PayloadOffset[cfr], dest736 .done:737 end,738 # Second ResolveOperation tells us how many more nodes to skip739 ResolveOperation::m_scopesToSkip + sizeof ResolveOperation[t0], t1, t2)740 loadp JSVariableObject::m_registers[t1], t1 # t1 now contains the activation registers741 742 # Third operation tells us what offset to use743 loadis ResolveOperation::m_offset + 2 * sizeof ResolveOperation[t0], t2744 loadisFromInstruction(1, t3)745 moveJSValue(t1, t2, cfr, t3, 4, t0)746 dispatch(5)747 748 _llint_op_resolve:749 traceExecution()750 getResolveOperation(3, t0, t1)751 btpz t0, .noInstructions752 loadis ResolveOperation::m_operation[t0], t1753 bineq t1, ResolveOperationSkipScopes, .notSkipScopes754 resolveScopedVarBody(t0)755 dispatch(5)756 .notSkipScopes:757 bineq t1, ResolveOperationGetAndReturnGlobalVar, .notGetAndReturnGlobalVar758 loadp ResolveOperation::m_registerAddress[t0], t0759 loadisFromInstruction(1, t1)760 moveJSValueFromSlot(t0, cfr, t1, 4, t3)761 dispatch(5)762 .notGetAndReturnGlobalVar:763 764 .noInstructions:765 callSlowPath(_llint_slow_path_resolve)766 dispatch(5)767 768 _llint_op_resolve_base_to_global:769 traceExecution()770 loadp CodeBlock[cfr], t1771 loadp CodeBlock::m_globalObject[t1], t1772 loadisFromInstruction(1, t3)773 if JSVALUE64774 moveJSValueFromRegister(t1, cfr, t3, 6)775 else776 move CellTag, t2777 moveJSValueFromRegisters(t2, t1, cfr, t3, 6)778 end779 dispatch(7)780 781 _llint_op_resolve_base_to_global_dynamic:782 jmp _llint_op_resolve_base783 784 _llint_op_resolve_base_to_scope:785 traceExecution()786 getResolveOperation(4, t0, t1)787 # First ResolveOperation is to skip scope chain nodes788 getScope(macro(dest)789 loadp ScopeChain + PayloadOffset[cfr], dest790 end,791 ResolveOperation::m_scopesToSkip[t0], t1, t2)792 loadisFromInstruction(1, t3)793 if JSVALUE64794 moveJSValueFromRegister(t1, cfr, t3, 6)795 else796 move CellTag, t2797 moveJSValueFromRegisters(t2, t1, cfr, t3, 6)798 end799 dispatch(7)800 801 _llint_op_resolve_base_to_scope_with_top_scope_check:802 traceExecution()803 getResolveOperation(4, t0, t1)804 # First ResolveOperation tells us what register to check805 loadis ResolveOperation::m_activationRegister[t0], t1806 807 loadp PayloadOffset[cfr, t1, 8], t1808 809 getScope(macro(dest)810 btpz t1, .scopeChainNotCreated811 loadp JSScope::m_next[t1], dest812 jmp .done813 .scopeChainNotCreated:814 loadp ScopeChain + PayloadOffset[cfr], dest815 .done:816 end,817 # Second ResolveOperation tells us how many more nodes to skip818 ResolveOperation::m_scopesToSkip + sizeof ResolveOperation[t0], t1, t2)819 820 loadisFromInstruction(1, t3)821 if JSVALUE64822 moveJSValueFromRegister(t1, cfr, t3, 6)823 else824 move CellTag, t2825 moveJSValueFromRegisters(t2, t1, cfr, t3, 6)826 end827 dispatch(7)828 829 _llint_op_resolve_base:830 traceExecution()831 callSlowPath(_llint_slow_path_resolve_base)832 dispatch(7)833 514 834 515 _llint_op_ensure_property_exists: … … 837 518 dispatch(3) 838 519 839 macro interpretResolveWithBase(opcodeLength, slowPath)840 traceExecution()841 getResolveOperation(4, t0, t1)842 btpz t0, .slowPath843 844 loadp ScopeChain[cfr], t3845 # Get the base846 loadis ResolveOperation::m_operation[t0], t2847 848 bineq t2, ResolveOperationSkipScopes, .notSkipScopes849 getScope(macro(dest) move t3, dest end,850 ResolveOperation::m_scopesToSkip[t0], t1, t2)851 move t1, t3852 addp sizeof ResolveOperation, t0, t0853 jmp .haveCorrectScope854 855 .notSkipScopes:856 857 bineq t2, ResolveOperationSkipTopScopeNode, .notSkipTopScopeNode858 loadis ResolveOperation::m_activationRegister[t0], t1859 loadp PayloadOffset[cfr, t1, 8], t1860 861 getScope(macro(dest)862 btpz t1, .scopeChainNotCreated863 loadp JSScope::m_next[t1], dest864 jmp .done865 .scopeChainNotCreated:866 loadp ScopeChain + PayloadOffset[cfr], dest867 .done:868 end,869 sizeof ResolveOperation + ResolveOperation::m_scopesToSkip[t0], t1, t2)870 move t1, t3871 # We've handled two opcodes here872 addp 2 * sizeof ResolveOperation, t0, t0873 874 .notSkipTopScopeNode:875 876 .haveCorrectScope:877 878 # t3 now contains the correct Scope879 # t0 contains a pointer to the current ResolveOperation880 881 loadis ResolveOperation::m_operation[t0], t2882 # t2 contains the next instruction883 884 loadisFromInstruction(1, t1)885 # t1 now contains the index for the base register886 887 bineq t2, ResolveOperationSetBaseToScope, .notSetBaseToScope888 storep t3, PayloadOffset[cfr, t1, 8]889 if JSVALUE64890 else891 storep CellTag, TagOffset[cfr, t1, 8]892 end893 jmp .haveSetBase894 895 .notSetBaseToScope:896 897 bineq t2, ResolveOperationSetBaseToUndefined, .notSetBaseToUndefined898 if JSVALUE64899 storep ValueUndefined, PayloadOffset[cfr, t1, 8]900 else901 storep 0, PayloadOffset[cfr, t1, 8]902 storep UndefinedTag, TagOffset[cfr, t1, 8]903 end904 jmp .haveSetBase905 906 .notSetBaseToUndefined:907 bineq t2, ResolveOperationSetBaseToGlobal, .slowPath908 loadp JSCell::m_structure[t3], t2909 loadp Structure::m_globalObject[t2], t2910 storep t2, PayloadOffset[cfr, t1, 8]911 if JSVALUE64912 else913 storep CellTag, TagOffset[cfr, t1, 8]914 end915 916 .haveSetBase:917 918 # Get the value919 920 # Load the operation into t2921 loadis ResolveOperation::m_operation + sizeof ResolveOperation[t0], t2922 923 # Load the index for the value register into t1924 loadisFromInstruction(2, t1)925 926 bineq t2, ResolveOperationGetAndReturnScopedVar, .notGetAndReturnScopedVar927 loadp JSVariableObject::m_registers[t3], t3 # t3 now contains the activation registers928 929 # Second ResolveOperation tells us what offset to use930 loadis ResolveOperation::m_offset + sizeof ResolveOperation[t0], t2931 moveJSValue(t3, t2, cfr, t1, opcodeLength - 1, t0)932 dispatch(opcodeLength)933 934 .notGetAndReturnScopedVar:935 bineq t2, ResolveOperationGetAndReturnGlobalProperty, .slowPath936 callSlowPath(slowPath)937 dispatch(opcodeLength)938 939 .slowPath:940 callSlowPath(slowPath)941 dispatch(opcodeLength)942 end943 520 944 521 _llint_op_resolve_with_base: 945 interpretResolveWithBase(7, _llint_slow_path_resolve_with_base) 522 traceExecution() 523 callSlowPath(_llint_slow_path_resolve_with_base) 524 dispatch(5) 946 525 947 526 948 527 _llint_op_resolve_with_this: 949 interpretResolveWithBase(6, _llint_slow_path_resolve_with_this) 528 traceExecution() 529 callSlowPath(_llint_slow_path_resolve_with_this) 530 dispatch(5) 950 531 951 532
Note:
See TracChangeset
for help on using the changeset viewer.