@@ -173,25 +173,24 @@ A typical function that communicates between JavaScript and C++ is as follows.
173173 // We could also require a function that uses the internal binding internally.
174174 const { divide } = internalBinding (' custom_namespace' );
175175
176- if (common .isDebug ) {
177- const { getV8FastApiCallCount } = internalBinding (' debug' );
178-
179- // The function that will be optimized. It has to be a function written in
180- // JavaScript. Since `divide` comes from the C++ side, we need to wrap it.
181- function testFastPath (a , b ) {
182- return divide (a, b);
183- }
176+ // The function that will be optimized. It has to be a function written in
177+ // JavaScript. Since `divide` comes from the C++ side, we need to wrap it.
178+ function testFastPath (a , b ) {
179+ return divide (a, b);
180+ }
184181
185- eval (' %PrepareFunctionForOptimization(testFastPath)' );
186- // This call will let V8 know about the argument types that the function expects.
187- assert .strictEqual (testFastPath (6 , 3 ), 2 );
182+ eval (' %PrepareFunctionForOptimization(testFastPath)' );
183+ // This call will let V8 know about the argument types that the function expects.
184+ assert .strictEqual (testFastPath (6 , 3 ), 2 );
188185
189- eval (' %OptimizeFunctionOnNextCall(testFastPath)' );
190- assert .strictEqual (testFastPath (8 , 2 ), 4 );
191- assert .throws (() => testFastPath (1 , 0 ), {
192- code: ' ERR_INVALID_STATE' ,
193- });
186+ eval (' %OptimizeFunctionOnNextCall(testFastPath)' );
187+ assert .strictEqual (testFastPath (8 , 2 ), 4 );
188+ assert .throws (() => testFastPath (1 , 0 ), {
189+ code: ' ERR_INVALID_STATE' ,
190+ });
194191
192+ if (common .isDebug ) {
193+ const { getV8FastApiCallCount } = internalBinding (' debug' );
195194 assert .strictEqual (getV8FastApiCallCount (' custom_namespace.divide.ok' ), 1 );
196195 assert .strictEqual (getV8FastApiCallCount (' custom_namespace.divide.error' ), 1 );
197196 }
0 commit comments