D</a> algorithm on <var>stack</var>.</li>
        <li>Add <var>sample</var> to the <a>ProfilerTrace.samples</a> associated with the session's <a>ProfilerTrace</a>.</li>
      </ol>
      <p>
      To <dfn>get a stack ID</dfn> given an <a>execution context stack</a> bound to <var>stack</var>, perform the following steps:
      <ol>
        <li>If <var>stack</var> is empty, return <code>undefined</code>.</li>
        <li>Let <var>head</var> be the top element of <var>stack</var>, and <var>tail</var> be the re