Documentation
¶
Index ¶
- type Agent
- func (a *Agent) AgentCanSuspend() bool
- func (a *Agent) AgentSignifier() ID
- func (a *Agent) EnqueueJob(q QueueKind, jobName string, arguments []lang.Value)
- func (a *Agent) GetActiveScriptOrModule() lang.InternalValue
- func (a *Agent) GetGlobalObject() lang.Value
- func (a *Agent) GetNewTarget() lang.Value
- func (a *Agent) GetThisEnvironment() binding.Environment
- func (a *Agent) InitializeHostDefinedRealm()
- func (a *Agent) ResolveBinding(name lang.String, env binding.Environment) *binding.Reference
- func (a *Agent) ResolveThisBinding() (lang.Value, errors.Error)
- func (a *Agent) RunJobs()
- func (a *Agent) RunningExecutionContext() *ExecutionContext
- type ExecutionContext
- type ExecutionContextStack
- type ID
- type QueueKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { ExecutionContextStack *ExecutionContextStack LittleEndian bool CanBlock bool Signifier ID IsLockFree1 bool IsLockFree2 bool CandidateExecution interface{} // #37: Implement Table 26, CandidateExecutionRecord ScriptJobs *job.Queue PromiseJobs *job.Queue }
Agent comprises a set of ECMAScript execution contexts, an execution context stack, a running execution context, a set of named job queues, an Agent Record, and an executing thread. Except for the executing thread, the constituents of an agent belong exclusively to that agent. An agent's executing thread executes the jobs in the agent's job queues on the agent's execution contexts independently of other agents, except that an executing thread may be used as the executing thread by multiple agents, provided none of the agents sharing the thread have an Agent Record whose [[CanBlock]] property is true. While an agent's executing thread executes the jobs in the agent's job queues, the agent is the surrounding agent for the code in those jobs. The code uses the surrounding agent to access the specification level execution objects held within the agent: the running execution context, the execution context stack, the named job queues, and the Agent Record's fields. Agent is specified in 8.7.
func (*Agent) AgentCanSuspend ¶
AgentCanSuspend returns the CanBlock value of the agent.
func (*Agent) AgentSignifier ¶
AgentSignifier returns the Signifier of the agent.
func (*Agent) EnqueueJob ¶
EnqueueJob enqueues a new job into a given kind of queue, script or promise. EnqueueJob is specified in 8.4.1.
func (*Agent) GetActiveScriptOrModule ¶
func (a *Agent) GetActiveScriptOrModule() lang.InternalValue
GetActiveScriptOrModule returns the active script or module. GetActiveScriptOrModule is specified in 8.3.1.
func (*Agent) GetGlobalObject ¶
GetGlobalObject returns the global object used by the running execution context. GetGlobalObject is specified in 8.3.6.
func (*Agent) GetNewTarget ¶
GetNewTarget determines the NewTarget using the lexical environment of the running execution context. GetNewTarget is specified in 8.3.5.
func (*Agent) GetThisEnvironment ¶
func (a *Agent) GetThisEnvironment() binding.Environment
GetThisEnvironment returns the current environment that currently supplies the binding for the keyword 'this'. GetThisEnvironment is specified in 8.3.3.
func (*Agent) InitializeHostDefinedRealm ¶
func (a *Agent) InitializeHostDefinedRealm()
InitializeHostDefinedRealm is specified in 8.5.
func (*Agent) ResolveBinding ¶
ResolveBinding is used to determine the binding with the given name. The optional argument env can be used to explicitly provide the Lexical Environment that is to be searched for the binding. During execution of ECMAScript code, ResolveBinding is performed using the following algorithm. ResolveBinding is specified in 8.3.2.
func (*Agent) ResolveThisBinding ¶
ResolveThisBinding determines the binding of the keyword 'this' using the LexicalEnvironment of the running execution context. ResolveThisBinding is specified in 8.3.4.
func (*Agent) RunningExecutionContext ¶
func (a *Agent) RunningExecutionContext() *ExecutionContext
RunningExecutionContext returns the currently executing ExecutionContext of this agent.
type ExecutionContext ¶
type ExecutionContext struct { Function lang.Value // Object or Null Realm *realm.Realm ScriptOrModule lang.InternalValue LexicalEnvironment binding.Environment VariableEnvironment binding.Environment Generator interface{} // #41: Table 23, GeneratorObject }
ExecutionContext is a specification device that is used to track the runtime evaluation of code by an ECMAScript implementation. At any point in time, there is at most one execution context per agent that is actually executing code. This is known as the agent's running execution context. All references to the running execution context in this specification denote the running execution context of the surrounding agent. ExecutionContext is specified in 8.3.
type ExecutionContextStack ¶
type ExecutionContextStack struct {
// contains filtered or unexported fields
}
ExecutionContextStack is a stack that is used to keep track of the currently executing and soon to execute ExecutionContexts. ExecutionContextStack is mentioned in 8.3.
func NewExecutionContextStack ¶
func NewExecutionContextStack() *ExecutionContextStack
NewExecutionContextStack creates a new ExecutionContextStack that is using a SliceStack.
func (ExecutionContextStack) IsEmpty ¶
func (s ExecutionContextStack) IsEmpty() bool
IsEmpty is used to determine if there are any ExecutionContexts on the stack.
func (ExecutionContextStack) Peek ¶
func (s ExecutionContextStack) Peek() *ExecutionContext
Peek returns the topmost ExecutionContext without removing it.
func (ExecutionContextStack) Pop ¶
func (s ExecutionContextStack) Pop() *ExecutionContext
Pop removes the topmost ExecutionContext from the stack and returns it.
func (ExecutionContextStack) Push ¶
func (s ExecutionContextStack) Push(ctx *ExecutionContext)
Push adds a new ExecutionContext to the stack.
type ID ¶
ID is a type alias for uuid.UUID, in order to be independent of uuid.UUID as a unique identifier.