From f80b4af956eaf89c2497a52eba9a76e13401b2a5 Mon Sep 17 00:00:00 2001 From: Chris Blappert Date: Fri, 20 Jul 2018 12:06:53 -0700 Subject: [PATCH] ForkedAbruptCompletion created with generator containing joinCondition (#2272) Summary: Release Notes: None PR solved by hermanventer's recent PR, just adding another test case closer to the one in the issue. Resolves #2248 Pull Request resolved: https://github.com/facebook/prepack/pull/2272 Differential Revision: D8938294 Pulled By: cblappert fbshipit-source-id: 18e4fd3b8913400b98242eff06f011ed0140459b --- .../optimized-functions/2248-repro.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/serializer/optimized-functions/2248-repro.js diff --git a/test/serializer/optimized-functions/2248-repro.js b/test/serializer/optimized-functions/2248-repro.js new file mode 100644 index 000000000..2bf1954f7 --- /dev/null +++ b/test/serializer/optimized-functions/2248-repro.js @@ -0,0 +1,19 @@ +function fn(str, start) { + var size = str.length; + var posA = 0; + if (start > 0) { + for (; start > 0 && posA < size; start--) { + posA += 1 + str.charCodeAt(posA); + } + if (posA >= size) { + return posA; + } + } +} + +if (global.__optimize) __optimize(fn); + +global.inspect = function() { + let res1 = fn("abcdef", 1); + return res1; +};