{"id":161169,"date":"2019-10-29T08:06:44","date_gmt":"2019-10-29T00:06:44","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=161169"},"modified":"2019-10-14T14:57:19","modified_gmt":"2019-10-14T06:57:19","slug":"javascript-engine-understand","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/javascript-engine-understand.html","title":{"rendered":"\u4e86\u89e3JavaScript\u5f15\u64ce"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nJavaScript \u662f\u4e00\u95e8\u9ad8\u7ea7\u8bed\u8a00\uff0c\u4f46\u662f\u6700\u7ec8\u8ba1\u7b97\u673a\u80fd\u7406\u89e3\u53ea\u67091\u548c0\u3002 \u90a3\u4e48\u6211\u4eec\u7f16\u5199\u7684\u4ee3\u7801\u662f\u5982\u4f55\u88ab\u8ba1\u7b97\u673a\u7406\u89e3\u7684\u5462\uff1f \u638c\u63e1\u6240\u5b66\u7f16\u7a0b\u8bed\u8a00\u7684\u57fa\u7840\u77e5\u8bc6\u5c06\u8ba9\u60a8\u80fd\u7f16\u5199\u51fa\u66f4\u597d\u7684\u4ee3\u7801\u3002 \u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u4ec5\u63a2\u8ba8\u4e00\u4e2a\u95ee\u9898\uff1aJavaScript \u662f\u5982\u4f55\u5de5\u4f5c\u7684\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u524d\u8a00<\/strong><\/div>\n

\u6700\u521d\uff0cJavaScript \u53ea\u80fd\u5728 Web \u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\uff0c\u4f46\u662f\u968f\u7740 Node \u7684\u51fa\u73b0\uff0c\u73b0\u5728 JavaScript \u4e5f\u53ef\u4ee5\u5728\u670d\u52a1\u7aef\u8fd0\u884c\u3002\u867d\u7136\u6211\u4eec\u53ef\u80fd\u77e5\u9053\u5e94\u8be5\u5728\u4f55\u65f6\u4f55\u5730\u53bb\u4f7f\u7528\u5b83\uff0c \u4f46\u662f\u6211\u4eec\u771f\u7684\u4e86\u89e3\u8fd9\u4e9b\u811a\u672c\u6267\u884c\u7684\u80cc\u540e\u53d1\u751f\u4e86\u4ec0\u4e48\u5417\uff1f<\/p>\n

\u5982\u679c\u60a8\u89c9\u5f97\u81ea\u5df1\u5bf9 JavaScript \u5f15\u64ce\u6709\u4e86\u4e00\u4e9b\u4e86\u89e3\u7684\u8bdd\uff0c\u53ef\u4ee5\u5148\u7ed9\u81ea\u5df1\u9f13\u4e2a\u638c\uff0c\u4f46\u4e0d\u8981\u6025\u7740\u5173\u6389\u672c\u6587\uff0c\u6211\u76f8\u4fe1\u9605\u8bfb\u5b8c\u6210\u540e\u60a8\u4ecd\u7136\u53ef\u4ee5\u4ece\u4e2d\u5b66\u5230\u4e00\u4e9b\u4e1c\u897f\u3002<\/p>\n

JavaScript \u662f\u4e00\u95e8\u9ad8\u7ea7\u8bed\u8a00\uff0c\u4f46\u662f\u6700\u7ec8\u8ba1\u7b97\u673a\u80fd\u7406\u89e3\u53ea\u67091\u548c0\u3002 \u90a3\u4e48\u6211\u4eec\u7f16\u5199\u7684\u4ee3\u7801\u662f\u5982\u4f55\u88ab\u8ba1\u7b97\u673a\u7406\u89e3\u7684\u5462\uff1f \u638c\u63e1\u6240\u5b66\u7f16\u7a0b\u8bed\u8a00\u7684\u57fa\u7840\u77e5\u8bc6\u5c06\u8ba9\u60a8\u80fd\u7f16\u5199\u51fa\u66f4\u597d\u7684\u4ee3\u7801\u3002 \u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u4ec5\u63a2\u8ba8\u4e00\u4e2a\u95ee\u9898\uff1aJavaScript \u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f<\/p>\n

\u4e0b\u9762\u8ba9\u6211\u4eec\u8fdb\u5165\u6b63\u9898~<\/p>\n

JavaScript \u5f15\u64ce<\/strong><\/div>\n

\u8fd9\u662f\u672c\u6587\u5c06\u8981\u63a2\u7d22\u7684\u4e3b\u8981\u5185\u5bb9\uff0c\u5b83\u8d1f\u8d23\u4f7f\u8ba1\u7b97\u673a\u7406\u89e3\u6211\u4eec\u7f16\u5199\u7684 JS \u4ee3\u7801\u3002JavaScript \u5f15\u64ce\u662f\u4e00\u79cd\u7528\u4e8e\u5c06\u6211\u4eec\u7684\u4ee3\u7801\u8f6c\u6362\u4e3a\u673a\u5668\u53ef\u8bfb\u8bed\u8a00\u7684\u5f15\u64ce\u3002\u5982\u679c\u6ca1\u6709 JavaScript \u5f15\u64ce\uff0c\u60a8\u7f16\u5199\u7684\u4ee3\u7801\u5bf9\u8ba1\u7b97\u673a\u6765\u8bf4\u7b80\u76f4\u662f\u4e00\u5806\u201c\u80e1\u8a00\u4e71\u8bed\u201d\u3002\u4e0d\u4ec5\u4ec5\u662f JavaScript \uff0c\u5176\u4ed6\u6240\u6709\u7f16\u7a0b\u8bed\u8a00\u90fd\u9700\u8981\u4e00\u4e2a\u7c7b\u4f3c\u7684\u5f15\u64ce\uff0c\u6765\u5c06\u8fd9\u4e9b\u201c\u80e1\u8a00\u4e71\u8bed\u201d\u8f6c\u6362\u6210\u5bf9\u8ba1\u7b97\u673a\u6709\u610f\u4e49\u7684\u8bed\u8a00\u3002<\/p>\n

\u76ee\u524d\u6709\u591a\u79cd JavaScript \u5f15\u64ce\u5728\u53ef\u4f9b\u4f7f\u7528\u3002\u60a8\u53ef\u4ee5\u5728 Wikipedia \u4e0a\u67e5\u9605\u6240\u6709\u53ef\u7528\u7684 JavaScript \u5f15\u64ce\u3002\u5b83\u4eec\u4e5f\u88ab\u79f0\u4e3a ECMAScript \u5f15\u64ce\uff0c\u8fd9\u6837\u53eb\u7684\u5177\u4f53\u539f\u56e0\u4f1a\u5728\u4e0b\u6587\u4e2d\u63d0\u53ca\u3002 \u4e0b\u9762\u662f\u4e00\u4e9b\u6211\u4eec\u65e5\u5e38\u53ef\u80fd\u4f1a\u7528\u5230\u7684 JavaScript \u5f15\u64ce\uff1a<\/p>\n

    \n Chakra, Microsoft IE\/Edge
    \n SpiderMonkey, FireFox
    \n V8, Chrome\n<\/ol>\n

    \u9664\u6b64\u4e4b\u5916\u7684\u5176\u5b83\u5f15\u64ce\uff0c\u53ef\u4ee5\u81ea\u884c\u641c\u7d22\u4e86\u89e3\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u7814\u7a76\u8fd9\u4e9b\u5f15\u64ce\uff0c\u4ee5\u4e86\u89e3\u5b83\u4eec\u662f\u5982\u4f55\u7ffb\u8bd1 JavaScript \u6587\u4ef6\u7684\u3002<\/p>\n

    JavaScript \u5f15\u64ce\u7684\u5185\u91cc<\/strong><\/div>\n

    \u6211\u4eec\u5df2\u7ecf\u77e5\u9053\u4e86\u5f15\u64ce\u662f\u5fc5\u987b\u7684\uff0c\u7531\u6b64\u53ef\u80fd\u4e0d\u7981\u4f1a\u60f3\uff1a<\/p>\n

    \u662f\u8c01\u53d1\u660e\u4e86 JavaScript \u5f15\u64ce\uff1f<\/p>\n

    \u7b54\u6848\u662f\uff0c\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u3002\u5b83\u53ea\u662f\u5206\u6790\u6211\u4eec\u7684\u4ee3\u7801\u5e76\u5c06\u5176\u7ffb\u8bd1\u7684\u53e6\u4e00\u79cd\u8bed\u8a00\u7684\u5de5\u5177\u3002V8 \u662f\u6700\u53d7\u6b22\u8fce\u7684 JavaScript \u5f15\u64ce\u4e4b\u4e00\uff0c\u4e5f\u662f Chrome \u548c NodeJS \u4f7f\u7528\u7684\u5f15\u64ce\u3002\u5b83\u662f\u7528 C++\uff08\u4e00\u79cd\u5e95\u5c42\u8bed\u8a00\uff09\u7f16\u5199\u7684\u3002\u4f46\u662f\u5982\u679c\u6bcf\u4e2a\u4eba\u90fd\u521b\u9020\u4e00\u4e2a\u5f15\u64ce\uff0c\u90a3\u573a\u9762\u5c31\u4e0d\u662f\u53ef\u63a7\u8303\u56f4\u5185\u7684\u4e86\u3002<\/p>\n

    \u56e0\u6b64\uff0c\u4e3a\u4e86\u7ed9\u8fd9\u4e9b\u5f15\u64ce\u786e\u7acb\u4e00\u4e2a\u89c4\u8303\uff0cECMA \u7684\u6807\u51c6\u8bde\u751f\u4e86\uff0c\u8be5\u6807\u51c6\u4e3b\u8981\u63d0\u4f9b\u5982\u4f55\u7f16\u5199\u5f15\u64ce\u548c JavaScript \u6240\u6709\u529f\u80fd\u7684\u89c4\u8303\u3002\u8fd9\u5c31\u662f\u65b0\u529f\u80fd\u80fd\u5728 ECMAScript 6\u30017\u30018 \u4e0a\u5b9e\u73b0\u7684\u539f\u56e0\u3002\u540c\u65f6\uff0c\u5f15\u64ce\u4e5f\u8fdb\u884c\u4e86\u66f4\u65b0\u4ee5\u652f\u6301\u8fd9\u4e9b\u65b0\u529f\u80fd\u3002 \u4e8e\u662f\uff0c\u6211\u4eec\u4fbf\u53ef\u4ee5\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u68c0\u67e5\u4e86\u6d4f\u89c8\u5668\u4e2d JS \u9ad8\u7ea7\u529f\u80fd\u7684\u53ef\u7528\u6027\u3002<\/p>\n

    \u4e0b\u9762\u6211\u4eec\u5bf9 V8 \u5f15\u64ce\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u63a2\u7d22\uff0c\u56e0\u4e3a\u57fa\u672c\u6982\u5ff5\u5728\u6240\u6709\u5f15\u64ce\u4e2d\u662f\u4e00\u81f4\u7684\u3002<\/p>\n

    \"\"<\/a><\/p>\n

    \u4e0a\u56fe\u5c31\u662f JS Engine \u5185\u90e8\u7684\u5de5\u4f5c\u6d41\u7a0b\u3002\u6211\u4eec\u8f93\u5165\u7684\u4ee3\u7801\u5c06\u901a\u8fc7\u4ee5\u4e0b\u9636\u6bb5\uff1a<\/p>\n

      \n Parser
      \n AST
      \n Interpreter \u751f\u6210 ByteCode
      \n Profiler
      \n Compiler \u751f\u6210\u4f18\u5316\u540e\u7684\u4ee3\u7801\n<\/ol>\n

      \u522b\u88ab\u4e0a\u9762\u7684\u6d41\u7a0b\u7ed9\u552c\u4f4f\u4e86\uff0c\u5728\u51e0\u5206\u949f\u540e\u60a8\u5c06\u4e86\u89e3\u5b83\u4eec\u662f\u534f\u540c\u8fd0\u4f5c\u7684\u3002<\/p>\n

      \u5728\u8fdb\u4e00\u6b65\u6df1\u5165\u8fd9\u4e9b\u9636\u6bb5\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5148\u4e86\u89e3 Interpreter \u548c Compiler \u7684\u533a\u522b\u3002<\/p>\n

      Interpreter VS Compiler<\/strong><\/div>\n

      \u901a\u5e38\uff0c\u5c06\u4ee3\u7801\u8f6c\u6362\u6210\u673a\u5668\u53ef\u8bfb\u8bed\u8a00\u7684\u65b9\u6cd5\u6709\u4e24\u79cd\u3002 \u6211\u4eec\u5c06\u8981\u8ba8\u8bba\u7684\u6982\u5ff5\u4e0d\u4ec5\u9002\u7528\u4e8e JavaScript \uff0c\u800c\u4e14\u9002\u7528\u4e8e\u5927\u591a\u6570\u7f16\u7a0b\u8bed\u8a00\uff0c\u4f8b\u5982 Python\uff0cJava \u7b49\u3002<\/p>\n

        \n Interpreter \u9010\u884c\u8bfb\u53d6\u4ee3\u7801\u5e76\u7acb\u5373\u6267\u884c\u3002
        \n Compiler \u8bfb\u53d6\u60a8\u7684\u6574\u4e2a\u4ee3\u7801\uff0c\u8fdb\u884c\u4e00\u4e9b\u4f18\u5316\uff0c\u7136\u540e\u751f\u6210\u4f18\u5316\u540e\u7684\u4ee3\u7801\u3002\n<\/ol>\n

        \u8ba9\u6211\u4eec\u6765\u770b\u4e0b\u9762\u8fd9\u4e2a\u4f8b\u5b50\u3002<\/p>\n

        \r\nfunction add(a, b) {  \r\n return a+b  \r\n}  \r\nfor(let i = 0; i < 1000; i++) {  \r\n add(1 + 1)  \r\n} \r\n<\/pre>\n

        \u4e0a\u9762\u7684\u793a\u4f8b\u5faa\u73af\u8c03\u7528\u4e86 add \u51fd\u65701000\u6b21\uff0c\u8be5\u51fd\u6570\u5c06\u4e24\u4e2a\u6570\u5b57\u76f8\u52a0\u5e76\u8fd4\u56de\u603b\u548c\u3002<\/p>\n

          \n 1\u3001Interpreter \u63a5\u6536\u4e0a\u9762\u7684\u4ee3\u7801\u540e\uff0c\u5b83\u5c06\u9010\u884c\u8bfb\u53d6\u5e76\u7acb\u5373\u6267\u884c\u4ee3\u7801\uff0c\u76f4\u5230\u5faa\u73af\u7ed3\u675f\u3002 \u5b83\u7684\u5de5\u4f5c\u4ec5\u4ec5\u662f\u5b9e\u65f6\u5730\u5c06\u4ee3\u7801\u8f6c\u6362\u4e3a\u6211\u4eec\u7684\u8ba1\u7b97\u673a\u53ef\u4ee5\u7406\u89e3\u7684\u5185\u5bb9\u3002
          \n 2\u3001\u5982\u679c\u8fd9\u6bb5\u4ee3\u7801\u63a5\u53d7\u8005\u662f Compiler\uff0c\u5b83\u4f1a\u5148\u5b8c\u6574\u5730\u8bfb\u53d6\u6574\u4e2a\u7a0b\u5e8f\uff0c\u5bf9\u6211\u4eec\u8981\u6267\u884c\u7684\u4ee3\u7801\u8fdb\u884c\u5206\u6790\uff0c\u5e76\u751f\u6210\u7535\u8111\u53ef\u4ee5\u8bfb\u61c2\u7684\u673a\u5668\u8bed\u8a00\u3002\u8fc7\u7a0b\u5982\u540c\u83b7\u53d6 X\uff08\u6211\u4eec\u7684JS\u6587\u4ef6\uff09\u5e76\u751f\u6210 Y\uff08\u673a\u5668\u8bed\u8a00\uff09\u4e00\u6837\u3002\u5982\u679c\u6211\u4eec\u4f7f\u7528 Interpreter \u6267\u884c Y\uff0c\u5219\u4f1a\u83b7\u5f97\u4e0e\u6267\u884c X \u76f8\u540c\u7684\u7ed3\u679c\u3002\n<\/ol>\n

          \"\"<\/p>\n

          \u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0cByteCode \u53ea\u662f\u4e2d\u95f4\u7801\uff0c\u8ba1\u7b97\u673a\u4ecd\u9700\u8981\u5bf9\u5176\u8fdb\u884c\u7ffb\u8bd1\u624d\u80fd\u6267\u884c\u3002 \u4f46\u662f Interpreter \u548c Compiler \u90fd\u5c06\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u673a\u5668\u8bed\u8a00\uff0c\u5b83\u4eec\u552f\u4e00\u7684\u533a\u522b\u5728\u4e8e\u8f6c\u6362\u7684\u8fc7\u7a0b\u4e0d\u5c3d\u76f8\u540c\u3002<\/p>\n

            \n Interpreter \u9010\u884c\u5c06\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u7b49\u6548\u7684\u673a\u5668\u4ee3\u7801\u3002
            \n Compiler \u5728\u4e00\u5f00\u59cb\u5c31\u5c06\u6240\u6709\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u673a\u5668\u4ee3\u7801\u3002\n<\/ol>\n

            \u5f53\u60a8\u9605\u8bfb\u5b8c\u4e0a\u9762\u7684\u63a8\u8350\u6587\u7ae0\u540e\uff0c\u60a8\u53ef\u80fd\u5df2\u7ecf\u4e86\u89e3\u5230 Babel \u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a JS Compiler \uff0c\u5b83\u53ef\u4ee5\u63a5\u6536\u60a8\u7f16\u5199\u7684\u65b0\u7248\u672c JS \u4ee3\u7801\u5e76\u5411\u4e0b\u7f16\u8bd1\u4e3a\u4e0e\u6d4f\u89c8\u5668\u517c\u5bb9\u7684 JS \u4ee3\u7801\uff08\u65e7\u7248\u672c\u7684 JS \u4ee3\u7801\uff09\u3002<\/p>\n

            Interpreter \u548c Compiler \u7684\u4f18\u7f3a\u70b9<\/strong><\/div>\n
              \n 1\u3001Interpreter \u7684\u4f18\u70b9\u662f\u65e0\u9700\u7b49\u5f85\u7f16\u8bd1\u5373\u53ef\u7acb\u5373\u6267\u884c\u4ee3\u7801\u3002\u8fd9\u5bf9\u5728\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c JS \u63d0\u4f9b\u4e86\u6781\u5927\u7684\u4fbf\u5229\uff0c\u56e0\u4e3a\u6240\u6709\u7528\u6237\u90fd\u4e0d\u60f3\u6d6a\u8d39\u65f6\u95f4\u5728\u7b49\u5f85\u4ee3\u7801\u7f16\u8bd1\u8fd9\u4ef6\u4e8b\u4e0a\u3002\u4f46\u662f\uff0c\u5f53\u6709\u5927\u91cf\u7684 JS \u4ee3\u7801\u9700\u8981\u6267\u884c\u65f6\u4f1a\u8fd0\u884c\u5730\u6bd4\u8f83\u6162\u3002\u8fd8\u8bb0\u5f97\u4e0a\u9762\u4f8b\u5b50\u4e2d\u7684\u90a3\u4e00\u5c0f\u6bb5\u4ee3\u7801\u5417\uff1f\u4ee3\u7801\u4e2d\u6267\u884c\u4e861000\u6b21\u51fd\u6570\u8c03\u7528\u3002\u51fd\u6570 add \u88ab\u8c03\u7528\u4e861000\u6b21\uff0c\u4f46\u4ed6\u7684\u8f93\u51fa\u4fdd\u6301\u4e0d\u53d8\u3002\u4f46\u662f Interpreter \u8fd8\u662f\u9010\u884c\u6267\u884c\uff0c\u4f1a\u663e\u5f97\u6bd4\u8f83\u6162\u3002
              \n 2\u3001\u5728\u540c\u6837\u7684\u60c5\u51b5\u4e0b\uff0cCompiler \u53ef\u4ee5\u901a\u8fc7\u75282\u4ee3\u66ff\u5faa\u73af\uff08\u56e0\u4e3a add \u51fd\u6570\u6bcf\u6b21\u90fd\u662f\u6267\u884c1 + 1\uff09\u6765\u8fdb\u884c\u4e00\u4e9b\u4f18\u5316\u3002Compiler \u6700\u7ec8\u7ed9\u51fa\u7684\u4f18\u5316\u4ee3\u7801\u53ef\u4ee5\u5728\u66f4\u77ed\u7684\u65f6\u95f4\u5185\u6267\u884c\u5b8c\u6210\u3002
              \n\u7efc\u4e0a\u6240\u8ff0\uff0cInterpreter \u53ef\u4ee5\u7acb\u5373\u5f00\u59cb\u6267\u884c\u4ee3\u7801\uff0c\u4f46\u4e0d\u4f1a\u8fdb\u884c\u4f18\u5316\u3002 Compiler \u867d\u7136\u9700\u8981\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\u6765\u7f16\u8bd1\u4ee3\u7801\uff0c\u4f46\u662f\u4f1a\u751f\u6210\u5bf9\u6267\u884c\u65f6\u66f4\u4f18\u7684\u4ee3\u7801\u3002<\/ol>\n

              \u597d\u7684\uff0cInterpreter \u548c Compiler \u5fc5\u8981\u77e5\u8bc6\u6211\u4eec\u5df2\u7ecf\u4e86\u89e3\u4e86\u3002\u73b0\u5728\u8ba9\u6211\u4eec\u56de\u5230\u4e3b\u9898\u2014\u2014JS \u5f15\u64ce\u3002<\/p>\n

              \u56e0\u6b64\uff0c\u8003\u8651\u5230\u7f16\u8bd1\u5668\u548c\u89e3\u91ca\u5668\u7684\u4f18\u7f3a\u70b9\uff0c\u5982\u679c\u6211\u4eec\u540c\u65f6\u5229\u7528\u4e24\u8005\u7684\u4f18\u70b9\uff0c\u8be5\u600e\u4e48\u529e\uff1f \u8fd9\u5c31\u662f JIT(Just In Time) Compiler \u7684\u7528\u6b66\u4e4b\u5730\u3002\u5b83\u662f Interpreter \u548c Compiler \u7684\u7ed3\u5408\uff0c\u73b0\u5728\u5927\u591a\u6570\u6d4f\u89c8\u5668\u90fd\u5728\u66f4\u5feb\uff0c\u66f4\u9ad8\u6548\u5730\u5b9e\u73b0\u6b64\u529f\u80fd\u3002\u540c\u65f6 V8 \u5f15\u64ce\u4e5f\u4f7f\u7528\u6b64\u529f\u80fd\u3002<\/p>\n

              \"\"<\/p>\n

              \u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c<\/p>\n

                \n 1\u3001Parser \u662f\u4e00\u79cd\u901a\u8fc7\u5404\u79cd JavaScript \u5173\u952e\u5b57\u6765\u8bc6\u522b\uff0c\u5206\u6790\u548c\u5206\u7c7b\u7a0b\u5e8f\u5404\u4e2a\u90e8\u5206\u7684\u89e3\u6790\u5668\u3002\u5b83\u53ef\u4ee5\u533a\u5206\u4ee3\u7801\u662f\u4e00\u4e2a\u65b9\u6cd5\u8fd8\u662f\u4e00\u4e2a\u53d8\u91cf\u3002
                \n 2\u3001\u7136\u540e\uff0cAST(\u62bd\u8c61\u8bed\u6cd5\u6811) \u57fa\u4e8e Parser \u7684\u5206\u7c7b\u6784\u9020\u6811\u72b6\u7ed3\u6784\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 AST Explorer \u67e5\u770b\u8be5\u6811\u7684\u7ed3\u6784\u3002
                \n 3\u3001\u968f\u540e\u5c06 AST \u63d0\u4f9b\u7ed9 Interpreter \u751f\u6210 ByteCode\u3002\u5982\u4e0a\u6587\u6240\u8ff0\uff0cByteCode \u4e0d\u662f\u6700\u5e95\u5c42\u7684\u4ee3\u7801\uff0c\u4f46\u53ef\u4ee5\u88ab\u6267\u884c\u3002\u5728\u6b64\u9636\u6bb5\uff0c\u6d4f\u89c8\u5668\u501f\u52a9 V8 \u5f15\u64ce\u6267\u884c ByteCode \u8fdb\u884c\u5de5\u4f5c\uff0c\u56e0\u6b64\u7528\u6237\u65e0\u9700\u7b49\u5f85\u3002
                \n 4\u3001\u540c\u65f6\uff0cProfiler \u5c06\u67e5\u627e\u53ef\u4ee5\u88ab\u4f18\u5316\u7684\u4ee3\u7801\uff0c\u7136\u540e\u5c06\u5b83\u4eec\u4f20\u9012\u7ed9 Compiler\u3002Compiler \u751f\u6210\u4f18\u5316\u4ee3\u7801\u7684\u540c\u65f6\uff0c\u6d4f\u89c8\u5668\u6682\u65f6\u7528 ByteCode \u6267\u884c\u64cd\u4f5c\u3002\u5e76\u4e14\uff0c\u4e00\u65e6 Compiler \u751f\u6210\u4e86\u4f18\u5316\u4ee3\u7801\uff0c\u4f18\u5316\u4ee3\u7801\u5219\u5c06\u5b8c\u5168\u66ff\u6362\u6389\u4e34\u65f6\u7684 ByteCode\u3002
                \n 5\u3001 \u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u5145\u5206\u5229\u7528 Interpreter \u548c Compiler \u7684\u4f18\u70b9\u3002Interpreter \u6267\u884c\u4ee3\u7801\u7684\u540c\u65f6\uff0cProfiler \u5bfb\u627e\u53ef\u4ee5\u88ab\u4f18\u5316\u7684\u4ee3\u7801\uff0cCompiler \u5219\u521b\u5efa\u4f18\u5316\u7684\u4ee3\u7801\u3002\u7136\u540e\uff0c\u5c06 ByteCode \u7801\u66ff\u6362\u4e3a\u4f18\u5316\u540e\u7684\u8f83\u4e3a\u5e95\u5c42\u7684\u4ee3\u7801\uff0c\u4f8b\u5982\u673a\u5668\u4ee3\u7801\u3002<\/ol>\n

                \u8fd9\u4ec5\u610f\u5473\u7740\u6027\u80fd\u5c06\u5728\u9010\u6e10\u63d0\u9ad8\uff0c\u540c\u65f6\u4e0d\u4f1a\u6709\u963b\u585e\u6267\u884c\u7684\u65f6\u95f4\u3002<\/p>\n

                \u5173\u4e8e ByteCode<\/strong><\/div>\n

                \u4f5c\u4e3a\u673a\u5668\u4ee3\u7801\uff0cByteCode \u4e0d\u80fd\u88ab\u6240\u6709\u8ba1\u7b97\u673a\u7406\u89e3\u53ca\u6267\u884c\u3002\u5b83\u4ecd\u7136\u9700\u8981\u50cf\u865a\u62df\u673a\u6216\u50cf Javascript V8 \u5f15\u64ce\u8fd9\u6837\u7684\u4e2d\u95f4\u4ef6\u624d\u80fd\u5c06\u5176\u8f6c\u6362\u4e3a\u673a\u5668\u53ef\u8bfb\u7684\u8bed\u8a00\u3002 \u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u6211\u4eec\u7684\u6d4f\u89c8\u5668\u53ef\u4ee5\u5728\u4e0a\u8ff05\u4e2a\u9636\u6bb5\u4e2d\u501f\u52a9 JavaScript \u5f15\u64ce\u5728 Interpreter \u4e2d\u6267\u884c ByteCode \u7684\u539f\u56e0\u3002<\/p>\n

                \u6240\u4ee5\u60a8\u53ef\u4ee5\u4f1a\u6709\u53e6\u4e00\u4e2a\u95ee\u9898,<\/p>\n

                JavaScript \u662f\u4e00\u95e8\u89e3\u91ca\u578b\u8bed\u8a00\u5417?<\/strong><\/div>\n

                JavaScript \u662f\u4f46\u4e0d\u5b8c\u5168\u662f\u4e00\u95e8\u89e3\u91ca\u578b\u8bed\u8a00\u3002Brendan Eich \u6700\u521d\u662f\u5728 JavaScript \u7684\u65e9\u671f\u9636\u6bb5\u521b\u5efa JavaScript \u5f15\u64ce \u201c SpiderMonkey\u201d \u7684\u3002\u8be5\u5f15\u64ce\u6709\u4e00\u4e2a Interpreter \u6765\u544a\u8bc9\u6d4f\u89c8\u5668\u8be5\u600e\u4e48\u6267\u884c\u4ee3\u7801\u3002 \u4f46\u662f\u73b0\u5728\u6211\u4eec\u7684\u5f15\u64ce\u4e0d\u4ec5\u5305\u62ec\u4e86 Interpreter\uff0c\u8fd8\u6709 Compiler\u3002 \u6211\u4eec\u7684\u4ee3\u7801\u4e0d\u4ec5\u53ef\u4ee5\u88ab\u8f6c\u6362\u6210 ByteCode\uff0c\u8fd8\u53ef\u4ee5\u88ab\u7f16\u8bd1\u8f93\u51fa\u4f18\u5316\u540e\u7684\u4ee3\u7801\u3002 \u56e0\u6b64\uff0c\u4ece\u6280\u672f\u4e0a\u8bb2\uff0c\u8fd9\u5b8c\u5168\u53d6\u51b3\u4e8e\u5f15\u64ce\u662f\u5982\u4f55\u5b9e\u73b0\u7684\u3002<\/p>\n

                JavaScript \u5f15\u64ce\u7684\u6574\u4f53\u5de5\u4f5c\u539f\u7406\u5c31\u662f\u8fd9\u6837\u3002\u76f8\u4fe1\u60a8\u65e0\u9700\u5b66\u4e60 JavaScript \u4e5f\u53ef\u4ee5\u7406\u89e3\u3002 \u5f53\u7136\uff0c\u60a8\u751a\u81f3\u53ef\u4ee5\u5728\u4e0d\u77e5\u9053 JavaScript \u5982\u4f55\u5de5\u4f5c\u7684\u60c5\u51b5\u4e0b\u7f16\u5199\u4ee3\u7801\u3002 \u4f46\u662f\uff0c\u5982\u679c\u6211\u4eec\u4e86\u89e3\u4e00\u4e9b\u5e55\u540e\u7684\u77e5\u8bc6\uff0c\u6216\u8bb8\u80fd\u8ba9\u6211\u4eec\u7f16\u5199\u51fa\u66f4\u597d\u7684\u4ee3\u7801\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

                \u6700\u521d\uff0cJavaScript \u53ea\u80fd\u5728 Web \u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\uff0c\u4f46\u662f\u968f\u7740 Node \u7684\u51fa\u73b0\uff0c\u73b0\u5728 JavaScrip […]<\/p>\n","protected":false},"author":1329,"featured_media":161176,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-161169","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/161169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1329"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=161169"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/161169\/revisions"}],"predecessor-version":[{"id":161217,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/161169\/revisions\/161217"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/161176"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=161169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=161169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=161169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}