在this article中" V8优化提示"部分写了什么"有关哪些功能可以和不可以优化的更多信息,您可以使用--trace-opt file.js和V8"附带的d8 shell实用程序。我安装了v8和d8,然后执行d8 --trace-opt-verbose app.js
app.js内容为:
function add(x, y) {
return x+y;
}
add(1, 2);
add('a','b');
function foo() {
var a = [1, 2, 3]
var b = [4, 5, 6];
var c = a.concat(b);
}
function bar() {
var a = [1, 2, 3]
var b = [4, 5, 6];
var c = a.concat(b);
return c;
}
var d = bar();
而且我得到了:
[disabled optimization for 0xea95f253e59 <SharedFunctionInfo InstantiateFunction>, reason: TryCatchStatement]
[disabled optimization for 0xea95f25f391 <SharedFunctionInfo ConfigureTemplateInstance>, reason: TryFinallyStatement]
[disabled optimization for 0xea95f24c041 <SharedFunctionInfo DefaultNumber>, reason: Call to a JavaScript runtime function]
发生什么事了?我怎么能正确使用d8?