From 83f6d4bf940e8e6fa1393139df51916dbb94470b Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Wed, 14 Apr 2021 13:56:14 +0200 Subject: [PATCH] perf(js/http): avoid v8 deopt in async iterator (#10160) --- runtime/js/40_http.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/js/40_http.js b/runtime/js/40_http.js index 6b9d3dca68..3916b1df45 100644 --- a/runtime/js/40_http.js +++ b/runtime/js/40_http.js @@ -81,8 +81,8 @@ return { async next() { const reqEvt = await httpConn.nextRequest(); - if (reqEvt === null) return { value: undefined, done: true }; - return { value: reqEvt, done: false }; + // Change with caution, current form avoids a v8 deopt + return { value: reqEvt, done: reqEvt === null }; }, }; }