docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
---
|
||||
id: wiki-2026-0508-javascriptcore
|
||||
title: JavaScriptCore
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [JSC, WebKit JSC, Nitro]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [javascript, engine, webkit, jit]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: C++
|
||||
framework: WebKit
|
||||
---
|
||||
|
||||
# JavaScriptCore
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 Apple WebKit 의 JavaScript 엔진 — 4-tier JIT pipeline (LLInt → Baseline → DFG → FTL/B3)"**. Safari, iOS WebView, React Native (Hermes 도입 전), Bun runtime의 core. 매 V8 대비 startup 빠름, peak performance 비슷 — 매 mobile-first 최적화.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 4-Tier JIT Pipeline
|
||||
- **LLInt** (Low-Level Interpreter): 매 첫 실행, profiling 시작.
|
||||
- **Baseline JIT**: 매 hot 코드 → simple machine code, type feedback 수집.
|
||||
- **DFG** (Data Flow Graph): 매 speculative optimization, OSR exit 가능.
|
||||
- **FTL** (Faster Than Light) / B3 backend: 매 최상위 tier, LLVM-style IR.
|
||||
|
||||
### 매 GC
|
||||
- **Riptide**: 매 generational + concurrent mark-and-sweep.
|
||||
- **Eden GC**: 매 young objects, frequent.
|
||||
- **Full GC**: 매 entire heap, infrequent.
|
||||
|
||||
### 매 응용
|
||||
1. Safari / WKWebView (iOS, macOS).
|
||||
2. Bun runtime — 매 Node.js 대안, JSC 채택 (V8 X).
|
||||
3. React Native (legacy iOS, Hermes 이전).
|
||||
4. GNOME / GTK WebKitGTK.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Bun runtime — JSC embed
|
||||
```javascript
|
||||
// bun runs JS via JSC (not V8)
|
||||
// startup: ~10ms vs Node ~30ms
|
||||
import { serve } from "bun";
|
||||
|
||||
serve({
|
||||
port: 3000,
|
||||
fetch(req) {
|
||||
return new Response("Hello from JSC");
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Inline cache observation (JSC IR dump)
|
||||
```bash
|
||||
# JSC bytecode dump
|
||||
JSC_dumpBytecodesAfterGeneration=true \
|
||||
/System/Library/Frameworks/JavaScriptCore.framework/Helpers/jsc script.js
|
||||
|
||||
# DFG/FTL 단계 확인
|
||||
JSC_dumpDFGGraphAtEachPhase=true jsc script.js
|
||||
```
|
||||
|
||||
### Hidden class friendly object
|
||||
```javascript
|
||||
// JSC structure (V8의 hidden class 와 동일 개념)
|
||||
function Point(x, y) {
|
||||
this.x = x; // structure transition T0 → T1
|
||||
this.y = y; // T1 → T2
|
||||
}
|
||||
// T2 가 stable → inline cache hit
|
||||
```
|
||||
|
||||
### Type feedback (monomorphic 유지)
|
||||
```javascript
|
||||
function add(a, b) { return a + b; }
|
||||
add(1, 2); // int+int → DFG int specialization
|
||||
add(1.5, 2.5); // float+float → polymorphic, slower
|
||||
|
||||
// 매 monomorphic 유지 — 매 동일 type 만 호출
|
||||
```
|
||||
|
||||
### OffHeap typed array (Bun)
|
||||
```javascript
|
||||
// JSC 의 ArrayBuffer 는 GC 외부 — large data 적합
|
||||
const buf = new ArrayBuffer(1024 * 1024 * 100); // 100MB
|
||||
const view = new Uint8Array(buf);
|
||||
// 매 GC pressure X
|
||||
```
|
||||
|
||||
### WeakRef (JSC 1.16+)
|
||||
```javascript
|
||||
const cache = new WeakRef(largeObject);
|
||||
// 매 GC 가 collect 가능 — memory pressure 시 free
|
||||
const ref = cache.deref();
|
||||
if (ref) { /* still alive */ }
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| iOS native app + JS | JSC (WKWebView 또는 JavaScriptCore.framework) |
|
||||
| Cross-platform server | V8 (Node.js) — 매 ecosystem 큼 |
|
||||
| Fast startup CLI | Bun (JSC) — 매 startup 압도적 |
|
||||
| RN new architecture | Hermes — 매 mobile 최적화 |
|
||||
|
||||
**기본값**: server는 V8/Node, mobile WebView는 JSC, fast CLI는 Bun.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[WebKit]]
|
||||
- 변형: [[V8]] · [[Hermes]]
|
||||
- 응용: [[React Native]]
|
||||
- Adjacent: [[Garbage Collection]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: iOS WebView 성능 분석, Bun 코드 최적화, JSC-specific bug 진단.
|
||||
**언제 X**: Node.js / Chrome 환경 — 매 V8 별도 문서.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Polymorphic call sites**: 매 inline cache miss → DFG bailout.
|
||||
- **delete operator**: 매 hidden class transition 깨짐 — 매 undefined 할당으로 대체.
|
||||
- **arguments object 남용**: 매 modern JSC 는 rest params 가 빠름.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (WebKit Wiki, JSC source — github.com/WebKit/WebKit).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — JSC 4-tier pipeline + Bun 응용 |
|
||||
Reference in New Issue
Block a user