禁止 nodejs 优化函数

Tags
nodejsv8
Created
May 11, 2018 11:41 AM

If you want solid way to do it, you need to run node with --allow-natives-syntax flag and call this:

%NeverOptimizeFunction(constantTimeStringCompare);

Note that you should call this before you have called constantTimeStringCompare, if the function is already optimized then this violates an assertion.

// 无效啊

///

So to guarantee disable V8 optimization you should add eval('') to function body.

SuperMade with Super