V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
rabbbit
V2EX  ›  问与答

[js 问题]call stack 和 execution context stack 是同一个东西吗?

  •  
  •   rabbbit · Mar 12, 2019 · 1084 views
    This topic created in 2613 days ago, the information mentioned may be changed or developed.

    好多讲 event loop 的资料都会提到 call stack(也有叫 stack/调用栈 /执行栈 之类的,反正是乱七八糟叫啥的都有). 翻了翻 ECAMScript 文档,没搜到 call stack,倒是有个类似的execution context stack. 这俩玩意指的是同一个东西吗?

    Supplement 1  ·  Mar 12, 2019
    ECMAScript 里有个关于 job 的描述
    >Execution of a Job can be initiated only when there is no running execution context and the execution context stack is empty.
    指明了 job 队列会在 execution context stack 为空时运行

    因此,这些文章里所谓的 stack 应该就是 execution context stack 吧.

    结贴
    Supplement 2  ·  Mar 13, 2019
    2 replies    2019-03-12 19:42:00 +08:00
    rabbbit
        1
    rabbbit  
    OP
       Mar 12, 2019
    补一下各种叫法:
    阮一峰的文章里就叫 stack http://www.ruanyifeng.com/blog/2014/10/event-loop.html
    这篇文章里 called stack/stack/call stack 混用 https://pjchender.blogspot.com/2017/08/javascript-learn-event-loop-stack-queue.html
    mdn 能查到一个叫 call stack 的页面 https://developer.mozilla.org/zh-CN/docs/Glossary/Call_stack
    这堆 stack 指的和 execution context stack 是不是同一个东西?
    MrKou47
        2
    MrKou47  
       Mar 12, 2019 via iPhone   ❤️ 1
    可以在 whatwg 上找一下,有些规范 ecma 只是给出一个指导意见,具体实现或者名词的叫法还是会有差异的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5932 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 06:33 · PVG 14:33 · LAX 23:33 · JFK 02:33
    ♥ Do have faith in what you're doing.