SlideShare a Scribd company logo
1 of 18
The anatomy of ECMA 262-3 #1

Execution Context
κΉ€ν›ˆλ―Ό
ν”„λ‘ νŠΈμ—”λ“œκ°œλ°œνŒ€ / UIT κ°œλ°œμ‹€
2014.01.16
#1 Execution Context

10. Execution context
β€œWhen control is transferred to ECMAScript executable code, control is entering
an execution context. Active execution contexts logically form a stack. The top
execution context on this logical stack is the running execution context”
…
ECMA-262-3

μ œμ–΄κ°€ μ‹€ν–‰ μ½”λ“œλ₯Ό λ§Œλ‚˜λ©΄ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ‘œ λ“€μ–΄κ°„λ‹€.
μ—¬λŸ¬ 개의 μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλŠ” λ…Όλ¦¬μ μœΌλ‘œ μŠ€νƒμ˜ ν˜•νƒœλ₯Ό κ΅¬μ„±ν•œλ‹€.
#1 Execution Context

10.2 Entering An Execution context
β€œWhen control enters an execution context, the scope chain is created and
initialised, variable instantiation is performed, and the this value is determined.
The initialization of the scope chain, variable instantiation, and the determination
of the this value depend on the type of code being entered.”
ECMA-262-3

μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ‘œ μ œμ–΄κ°€ 이동 ν•˜λ©΄ μŠ€μ½”ν”„ 체인 생성, λ³€μˆ˜ μ΄ˆκΈ°ν™”λ₯Ό ν•˜κ³  this
값을 κ²°μ •ν•œλ‹€. μ„ΈλΆ€ 과정은 μ‹€ν–‰ μ½˜ν…μŠ€νŠΈμ— μ „λ‹¬ν•œ μ½”λ“œμ˜ μ’…λ₯˜μ— λ”°λΌμ„œ λ‹€
λ₯΄λ‹€.
#1 Execution Context

10.1.2 Types of Executable code
β€’

Global code is source text that is treated as an ECMAScript Program. …(생

β€’

Eval code is the source text supplied to the built-in eval function. More

β€’

랡)

precisely, if the parameter to the built-in eval function is a string, it is treated
as an ECMAScript Program. …(μƒλž΅)
Function code is source text that is parsed as part of a FunctionBody. The
function code of a particular FunctionBody does not include any source text
that is parsed as part of a nested FunctionBody. …(μƒλž΅)
ECMA-262-3
μ „μ—­ μ½”λ“œ(Global code), Eval μ½”λ“œ(Eval Code), ν•¨μˆ˜ μ½”λ“œ(Function Code)κ°€
μžˆλ‹€.
#1 Execution Context

Execution context…?
μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ, μ‹€ν–‰ λ¬Έλ§₯이라고도 함.
ECMAScript에 μ •μ˜λœ 좔상적인 κ°œλ…μœΌλ‘œ μ½”λ“œκ°€ μ‹€ν–‰λ˜λŠ” ν™˜κ²½μ„ 의미.

β€œλͺ¨λ“  Javascript μ½”λ“œλŠ” μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ μ•ˆμ—μ„œ λŒμ•„κ°„λ‹€.”
#1 Execution Context

μ œμ–΄κ°€ ECMAScript μ½”λ“œλ₯Ό λ§Œλ‚˜λ©΄ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ₯Ό μƒμ„±ν•œλ‹€.

Control

μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ
(Execution context)
#1 Execution Context

μƒμ„±ν•œ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλŠ” λ…Όλ¦¬μ μœΌλ‘œ μŠ€νƒμ˜ ν˜•νƒœλ₯Ό κ΅¬μ„±ν•œλ‹€.

Execution context stack

μž‘λ™μ€‘μΈ μ‹€ν–‰ λ¬Έλ§₯ - 3
(Execution context)

μ‹€ν–‰ λ¬Έλ§₯ - 2
(Execution context)
μ‹€ν–‰ λ¬Έλ§₯ - 1
(Execution context)
#1 Execution Context

μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλŠ” μŠ€μ½”ν”„ 체인 생성, λ³€μˆ˜ μ΄ˆκΈ°ν™”, this 값을 κ²°μ •ν•œλ‹€.

ExecutionContext = {
μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ
(Execution context)

}

μ΄ˆκΈ°ν™” 과정은 μ‹€ν–‰ μ½”λ“œμ˜ μ’…λ₯˜μ— λ”°λΌμ„œ λ‹€λ₯΄λ‹€.

λ³€μˆ˜, ν•¨μˆ˜, λ§€κ°œλ³€μˆ˜ 생성
μŠ€μ½”ν”„ 체인 생성,
this 바인딩,
…
#1 Execution Context

Executable Code…?
ν•˜λ‚˜μ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈμ—μ„œ μ²˜λ¦¬λ˜λŠ” JavaScript μ½”λ“œμ˜ λ‹¨μœ„.
ECMA-262λŠ” μ‹€ν–‰ μ½”λ“œλ₯Ό 3κ°€μ§€λ‘œ λΆ„λ₯˜.
β€’

μ „μ—­ μ½”λ“œ( Global code)
ECMAScript ν”„λ‘œκ·Έλž¨μ΄ μ΅œμ΄ˆμ— μ‹€ν–‰ν•˜λŠ” μ†ŒμŠ€ ν…μŠ€νŠΈ

β€’

ν•¨μˆ˜ μ½”λ“œ( Function code)
ν•¨μˆ˜ λͺΈμ²΄μ˜ λΆ€λΆ„μœΌλ‘œ 해석할 수 μžˆλŠ” μ†ŒμŠ€ ν…μŠ€νŠΈ

β€’

Eval μ½”λ“œ( Eval code)

λ‚΄μž₯ eval ν•¨μˆ˜μ— λ„˜κ²¨μ§„ μ†ŒμŠ€ ν…μŠ€νŠΈ
#1 Execution Context

μ „μ—­ μ½”λ“œ(Global code)
β€’ μ „μ—­ μ½”λ“œλŠ” ν”„λ‘œκ·Έλž¨ μˆ˜μ€€μ—μ„œ μ‹€ν–‰
β€’ Js νŒŒμΌμ„ λ‘œλ”©ν•˜κ±°λ‚˜ 지역 인라인 μ½”λ“œλ₯Ό λ§Œλ‚¬μ„ λ•Œ Javascript 엔진이 졜초둜 읽어 λ“€μ΄λŠ”
μ½”λ“œ
β€’ 처음 μ‹œμž‘ μ‹œ, μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ μŠ€νƒ(ECSTack)μ—λŠ” 였직 μ „μ—­ μ½˜ν…μŠ€νŠΈλ§Œ 쑴재
Control
Execution context stack

μ „μ—­ μ½˜ν…μŠ€νŠΈ
(Global context)
#1 Execution Context

μ „μ—­ μ½”λ“œ(Global code)의 λ²”μœ„
ν•¨μˆ˜ λͺΈμ²΄ μ•ˆμ˜ μ½”λ“œλŠ” μ „μ—­ μ½”λ“œμ— ν¬ν•¨λ˜μ§€ μ•ŠλŠ”λ‹€.
#1 Execution Context

ν•¨μˆ˜ μ½”λ“œ(Function code)
ν•¨μˆ˜ μ‹€ν–‰ μ½”λ“œλ₯Ό λ§Œλ‚˜λ©΄ μƒˆλ‘œμš΄ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ₯Ό μƒμ„±ν•˜μ—¬ ECStack에 λ„£λŠ”λ‹€.

Execution
context stack

person ν•¨μˆ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ
(Function execution context)
μ „μ—­ μ½˜ν…μŠ€νŠΈ
(Global context)

Control
#1 Execution Context

ν•¨μˆ˜ μ½”λ“œ(Function code)
μ—­μ‹œ ν•¨μˆ˜ λ‚΄λΆ€ 쀑첩 ν•¨μˆ˜μ˜ μ½”λ“œλŠ” ν•¨μˆ˜ μ½”λ“œμ— ν¬ν•¨λ˜μ§€ μ•ŠλŠ”
λ‹€.
#1 Execution Context

ν•¨μˆ˜ μ½”λ“œ(Function code)

Execution
context stack

getFirstName ν•¨μˆ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ
(Function execution context)
person ν•¨μˆ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ
(Function execution context)
μ „μ—­ μ½˜ν…μŠ€νŠΈ
(Global context)

Control
#1 Execution Context

eval μ½”λ“œ(eval code)
eval μ½”λ“œμ—λŠ” 호좜 μ½˜ν…μŠ€νŠΈ(calling context)λΌλŠ” κ°œλ…μ΄ 쑴재
#1 Execution Context

Execution context stack

Execution context stack
μž‘λ™μ€‘μΈ μ‹€ν–‰ λ¬Έλ§₯
(Eval context)

μ‹€ν–‰ λ¬Έλ§₯ - 2

(Function execution context)

μ‹€ν–‰ λ¬Έλ§₯ - 1

(Function execution context)

μ „μ—­ μ‹€ν–‰ λ¬Έλ§₯
(Global context)
#1 Execution Context

더 μžμ„Έν•œ λ‚΄μš©μ€β€¦
β€’

원문 : http://dmitrysoshnikov.com/ecmascript/chapter-1-execution-contexts/

β€’

λ²ˆμ—­ : http://huns.me/%EB%B2%88%EC%97%AD-ecma-262-3-in-detailchapter-1-execution-contexts/
Thank you.

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
Β 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
Β 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
Β 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
Β 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
Β 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
Β 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
Β 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
Β 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
Β 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
Β 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
Β 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
Β 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
Β 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
Β 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data ScienceChristy Abraham Joy
Β 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
Β 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
Β 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
Β 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Β 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Β 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Β 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
Β 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Β 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Β 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Β 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
Β 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Β 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Β 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Β 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
Β 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Β 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Β 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Β 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Β 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Β 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Β 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
Β 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Β 

Anatomy of js_2014_execution_context

  • 1. The anatomy of ECMA 262-3 #1 Execution Context κΉ€ν›ˆλ―Ό ν”„λ‘ νŠΈμ—”λ“œκ°œλ°œνŒ€ / UIT κ°œλ°œμ‹€ 2014.01.16
  • 2. #1 Execution Context 10. Execution context β€œWhen control is transferred to ECMAScript executable code, control is entering an execution context. Active execution contexts logically form a stack. The top execution context on this logical stack is the running execution context” … ECMA-262-3 μ œμ–΄κ°€ μ‹€ν–‰ μ½”λ“œλ₯Ό λ§Œλ‚˜λ©΄ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ‘œ λ“€μ–΄κ°„λ‹€. μ—¬λŸ¬ 개의 μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλŠ” λ…Όλ¦¬μ μœΌλ‘œ μŠ€νƒμ˜ ν˜•νƒœλ₯Ό κ΅¬μ„±ν•œλ‹€.
  • 3. #1 Execution Context 10.2 Entering An Execution context β€œWhen control enters an execution context, the scope chain is created and initialised, variable instantiation is performed, and the this value is determined. The initialization of the scope chain, variable instantiation, and the determination of the this value depend on the type of code being entered.” ECMA-262-3 μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ‘œ μ œμ–΄κ°€ 이동 ν•˜λ©΄ μŠ€μ½”ν”„ 체인 생성, λ³€μˆ˜ μ΄ˆκΈ°ν™”λ₯Ό ν•˜κ³  this 값을 κ²°μ •ν•œλ‹€. μ„ΈλΆ€ 과정은 μ‹€ν–‰ μ½˜ν…μŠ€νŠΈμ— μ „λ‹¬ν•œ μ½”λ“œμ˜ μ’…λ₯˜μ— λ”°λΌμ„œ λ‹€ λ₯΄λ‹€.
  • 4. #1 Execution Context 10.1.2 Types of Executable code β€’ Global code is source text that is treated as an ECMAScript Program. …(생 β€’ Eval code is the source text supplied to the built-in eval function. More β€’ 랡) precisely, if the parameter to the built-in eval function is a string, it is treated as an ECMAScript Program. …(μƒλž΅) Function code is source text that is parsed as part of a FunctionBody. The function code of a particular FunctionBody does not include any source text that is parsed as part of a nested FunctionBody. …(μƒλž΅) ECMA-262-3 μ „μ—­ μ½”λ“œ(Global code), Eval μ½”λ“œ(Eval Code), ν•¨μˆ˜ μ½”λ“œ(Function Code)κ°€ μžˆλ‹€.
  • 5. #1 Execution Context Execution context…? μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ, μ‹€ν–‰ λ¬Έλ§₯이라고도 함. ECMAScript에 μ •μ˜λœ 좔상적인 κ°œλ…μœΌλ‘œ μ½”λ“œκ°€ μ‹€ν–‰λ˜λŠ” ν™˜κ²½μ„ 의미. β€œλͺ¨λ“  Javascript μ½”λ“œλŠ” μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ μ•ˆμ—μ„œ λŒμ•„κ°„λ‹€.”
  • 6. #1 Execution Context μ œμ–΄κ°€ ECMAScript μ½”λ“œλ₯Ό λ§Œλ‚˜λ©΄ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ₯Ό μƒμ„±ν•œλ‹€. Control μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ (Execution context)
  • 7. #1 Execution Context μƒμ„±ν•œ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλŠ” λ…Όλ¦¬μ μœΌλ‘œ μŠ€νƒμ˜ ν˜•νƒœλ₯Ό κ΅¬μ„±ν•œλ‹€. Execution context stack μž‘λ™μ€‘μΈ μ‹€ν–‰ λ¬Έλ§₯ - 3 (Execution context) μ‹€ν–‰ λ¬Έλ§₯ - 2 (Execution context) μ‹€ν–‰ λ¬Έλ§₯ - 1 (Execution context)
  • 8. #1 Execution Context μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλŠ” μŠ€μ½”ν”„ 체인 생성, λ³€μˆ˜ μ΄ˆκΈ°ν™”, this 값을 κ²°μ •ν•œλ‹€. ExecutionContext = { μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ (Execution context) } μ΄ˆκΈ°ν™” 과정은 μ‹€ν–‰ μ½”λ“œμ˜ μ’…λ₯˜μ— λ”°λΌμ„œ λ‹€λ₯΄λ‹€. λ³€μˆ˜, ν•¨μˆ˜, λ§€κ°œλ³€μˆ˜ 생성 μŠ€μ½”ν”„ 체인 생성, this 바인딩, …
  • 9. #1 Execution Context Executable Code…? ν•˜λ‚˜μ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈμ—μ„œ μ²˜λ¦¬λ˜λŠ” JavaScript μ½”λ“œμ˜ λ‹¨μœ„. ECMA-262λŠ” μ‹€ν–‰ μ½”λ“œλ₯Ό 3κ°€μ§€λ‘œ λΆ„λ₯˜. β€’ μ „μ—­ μ½”λ“œ( Global code) ECMAScript ν”„λ‘œκ·Έλž¨μ΄ μ΅œμ΄ˆμ— μ‹€ν–‰ν•˜λŠ” μ†ŒμŠ€ ν…μŠ€νŠΈ β€’ ν•¨μˆ˜ μ½”λ“œ( Function code) ν•¨μˆ˜ λͺΈμ²΄μ˜ λΆ€λΆ„μœΌλ‘œ 해석할 수 μžˆλŠ” μ†ŒμŠ€ ν…μŠ€νŠΈ β€’ Eval μ½”λ“œ( Eval code) λ‚΄μž₯ eval ν•¨μˆ˜μ— λ„˜κ²¨μ§„ μ†ŒμŠ€ ν…μŠ€νŠΈ
  • 10. #1 Execution Context μ „μ—­ μ½”λ“œ(Global code) β€’ μ „μ—­ μ½”λ“œλŠ” ν”„λ‘œκ·Έλž¨ μˆ˜μ€€μ—μ„œ μ‹€ν–‰ β€’ Js νŒŒμΌμ„ λ‘œλ”©ν•˜κ±°λ‚˜ 지역 인라인 μ½”λ“œλ₯Ό λ§Œλ‚¬μ„ λ•Œ Javascript 엔진이 졜초둜 읽어 λ“€μ΄λŠ” μ½”λ“œ β€’ 처음 μ‹œμž‘ μ‹œ, μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ μŠ€νƒ(ECSTack)μ—λŠ” 였직 μ „μ—­ μ½˜ν…μŠ€νŠΈλ§Œ 쑴재 Control Execution context stack μ „μ—­ μ½˜ν…μŠ€νŠΈ (Global context)
  • 11. #1 Execution Context μ „μ—­ μ½”λ“œ(Global code)의 λ²”μœ„ ν•¨μˆ˜ λͺΈμ²΄ μ•ˆμ˜ μ½”λ“œλŠ” μ „μ—­ μ½”λ“œμ— ν¬ν•¨λ˜μ§€ μ•ŠλŠ”λ‹€.
  • 12. #1 Execution Context ν•¨μˆ˜ μ½”λ“œ(Function code) ν•¨μˆ˜ μ‹€ν–‰ μ½”λ“œλ₯Ό λ§Œλ‚˜λ©΄ μƒˆλ‘œμš΄ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈλ₯Ό μƒμ„±ν•˜μ—¬ ECStack에 λ„£λŠ”λ‹€. Execution context stack person ν•¨μˆ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ (Function execution context) μ „μ—­ μ½˜ν…μŠ€νŠΈ (Global context) Control
  • 13. #1 Execution Context ν•¨μˆ˜ μ½”λ“œ(Function code) μ—­μ‹œ ν•¨μˆ˜ λ‚΄λΆ€ 쀑첩 ν•¨μˆ˜μ˜ μ½”λ“œλŠ” ν•¨μˆ˜ μ½”λ“œμ— ν¬ν•¨λ˜μ§€ μ•ŠλŠ” λ‹€.
  • 14. #1 Execution Context ν•¨μˆ˜ μ½”λ“œ(Function code) Execution context stack getFirstName ν•¨μˆ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ (Function execution context) person ν•¨μˆ˜ μ‹€ν–‰ μ½˜ν…μŠ€νŠΈ (Function execution context) μ „μ—­ μ½˜ν…μŠ€νŠΈ (Global context) Control
  • 15. #1 Execution Context eval μ½”λ“œ(eval code) eval μ½”λ“œμ—λŠ” 호좜 μ½˜ν…μŠ€νŠΈ(calling context)λΌλŠ” κ°œλ…μ΄ 쑴재
  • 16. #1 Execution Context Execution context stack Execution context stack μž‘λ™μ€‘μΈ μ‹€ν–‰ λ¬Έλ§₯ (Eval context) μ‹€ν–‰ λ¬Έλ§₯ - 2 (Function execution context) μ‹€ν–‰ λ¬Έλ§₯ - 1 (Function execution context) μ „μ—­ μ‹€ν–‰ λ¬Έλ§₯ (Global context)
  • 17. #1 Execution Context 더 μžμ„Έν•œ λ‚΄μš©μ€β€¦ β€’ 원문 : http://dmitrysoshnikov.com/ecmascript/chapter-1-execution-contexts/ β€’ λ²ˆμ—­ : http://huns.me/%EB%B2%88%EC%97%AD-ecma-262-3-in-detailchapter-1-execution-contexts/