Simulator: 632:mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
c++ 部分打印出来的日志,有什么办法知道是js的什么位置出错?
Simulator: 632:mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
c++ 部分打印出来的日志,有什么办法知道是js的什么位置出错?
看一下\CocosCreator\resources\cocos2d-x\simulator\win32\src\project.dev.js第632行
function typedArraySupport () {
try {
var arr = new Uint8Array(1)
arr.proto = {proto: Uint8Array.prototype, foo: function () { return 42 }} ** // 此行引发**
return arr.foo() === 42 && // typed array instances can be augmented
typeof arr.subarray === ‘function’ && // chrome 9-10 lack subarray
arr.subarray(1, 1).byteLength === 0 // ie10 has broken subarray
} catch (e) {
return false
}
}
我看了下这部分是编译后才有的代码,请指教
Q: 真机或模拟器运行时报错:“Mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create”
A: 这是由于某些第三方库,或者项目中用到了 ES2015(ES6)的类继承语法,而 Babel 在转义这个语法时会调用到 SpiderMonkey 不太优化 API,所以 SpiderMonkey 给出了这个报错。