⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jit.h

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 H
📖 第 1 页 / 共 2 页
字号:
        static const int patchOffsetGetByIdSlowCaseCall = 21 + ctiArgumentInitSize;#endif        static const int patchOffsetOpCallCompareToJump = 6;#endif    public:        static void compile(JSGlobalData* globalData, CodeBlock* codeBlock)        {            JIT jit(globalData, codeBlock);            jit.privateCompile();        }        static void compileGetByIdSelf(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)        {            JIT jit(globalData, codeBlock);            jit.privateCompileGetByIdSelf(stubInfo, structure, cachedOffset, returnAddress);        }        static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress)        {            JIT jit(globalData, codeBlock);            jit.privateCompileGetByIdProto(stubInfo, structure, prototypeStructure, cachedOffset, returnAddress, callFrame);        }#if USE(CTI_REPATCH_PIC)        static void compileGetByIdSelfList(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, size_t cachedOffset)        {            JIT jit(globalData, codeBlock);            jit.privateCompileGetByIdSelfList(stubInfo, polymorphicStructures, currentIndex, structure, cachedOffset);        }        static void compileGetByIdProtoList(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructureList, int currentIndex, Structure* structure, Structure* prototypeStructure, size_t cachedOffset)        {            JIT jit(globalData, codeBlock);            jit.privateCompileGetByIdProtoList(stubInfo, prototypeStructureList, currentIndex, structure, prototypeStructure, cachedOffset, callFrame);        }        static void compileGetByIdChainList(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructureList, int currentIndex, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset)        {            JIT jit(globalData, codeBlock);            jit.privateCompileGetByIdChainList(stubInfo, prototypeStructureList, currentIndex, structure, chain, count, cachedOffset, callFrame);        }#endif        static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress)        {            JIT jit(globalData, codeBlock);            jit.privateCompileGetByIdChain(stubInfo, structure, chain, count, cachedOffset, returnAddress, callFrame);        }        static void compilePutByIdReplace(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)        {            JIT jit(globalData, codeBlock);            jit.privateCompilePutByIdReplace(stubInfo, structure, cachedOffset, returnAddress);        }                static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ProcessorReturnAddress returnAddress)        {            JIT jit(globalData, codeBlock);            jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress);        }        static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, void** ctiArrayLengthTrampoline, void** ctiStringLengthTrampoline, void** ctiVirtualCallPreLink, void** ctiVirtualCallLink, void** ctiVirtualCall)        {            JIT jit(globalData);            jit.privateCompileCTIMachineTrampolines(executablePool, ctiArrayLengthTrampoline, ctiStringLengthTrampoline, ctiVirtualCallPreLink, ctiVirtualCallLink, ctiVirtualCall);        }        static void patchGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);        static void patchPutByIdReplace(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);        static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, ProcessorReturnAddress returnAddress)        {            JIT jit(globalData, codeBlock);            return jit.privateCompilePatchGetArrayLength(returnAddress);        }        static void linkCall(JSFunction* callee, CodeBlock* calleeCodeBlock, JITCode ctiCode, CallLinkInfo* callLinkInfo, int callerArgCount);        static void unlinkCall(CallLinkInfo*);    private:        JIT(JSGlobalData*, CodeBlock* = 0);        void privateCompileMainPass();        void privateCompileLinkPass();        void privateCompileSlowCases();        void privateCompile();        void privateCompileGetByIdSelf(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);        void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame);#if USE(CTI_REPATCH_PIC)        void privateCompileGetByIdSelfList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, size_t cachedOffset);        void privateCompileGetByIdProtoList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame);        void privateCompileGetByIdChainList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, StructureChain* chain, size_t count, size_t cachedOffset, CallFrame* callFrame);#endif        void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame);        void privateCompilePutByIdReplace(StructureStubInfo*, Structure*, size_t cachedOffset, ProcessorReturnAddress returnAddress);        void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ProcessorReturnAddress returnAddress);        void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, void** ctiArrayLengthTrampoline, void** ctiStringLengthTrampoline, void** ctiVirtualCallPreLink, void** ctiVirtualCallLink, void** ctiVirtualCall);        void privateCompilePatchGetArrayLength(ProcessorReturnAddress returnAddress);        void addSlowCase(Jump);        void addJump(Jump, int);        void emitJumpSlowToHot(Jump, int);        void compileGetByIdHotPath(int resultVReg, int baseVReg, Identifier* ident, unsigned propertyAccessInstructionIndex);        void compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, unsigned propertyAccessInstructionIndex);        void compilePutByIdHotPath(int baseVReg, Identifier* ident, int valueVReg, unsigned propertyAccessInstructionIndex);        void compilePutByIdSlowCase(int baseVReg, Identifier* ident, int valueVReg, Vector<SlowCaseEntry>::iterator& iter, unsigned propertyAccessInstructionIndex);        void compileOpCall(OpcodeID, Instruction* instruction, unsigned callLinkInfoIndex);        void compileOpCallInitializeCallFrame();        void compileOpCallSetupArgs(Instruction*);        void compileOpCallEvalSetupArgs(Instruction*);        void compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID);        void compileOpConstructSetupArgs(Instruction*);        enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };        void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);        void compileFastArith_op_add(Instruction*);        void compileFastArith_op_sub(Instruction*);        void compileFastArith_op_mul(Instruction*);        void compileFastArith_op_mod(unsigned result, unsigned op1, unsigned op2);        void compileFastArith_op_bitand(unsigned result, unsigned op1, unsigned op2);        void compileFastArith_op_lshift(unsigned result, unsigned op1, unsigned op2);        void compileFastArith_op_rshift(unsigned result, unsigned op1, unsigned op2);        void compileFastArith_op_pre_inc(unsigned srcDst);        void compileFastArith_op_pre_dec(unsigned srcDst);        void compileFastArith_op_post_inc(unsigned result, unsigned srcDst);        void compileFastArith_op_post_dec(unsigned result, unsigned srcDst);        void compileFastArithSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_mod(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_bitand(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_lshift(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_rshift(unsigned result, unsigned op1, unsigned op2, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_pre_inc(unsigned srcDst, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_pre_dec(unsigned srcDst, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_post_inc(unsigned result, unsigned srcDst, Vector<SlowCaseEntry>::iterator&);        void compileFastArithSlow_op_post_dec(unsigned result, unsigned srcDst, Vector<SlowCaseEntry>::iterator&);#if ENABLE(JIT_OPTIMIZE_ARITHMETIC)        void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);        void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);#endif        void emitGetVirtualRegister(int src, RegisterID dst);        void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2);        void emitPutVirtualRegister(unsigned dst, RegisterID from = regT0);        void emitPutJITStubArg(RegisterID src, unsigned argumentNumber);        void emitPutJITStubArgFromVirtualRegister(unsigned src, unsigned argumentNumber, RegisterID scratch);        void emitPutJITStubArgConstant(unsigned value, unsigned argumentNumber);        void emitPutJITStubArgConstant(void* value, unsigned argumentNumber);        void emitGetJITStubArg(unsigned argumentNumber, RegisterID dst);        void emitInitRegister(unsigned dst);        void emitPutCTIParam(void* value, unsigned name);        void emitPutCTIParam(RegisterID from, unsigned name);        void emitGetCTIParam(unsigned name, RegisterID to);        void emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry);        void emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry);        void emitGetFromCallFrameHeader(RegisterFile::CallFrameHeaderEntry entry, RegisterID to);        JSValuePtr getConstantOperand(unsigned src);        int32_t getConstantOperandImmediateInt(unsigned src);        bool isOperandConstantImmediateInt(unsigned src);        Jump emitJumpIfJSCell(RegisterID);        Jump emitJumpIfBothJSCells(RegisterID, RegisterID, RegisterID);        void emitJumpSlowCaseIfJSCell(RegisterID);        Jump emitJumpIfNotJSCell(RegisterID);        void emitJumpSlowCaseIfNotJSCell(RegisterID);        void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg);#if USE(ALTERNATE_JSIMMEDIATE)        JIT::Jump emitJumpIfImmediateNumber(RegisterID);        JIT::Jump emitJumpIfNotImmediateNumber(RegisterID);#else        JIT::Jump emitJumpIfImmediateNumber(RegisterID reg)        {            return emitJumpIfImmediateInteger(reg);        }                JIT::Jump emitJumpIfNotImmediateNumber(RegisterID reg)        {            return emitJumpIfNotImmediateInteger(reg);        }#endif        Jump getSlowCase(Vector<SlowCaseEntry>::iterator& iter)        {            return iter++->from;        }        void linkSlowCase(Vector<SlowCaseEntry>::iterator& iter)        {            iter->from.link(this);            ++iter;        }        void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int vReg);        JIT::Jump emitJumpIfImmediateInteger(RegisterID);        JIT::Jump emitJumpIfNotImmediateInteger(RegisterID);        JIT::Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);        void emitJumpSlowCaseIfNotImmediateInteger(RegisterID);        void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);        Jump checkStructure(RegisterID reg, Structure* structure);#if !USE(ALTERNATE_JSIMMEDIATE)        void emitFastArithDeTagImmediate(RegisterID);        Jump emitFastArithDeTagImmediateJumpIfZero(RegisterID);#endif        void emitFastArithReTagImmediate(RegisterID src, RegisterID dest);        void emitFastArithImmToInt(RegisterID);        void emitFastArithIntToImmNoCheck(RegisterID src, RegisterID dest);        void emitTagAsBoolImmediate(RegisterID reg);        void restoreArgumentReference();        void restoreArgumentReferenceForTrampoline();        Call emitNakedCall(void* function);        Call emitCTICall_internal(void*);        Call emitCTICall(CTIHelper_j helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }        Call emitCTICall(CTIHelper_o helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }        Call emitCTICall(CTIHelper_p helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }        Call emitCTICall(CTIHelper_v helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }        Call emitCTICall(CTIHelper_s helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }        Call emitCTICall(CTIHelper_b helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }        Call emitCTICall(CTIHelper_2 helper) { return emitCTICall_internal(reinterpret_cast<void*>(helper)); }        void emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst);        void emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index);                void emitTimeoutCheck();#ifndef NDEBUG        void printBytecodeOperandTypes(unsigned src1, unsigned src2);#endif        void killLastResultRegister();#if ENABLE(CODEBLOCK_SAMPLING)        void sampleCodeBlock(CodeBlock* codeBlock)        {#if PLATFORM(X86_64)            move(ImmPtr(m_interpreter->sampler()->codeBlockSlot()), X86::ecx);            storePtr(ImmPtr(codeBlock), X86::ecx);#else            storePtr(ImmPtr(codeBlock), m_interpreter->sampler()->codeBlockSlot());#endif        }#else        void sampleCodeBlock(CodeBlock*) {}#endif#if ENABLE(OPCODE_SAMPLING)        void sampleInstruction(Instruction* instruction, bool inHostFunction=false)        {#if PLATFORM(X86_64)            move(ImmPtr(m_interpreter->sampler()->sampleSlot()), X86::ecx);            storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), X86::ecx);#else            storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), m_interpreter->sampler()->sampleSlot());#endif        }#else        void sampleInstruction(Instruction*, bool) {}#endif        Interpreter* m_interpreter;        JSGlobalData* m_globalData;        CodeBlock* m_codeBlock;        Vector<CallRecord> m_calls;        Vector<Label> m_labels;        Vector<PropertyStubCompilationInfo> m_propertyAccessCompilationInfo;        Vector<StructureStubCompilationInfo> m_callStructureStubCompilationInfo;        Vector<JumpTable> m_jmpTable;        struct JSRInfo {            DataLabelPtr storeLocation;            Label target;            JSRInfo(DataLabelPtr storeLocation, Label targetLocation)                : storeLocation(storeLocation)                , target(targetLocation)            {            }        };        unsigned m_bytecodeIndex;        Vector<JSRInfo> m_jsrSites;        Vector<SlowCaseEntry> m_slowCases;        Vector<SwitchRecord> m_switches;        int m_lastResultBytecodeRegister;        unsigned m_jumpTargetsPosition;    };}#endif // ENABLE(JIT)#endif // JIT_h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -