← All issues

[JSC] Add ArrayJoin DFG nodes

26b192b

DFG는 JSC의 mid-tier JIT compiler로, 각 연산이 그래프의 node로 표현됩니다. ArrayJoin을 node로 추가함으로써, 컴파일러는 generic C++ runtime으로 dispatch하는 대신 Array#join에 대한 native code를 직접 생성합니다. ArrayMode는 관찰된 storage type(Int32, Double, Contiguous, Generic)을 인코딩합니다.

핵심 correctness invariant는 separator object의 toString() side effect가 join() 호출당 정확히 한 번만 실행되어야 한다는 점입니다. toString() 내부에서 array mutation이 발생해 OSR exit가 유발되더라도 마찬가지입니다. JIT가 이미 toString()을 실행한 상태에서 bytecode slow path로 이동하면, 해당 slow path가 toString()을 다시 호출하기 때문입니다.

이 commit의 regression test는 해당 invariant를 직접 검증합니다. toString()이 array를 변형하는(length 축소, indexing type 전환) object separator를 사용할 때, 모든 tier에서 동일한 결과를 내야 하며 calls === testLoopCount가 성립해야 합니다.

OSR exit 경계를 넘나드는 side effect에 민감한 invariant를 가진 새로운 JIT intrinsic은, 역사적으로 JIT vulnerability가 가장 많이 발견된 유형 중 하나에 해당합니다.

🔒

New JIT-generated code for a side-effect-sensitive operation across tier boundaries — multiple edge cases in the fast paths are worth security investigation.

더 확인하려면 구독해 주세요