Skip to content

Commit c8e6298

Browse files
committed
[JSC] JSON.parse should parse the objects in an array without a recursive call each
https://bugs.webkit.org/show_bug.cgi?id=329716 rdar://191509011 Reviewed by Vassili Bykov. When parsing a json like, [ { ... }, { ... }, { ... }, { ... }, ... ] We need to invoke parseRecursively for each object element, and it is slow since it is full-fledged function call. But spreading code for object parsing for array element parsing bloats the code and hurting icache. In this patch, we extract object parsing code as parseObject lambda and both normal object parsing and array element in one callsite. This accelrerates the above pattern parsing while keeping code size tight. * Source/JavaScriptCore/runtime/LiteralParser.cpp: (JSC::reviverMode>::Lexer::nextValueStart): (JSC::reviverMode>::materializeArray): (JSC::requires): * Source/JavaScriptCore/runtime/LiteralParser.h: Canonical link: https://commits.webkit.org/325559@main
1 parent 8ee260e commit c8e6298

2 files changed

Lines changed: 393 additions & 363 deletions

File tree

0 commit comments

Comments
 (0)