v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-disposable-stack.h
Go to the documentation of this file.
1// Copyright 2024 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_OBJECTS_JS_DISPOSABLE_STACK_H_
6#define V8_OBJECTS_JS_DISPOSABLE_STACK_H_
7
15#include "torque-generated/bit-fields.h"
16
17// Has to be the last include (doesn't have include guards):
19
20namespace v8 {
21namespace internal {
22
23#include "torque-generated/src/objects/js-disposable-stack-tq.inc"
24
25// Valid states for a DisposableStack.
26// https://arai-a.github.io/ecma262-compare/?pr=3000&id=sec-disposablestack-objects
28
29// kValueIsReceiver: Call the method with no argument
30// kValueIsArgument: Pass the value as the argument to the dispose method,
31// `disposablestack.prototype.adopt` is the only method that uses
32// kValueIsArgument as DisposeMethodCallType.
34
35// Valid hints for a DisposableStack.
36// https://arai-a.github.io/ecma262-compare/?pr=3000&id=sec-disposableresource-records
38
39// Types of disposable resources in a DisposableStack.
41
45
47 : public TorqueGeneratedJSDisposableStackBase<JSDisposableStackBase,
48 JSObject> {
49 public:
52
53 DEFINE_TORQUE_GENERATED_DISPOSABLE_STACK_STATUS()
54 inline DisposableStackState state() const;
55 inline void set_state(DisposableStackState value);
57 DECL_BOOLEAN_ACCESSORS(has_awaited)
59 DECL_INT_ACCESSORS(length)
60
66
71
74 static void Add(Isolate* isolate,
79 Isolate* isolate, DirectHandle<JSAny> value, DisposeMethodHint hint);
81 Isolate* isolate, DirectHandle<JSDisposableStackBase> disposable_stack,
82 DisposableStackResourcesType resources_type);
84 Isolate* isolate, DirectHandle<Object> value);
85 static void HandleErrorInDisposal(
86 Isolate* isolate, DirectHandle<JSDisposableStackBase> disposable_stack,
87 DirectHandle<Object> current_error,
88 DirectHandle<Object> current_error_message);
89
91};
92
94 : public TorqueGeneratedJSSyncDisposableStack<JSSyncDisposableStack,
95 JSDisposableStackBase> {
96 public:
98
100};
101
103 : public TorqueGeneratedJSAsyncDisposableStack<JSAsyncDisposableStack,
104 JSDisposableStackBase> {
105 public:
108
110 Isolate* isolate,
111 DirectHandle<JSDisposableStackBase> async_disposable_stack,
112 DirectHandle<JSPromise> outer_promise);
113
115};
116
117} // namespace internal
118} // namespace v8
119
121
122#endif // V8_OBJECTS_JS_DISPOSABLE_STACK_H_
static Maybe< bool > NextDisposeAsyncIteration(Isolate *isolate, DirectHandle< JSDisposableStackBase > async_disposable_stack, DirectHandle< JSPromise > outer_promise)
static void InitializeJSDisposableStackBase(Isolate *isolate, DirectHandle< JSDisposableStackBase > stack)
Definition objects.cc:6384
static void HandleErrorInDisposal(Isolate *isolate, DirectHandle< JSDisposableStackBase > disposable_stack, DirectHandle< Object > current_error, DirectHandle< Object > current_error_message)
static MaybeDirectHandle< Object > DisposeResources(Isolate *isolate, DirectHandle< JSDisposableStackBase > disposable_stack, DisposableStackResourcesType resources_type)
static void Add(Isolate *isolate, DirectHandle< JSDisposableStackBase > disposable_stack, DirectHandle< Object > value, DirectHandle< Object > method, DisposeMethodCallType type, DisposeMethodHint hint)
static MaybeDirectHandle< Object > CheckValueAndGetDisposeMethod(Isolate *isolate, DirectHandle< JSAny > value, DisposeMethodHint hint)
static MaybeDirectHandle< JSReceiver > ResolveAPromiseWithValueAndReturnIt(Isolate *isolate, DirectHandle< Object > value)
void set_state(DisposableStackState value)
JSDisposableStackBase::NeedsAwaitBit suppressed_error_created
#define DECL_VERIFIER(Name)
#define DECL_BOOLEAN_ACCESSORS(name)
#define DECL_PRINTER(Name)
#define DECL_INT_ACCESSORS(name)
#define TQ_OBJECT_CONSTRUCTORS(Type)
Symbol method