mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 04:18:58 +00:00
wip direct streams
This commit is contained in:
@@ -2245,6 +2245,17 @@ pub const ArrayBuffer = extern struct {
|
||||
return Stream{ .pos = 0, .buf = this.slice() };
|
||||
}
|
||||
|
||||
pub fn create(globalThis: *JSC.JSGlobalObject, bytes: []const u8, comptime kind: JSC.JSValue.JSType) JSValue {
|
||||
return switch (comptime kind) {
|
||||
.Uint8Array => Bun__createUninitializedUint8ArrayForCopy(globalThis, bytes.ptr, bytes.len),
|
||||
.ArrayBuffer => Bun__createUninitializedArrayBufferForCopy(globalThis, bytes.ptr, bytes.len),
|
||||
else => @compileError("Not implemented yet"),
|
||||
};
|
||||
}
|
||||
|
||||
extern "C" fn Bun__createUninitializedArrayBufferForCopy(*JSC.JSGlobalObject, ptr: *const anyopaque, len: usize) JSValue;
|
||||
extern "C" fn Bun__createUninitializedUint8ArrayForCopy(*JSC.JSGlobalObject, ptr: *const anyopaque, len: usize) JSValue;
|
||||
|
||||
pub fn fromTypedArray(ctx: JSC.C.JSContextRef, value: JSC.JSValue, _: JSC.C.ExceptionRef) ArrayBuffer {
|
||||
var out = std.mem.zeroes(ArrayBuffer);
|
||||
std.debug.assert(value.asArrayBuffer_(ctx.ptr(), &out));
|
||||
|
||||
@@ -42,8 +42,7 @@ using namespace JSC;
|
||||
macro(argv) \
|
||||
macro(associatedReadableByteStreamController) \
|
||||
macro(autoAllocateChunkSize) \
|
||||
macro(backingMap) \
|
||||
macro(backingSet) \
|
||||
macro(startDirectStream) \
|
||||
macro(backpressure) \
|
||||
macro(backpressureChangePromise) \
|
||||
macro(basename) \
|
||||
@@ -64,13 +63,13 @@ using namespace JSC;
|
||||
macro(closedPromiseCapability) \
|
||||
macro(code) \
|
||||
macro(connect) \
|
||||
macro(consumeReadableStream) \
|
||||
macro(controlledReadableStream) \
|
||||
macro(controller) \
|
||||
macro(consumeReadableStream) \
|
||||
macro(cork) \
|
||||
macro(createEmptyReadableStream) \
|
||||
macro(createFIFO) \
|
||||
macro(createNativeReadableStream) \
|
||||
macro(createEmptyReadableStream) \
|
||||
macro(createReadableStream) \
|
||||
macro(createUninitializedArrayBuffer) \
|
||||
macro(createWritableStreamFromInternal) \
|
||||
@@ -81,6 +80,7 @@ using namespace JSC;
|
||||
macro(destroy) \
|
||||
macro(dir) \
|
||||
macro(dirname) \
|
||||
macro(direct) \
|
||||
macro(disturbed) \
|
||||
macro(document) \
|
||||
macro(encode) \
|
||||
@@ -181,8 +181,10 @@ using namespace JSC;
|
||||
macro(sep) \
|
||||
macro(setBody) \
|
||||
macro(setStatus) \
|
||||
macro(sink) \
|
||||
macro(size) \
|
||||
macro(start) \
|
||||
macro(startAlgorithm) \
|
||||
macro(startConsumingStream) \
|
||||
macro(started) \
|
||||
macro(startedPromise) \
|
||||
|
||||
538
src/javascript/jsc/bindings/FFI.zig
Normal file
538
src/javascript/jsc/bindings/FFI.zig
Normal file
@@ -0,0 +1,538 @@
|
||||
// This is zig translate-c run on ffi.h
|
||||
// it turns out: FFI.h is faster than our implementation that calls into C++ bindings
|
||||
// so we just use this in some cases
|
||||
|
||||
pub const @"bool" = bool;
|
||||
pub const JSCell = ?*anyopaque;
|
||||
const struct_unnamed_1 = extern struct {
|
||||
payload: i32,
|
||||
tag: i32,
|
||||
};
|
||||
pub const union_EncodedJSValue = extern union {
|
||||
asInt64: i64,
|
||||
ptr: [*c]JSCell,
|
||||
asBits: struct_unnamed_1,
|
||||
asPtr: ?*anyopaque,
|
||||
asDouble: f64,
|
||||
asJSValue: @import("./bindings.zig").JSValue,
|
||||
};
|
||||
pub const EncodedJSValue = union_EncodedJSValue;
|
||||
pub export var ValueUndefined: EncodedJSValue = EncodedJSValue{
|
||||
.asInt64 = @bitCast(i64, @as(c_longlong, @as(c_int, 2) | @as(c_int, 8))),
|
||||
};
|
||||
pub export var ValueTrue: EncodedJSValue = EncodedJSValue{
|
||||
.asInt64 = @bitCast(i64, @as(c_longlong, (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1))),
|
||||
};
|
||||
pub const JSContext = ?*anyopaque;
|
||||
pub inline fn JSVALUE_IS_CELL(arg_val: EncodedJSValue) @"bool" {
|
||||
const val = arg_val;
|
||||
return !(((@bitCast(c_ulonglong, val.asInt64) & @as(c_ulonglong, 18446181123756130304)) | @bitCast(c_ulonglong, @as(c_longlong, @as(c_int, 2)))) != 0);
|
||||
}
|
||||
pub inline fn JSVALUE_IS_INT32(arg_val: EncodedJSValue) @"bool" {
|
||||
const val = arg_val;
|
||||
return (@bitCast(c_ulonglong, val.asInt64) & @as(c_ulonglong, 18446181123756130304)) == @as(c_ulonglong, 18446181123756130304);
|
||||
}
|
||||
pub inline fn JSVALUE_IS_NUMBER(arg_val: EncodedJSValue) @"bool" {
|
||||
const val = arg_val;
|
||||
return (@bitCast(c_ulonglong, val.asInt64) & @as(c_ulonglong, 18446181123756130304)) != 0;
|
||||
}
|
||||
pub inline fn JSVALUE_TO_UINT64(arg_globalObject: ?*anyopaque, arg_value: EncodedJSValue) u64 {
|
||||
var globalObject = arg_globalObject;
|
||||
var value = arg_value;
|
||||
if (JSVALUE_IS_INT32(value)) {
|
||||
return @bitCast(u64, @as(c_longlong, JSVALUE_TO_INT32(value)));
|
||||
}
|
||||
if (JSVALUE_IS_NUMBER(value)) {
|
||||
return @floatToInt(u64, JSVALUE_TO_DOUBLE(value));
|
||||
}
|
||||
return JSVALUE_TO_UINT64_SLOW(globalObject, value);
|
||||
}
|
||||
pub inline fn JSVALUE_TO_INT64(arg_value: EncodedJSValue) i64 {
|
||||
const value = arg_value;
|
||||
if (JSVALUE_IS_INT32(value)) {
|
||||
return @bitCast(i64, @as(c_longlong, JSVALUE_TO_INT32(value)));
|
||||
}
|
||||
if (JSVALUE_IS_NUMBER(value)) {
|
||||
return @floatToInt(i64, JSVALUE_TO_DOUBLE(value));
|
||||
}
|
||||
return JSVALUE_TO_INT64_SLOW(value);
|
||||
}
|
||||
pub extern fn JSVALUE_TO_UINT64_SLOW(globalObject: ?*anyopaque, value: EncodedJSValue) u64;
|
||||
pub extern fn JSVALUE_TO_INT64_SLOW(value: EncodedJSValue) i64;
|
||||
pub extern fn UINT64_TO_JSVALUE_SLOW(globalObject: ?*anyopaque, val: u64) EncodedJSValue;
|
||||
pub extern fn INT64_TO_JSVALUE_SLOW(globalObject: ?*anyopaque, val: i64) EncodedJSValue;
|
||||
pub inline fn UINT64_TO_JSVALUE(arg_globalObject: ?*anyopaque, arg_val: u64) EncodedJSValue {
|
||||
var globalObject = arg_globalObject;
|
||||
const val = arg_val;
|
||||
if (val < @bitCast(c_ulonglong, @as(c_longlong, @as(c_long, 2147483648)))) {
|
||||
return INT32_TO_JSVALUE(@bitCast(i32, @truncate(c_uint, val)));
|
||||
}
|
||||
if (val < @bitCast(c_ulonglong, @as(c_longlong, @as(c_long, 9007199254740991)))) {
|
||||
return DOUBLE_TO_JSVALUE(@intToFloat(f64, val));
|
||||
}
|
||||
return UINT64_TO_JSVALUE_SLOW(globalObject, val);
|
||||
}
|
||||
pub inline fn INT64_TO_JSVALUE(arg_globalObject: ?*anyopaque, arg_val: i64) EncodedJSValue {
|
||||
var globalObject = arg_globalObject;
|
||||
var val = arg_val;
|
||||
if ((val >= @bitCast(c_longlong, @as(c_longlong, -@as(c_long, 2147483648)))) and (val <= @bitCast(c_longlong, @as(c_longlong, @as(c_long, 2147483648))))) {
|
||||
return INT32_TO_JSVALUE(@bitCast(i32, @truncate(c_int, val)));
|
||||
}
|
||||
if ((val >= @bitCast(c_longlong, @as(c_longlong, -@as(c_long, 9007199254740991)))) and (val <= @bitCast(c_longlong, @as(c_longlong, @as(c_long, 9007199254740991))))) {
|
||||
return DOUBLE_TO_JSVALUE(@intToFloat(f64, val));
|
||||
}
|
||||
return INT64_TO_JSVALUE_SLOW(globalObject, val);
|
||||
}
|
||||
pub inline fn INT32_TO_JSVALUE(arg_val: i32) EncodedJSValue {
|
||||
return .{ .asInt64 = @bitCast(i64, @as(c_ulonglong, 18446181123756130304) | @bitCast(c_ulonglong, @as(c_ulonglong, @bitCast(u32, arg_val)))) };
|
||||
}
|
||||
pub inline fn DOUBLE_TO_JSVALUE(arg_val: f64) EncodedJSValue {
|
||||
var res: EncodedJSValue = .{ .asDouble = arg_val };
|
||||
res.asInt64 += @as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49);
|
||||
return res;
|
||||
}
|
||||
pub inline fn FLOAT_TO_JSVALUE(arg_val: f32) EncodedJSValue {
|
||||
var val = arg_val;
|
||||
return DOUBLE_TO_JSVALUE(@floatCast(f64, val));
|
||||
}
|
||||
pub inline fn BOOLEAN_TO_JSVALUE(arg_val: @"bool") EncodedJSValue {
|
||||
var val = arg_val;
|
||||
var res: EncodedJSValue = undefined;
|
||||
res.asInt64 = @bitCast(i64, @as(c_longlong, if (@as(c_int, @boolToInt(val)) != 0) (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1) else (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 0)));
|
||||
return res;
|
||||
}
|
||||
pub inline fn PTR_TO_JSVALUE(arg_ptr: ?*anyopaque) EncodedJSValue {
|
||||
var ptr = arg_ptr;
|
||||
var val: EncodedJSValue = undefined;
|
||||
val.asInt64 = @intCast(i64, @ptrToInt(ptr)) + (@as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49));
|
||||
return val;
|
||||
}
|
||||
pub inline fn JSVALUE_TO_PTR(arg_val: EncodedJSValue) ?*anyopaque {
|
||||
var val = arg_val;
|
||||
return @intToPtr(?*anyopaque, val.asInt64 - (@as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49)));
|
||||
}
|
||||
pub inline fn JSVALUE_TO_INT32(arg_val: EncodedJSValue) i32 {
|
||||
var val = arg_val;
|
||||
return @bitCast(i32, @truncate(c_int, val.asInt64));
|
||||
}
|
||||
pub inline fn JSVALUE_TO_FLOAT(arg_val: EncodedJSValue) f32 {
|
||||
var val = arg_val;
|
||||
return @floatCast(f32, JSVALUE_TO_DOUBLE(val));
|
||||
}
|
||||
pub inline fn JSVALUE_TO_DOUBLE(arg_val: EncodedJSValue) f64 {
|
||||
var val = arg_val;
|
||||
val.asInt64 -= @as(c_longlong, 1) << @intCast(@import("std").math.Log2Int(c_longlong), 49);
|
||||
return val.asDouble;
|
||||
}
|
||||
pub inline fn JSVALUE_TO_BOOL(arg_val: EncodedJSValue) @"bool" {
|
||||
var val = arg_val;
|
||||
return val.asInt64 == @bitCast(c_longlong, @as(c_longlong, (@as(c_int, 2) | @as(c_int, 4)) | @as(c_int, 1)));
|
||||
}
|
||||
pub extern fn JSFunctionCall(globalObject: ?*anyopaque, callFrame: ?*anyopaque) ?*anyopaque;
|
||||
pub const __block = @compileError("unable to translate macro: undefined identifier `__attribute__`"); // (no file):27:9
|
||||
pub const __INTMAX_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `L`"); // (no file):69:9
|
||||
pub const __UINTMAX_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `UL`"); // (no file):75:9
|
||||
pub const __FLT16_DENORM_MIN__ = @compileError("unable to translate C expr: unexpected token 'IntegerLiteral'"); // (no file):106:9
|
||||
pub const __FLT16_EPSILON__ = @compileError("unable to translate C expr: unexpected token 'IntegerLiteral'"); // (no file):110:9
|
||||
pub const __FLT16_MAX__ = @compileError("unable to translate C expr: unexpected token 'IntegerLiteral'"); // (no file):116:9
|
||||
pub const __FLT16_MIN__ = @compileError("unable to translate C expr: unexpected token 'IntegerLiteral'"); // (no file):119:9
|
||||
pub const __INT64_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `LL`"); // (no file):179:9
|
||||
pub const __UINT32_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `U`"); // (no file):201:9
|
||||
pub const __UINT64_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `ULL`"); // (no file):209:9
|
||||
pub const __USER_LABEL_PREFIX__ = @compileError("unable to translate macro: undefined identifier `_`"); // (no file):292:9
|
||||
pub const __nonnull = @compileError("unable to translate macro: undefined identifier `_Nonnull`"); // (no file):322:9
|
||||
pub const __null_unspecified = @compileError("unable to translate macro: undefined identifier `_Null_unspecified`"); // (no file):323:9
|
||||
pub const __nullable = @compileError("unable to translate macro: undefined identifier `_Nullable`"); // (no file):324:9
|
||||
pub const __weak = @compileError("unable to translate macro: undefined identifier `__attribute__`"); // (no file):382:9
|
||||
pub const LOAD_ARGUMENTS_FROM_CALL_FRAME = @compileError("unable to translate macro: undefined identifier `argsPtr`"); // /Users/jarred/Code/bun/src/javascript/jsc/api/FFI.h:95:9
|
||||
pub const __llvm__ = @as(c_int, 1);
|
||||
pub const __clang__ = @as(c_int, 1);
|
||||
pub const __clang_major__ = @as(c_int, 13);
|
||||
pub const __clang_minor__ = @as(c_int, 0);
|
||||
pub const __clang_patchlevel__ = @as(c_int, 1);
|
||||
pub const __clang_version__ = "13.0.1 ";
|
||||
pub const __GNUC__ = @as(c_int, 4);
|
||||
pub const __GNUC_MINOR__ = @as(c_int, 2);
|
||||
pub const __GNUC_PATCHLEVEL__ = @as(c_int, 1);
|
||||
pub const __GXX_ABI_VERSION = @as(c_int, 1002);
|
||||
pub const __ATOMIC_RELAXED = @as(c_int, 0);
|
||||
pub const __ATOMIC_CONSUME = @as(c_int, 1);
|
||||
pub const __ATOMIC_ACQUIRE = @as(c_int, 2);
|
||||
pub const __ATOMIC_RELEASE = @as(c_int, 3);
|
||||
pub const __ATOMIC_ACQ_REL = @as(c_int, 4);
|
||||
pub const __ATOMIC_SEQ_CST = @as(c_int, 5);
|
||||
pub const __OPENCL_MEMORY_SCOPE_WORK_ITEM = @as(c_int, 0);
|
||||
pub const __OPENCL_MEMORY_SCOPE_WORK_GROUP = @as(c_int, 1);
|
||||
pub const __OPENCL_MEMORY_SCOPE_DEVICE = @as(c_int, 2);
|
||||
pub const __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = @as(c_int, 3);
|
||||
pub const __OPENCL_MEMORY_SCOPE_SUB_GROUP = @as(c_int, 4);
|
||||
pub const __PRAGMA_REDEFINE_EXTNAME = @as(c_int, 1);
|
||||
pub const __VERSION__ = "Homebrew Clang 13.0.1";
|
||||
pub const __OBJC_BOOL_IS_BOOL = @as(c_int, 1);
|
||||
pub const __CONSTANT_CFSTRINGS__ = @as(c_int, 1);
|
||||
pub const __BLOCKS__ = @as(c_int, 1);
|
||||
pub const __clang_literal_encoding__ = "UTF-8";
|
||||
pub const __clang_wide_literal_encoding__ = "UTF-32";
|
||||
pub const __OPTIMIZE__ = @as(c_int, 1);
|
||||
pub const __ORDER_LITTLE_ENDIAN__ = @as(c_int, 1234);
|
||||
pub const __ORDER_BIG_ENDIAN__ = @as(c_int, 4321);
|
||||
pub const __ORDER_PDP_ENDIAN__ = @as(c_int, 3412);
|
||||
pub const __BYTE_ORDER__ = __ORDER_LITTLE_ENDIAN__;
|
||||
pub const __LITTLE_ENDIAN__ = @as(c_int, 1);
|
||||
pub const _LP64 = @as(c_int, 1);
|
||||
pub const __LP64__ = @as(c_int, 1);
|
||||
pub const __CHAR_BIT__ = @as(c_int, 8);
|
||||
pub const __SCHAR_MAX__ = @as(c_int, 127);
|
||||
pub const __SHRT_MAX__ = @as(c_int, 32767);
|
||||
pub const __INT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal);
|
||||
pub const __LONG_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal);
|
||||
pub const __LONG_LONG_MAX__ = @as(c_longlong, 9223372036854775807);
|
||||
pub const __WCHAR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal);
|
||||
pub const __WINT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal);
|
||||
pub const __INTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal);
|
||||
pub const __SIZE_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal);
|
||||
pub const __UINTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal);
|
||||
pub const __PTRDIFF_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal);
|
||||
pub const __INTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal);
|
||||
pub const __UINTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal);
|
||||
pub const __SIZEOF_DOUBLE__ = @as(c_int, 8);
|
||||
pub const __SIZEOF_FLOAT__ = @as(c_int, 4);
|
||||
pub const __SIZEOF_INT__ = @as(c_int, 4);
|
||||
pub const __SIZEOF_LONG__ = @as(c_int, 8);
|
||||
pub const __SIZEOF_LONG_DOUBLE__ = @as(c_int, 8);
|
||||
pub const __SIZEOF_LONG_LONG__ = @as(c_int, 8);
|
||||
pub const __SIZEOF_POINTER__ = @as(c_int, 8);
|
||||
pub const __SIZEOF_SHORT__ = @as(c_int, 2);
|
||||
pub const __SIZEOF_PTRDIFF_T__ = @as(c_int, 8);
|
||||
pub const __SIZEOF_SIZE_T__ = @as(c_int, 8);
|
||||
pub const __SIZEOF_WCHAR_T__ = @as(c_int, 4);
|
||||
pub const __SIZEOF_WINT_T__ = @as(c_int, 4);
|
||||
pub const __SIZEOF_INT128__ = @as(c_int, 16);
|
||||
pub const __INTMAX_TYPE__ = c_long;
|
||||
pub const __INTMAX_FMTd__ = "ld";
|
||||
pub const __INTMAX_FMTi__ = "li";
|
||||
pub const __UINTMAX_TYPE__ = c_ulong;
|
||||
pub const __UINTMAX_FMTo__ = "lo";
|
||||
pub const __UINTMAX_FMTu__ = "lu";
|
||||
pub const __UINTMAX_FMTx__ = "lx";
|
||||
pub const __UINTMAX_FMTX__ = "lX";
|
||||
pub const __INTMAX_WIDTH__ = @as(c_int, 64);
|
||||
pub const __PTRDIFF_TYPE__ = c_long;
|
||||
pub const __PTRDIFF_FMTd__ = "ld";
|
||||
pub const __PTRDIFF_FMTi__ = "li";
|
||||
pub const __PTRDIFF_WIDTH__ = @as(c_int, 64);
|
||||
pub const __INTPTR_TYPE__ = c_long;
|
||||
pub const __INTPTR_FMTd__ = "ld";
|
||||
pub const __INTPTR_FMTi__ = "li";
|
||||
pub const __INTPTR_WIDTH__ = @as(c_int, 64);
|
||||
pub const __SIZE_TYPE__ = c_ulong;
|
||||
pub const __SIZE_FMTo__ = "lo";
|
||||
pub const __SIZE_FMTu__ = "lu";
|
||||
pub const __SIZE_FMTx__ = "lx";
|
||||
pub const __SIZE_FMTX__ = "lX";
|
||||
pub const __SIZE_WIDTH__ = @as(c_int, 64);
|
||||
pub const __WCHAR_TYPE__ = c_int;
|
||||
pub const __WCHAR_WIDTH__ = @as(c_int, 32);
|
||||
pub const __WINT_TYPE__ = c_int;
|
||||
pub const __WINT_WIDTH__ = @as(c_int, 32);
|
||||
pub const __SIG_ATOMIC_WIDTH__ = @as(c_int, 32);
|
||||
pub const __SIG_ATOMIC_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal);
|
||||
pub const __CHAR16_TYPE__ = c_ushort;
|
||||
pub const __CHAR32_TYPE__ = c_uint;
|
||||
pub const __UINTMAX_WIDTH__ = @as(c_int, 64);
|
||||
pub const __UINTPTR_TYPE__ = c_ulong;
|
||||
pub const __UINTPTR_FMTo__ = "lo";
|
||||
pub const __UINTPTR_FMTu__ = "lu";
|
||||
pub const __UINTPTR_FMTx__ = "lx";
|
||||
pub const __UINTPTR_FMTX__ = "lX";
|
||||
pub const __UINTPTR_WIDTH__ = @as(c_int, 64);
|
||||
pub const __FLT16_HAS_DENORM__ = @as(c_int, 1);
|
||||
pub const __FLT16_DIG__ = @as(c_int, 3);
|
||||
pub const __FLT16_DECIMAL_DIG__ = @as(c_int, 5);
|
||||
pub const __FLT16_HAS_INFINITY__ = @as(c_int, 1);
|
||||
pub const __FLT16_HAS_QUIET_NAN__ = @as(c_int, 1);
|
||||
pub const __FLT16_MANT_DIG__ = @as(c_int, 11);
|
||||
pub const __FLT16_MAX_10_EXP__ = @as(c_int, 4);
|
||||
pub const __FLT16_MAX_EXP__ = @as(c_int, 16);
|
||||
pub const __FLT16_MIN_10_EXP__ = -@as(c_int, 4);
|
||||
pub const __FLT16_MIN_EXP__ = -@as(c_int, 13);
|
||||
pub const __FLT_DENORM_MIN__ = @as(f32, 1.40129846e-45);
|
||||
pub const __FLT_HAS_DENORM__ = @as(c_int, 1);
|
||||
pub const __FLT_DIG__ = @as(c_int, 6);
|
||||
pub const __FLT_DECIMAL_DIG__ = @as(c_int, 9);
|
||||
pub const __FLT_EPSILON__ = @as(f32, 1.19209290e-7);
|
||||
pub const __FLT_HAS_INFINITY__ = @as(c_int, 1);
|
||||
pub const __FLT_HAS_QUIET_NAN__ = @as(c_int, 1);
|
||||
pub const __FLT_MANT_DIG__ = @as(c_int, 24);
|
||||
pub const __FLT_MAX_10_EXP__ = @as(c_int, 38);
|
||||
pub const __FLT_MAX_EXP__ = @as(c_int, 128);
|
||||
pub const __FLT_MAX__ = @as(f32, 3.40282347e+38);
|
||||
pub const __FLT_MIN_10_EXP__ = -@as(c_int, 37);
|
||||
pub const __FLT_MIN_EXP__ = -@as(c_int, 125);
|
||||
pub const __FLT_MIN__ = @as(f32, 1.17549435e-38);
|
||||
pub const __DBL_DENORM_MIN__ = 4.9406564584124654e-324;
|
||||
pub const __DBL_HAS_DENORM__ = @as(c_int, 1);
|
||||
pub const __DBL_DIG__ = @as(c_int, 15);
|
||||
pub const __DBL_DECIMAL_DIG__ = @as(c_int, 17);
|
||||
pub const __DBL_EPSILON__ = 2.2204460492503131e-16;
|
||||
pub const __DBL_HAS_INFINITY__ = @as(c_int, 1);
|
||||
pub const __DBL_HAS_QUIET_NAN__ = @as(c_int, 1);
|
||||
pub const __DBL_MANT_DIG__ = @as(c_int, 53);
|
||||
pub const __DBL_MAX_10_EXP__ = @as(c_int, 308);
|
||||
pub const __DBL_MAX_EXP__ = @as(c_int, 1024);
|
||||
pub const __DBL_MAX__ = 1.7976931348623157e+308;
|
||||
pub const __DBL_MIN_10_EXP__ = -@as(c_int, 307);
|
||||
pub const __DBL_MIN_EXP__ = -@as(c_int, 1021);
|
||||
pub const __DBL_MIN__ = 2.2250738585072014e-308;
|
||||
pub const __LDBL_DENORM_MIN__ = @as(c_longdouble, 4.9406564584124654e-324);
|
||||
pub const __LDBL_HAS_DENORM__ = @as(c_int, 1);
|
||||
pub const __LDBL_DIG__ = @as(c_int, 15);
|
||||
pub const __LDBL_DECIMAL_DIG__ = @as(c_int, 17);
|
||||
pub const __LDBL_EPSILON__ = @as(c_longdouble, 2.2204460492503131e-16);
|
||||
pub const __LDBL_HAS_INFINITY__ = @as(c_int, 1);
|
||||
pub const __LDBL_HAS_QUIET_NAN__ = @as(c_int, 1);
|
||||
pub const __LDBL_MANT_DIG__ = @as(c_int, 53);
|
||||
pub const __LDBL_MAX_10_EXP__ = @as(c_int, 308);
|
||||
pub const __LDBL_MAX_EXP__ = @as(c_int, 1024);
|
||||
pub const __LDBL_MAX__ = @as(c_longdouble, 1.7976931348623157e+308);
|
||||
pub const __LDBL_MIN_10_EXP__ = -@as(c_int, 307);
|
||||
pub const __LDBL_MIN_EXP__ = -@as(c_int, 1021);
|
||||
pub const __LDBL_MIN__ = @as(c_longdouble, 2.2250738585072014e-308);
|
||||
pub const __POINTER_WIDTH__ = @as(c_int, 64);
|
||||
pub const __BIGGEST_ALIGNMENT__ = @as(c_int, 8);
|
||||
pub const __INT8_TYPE__ = i8;
|
||||
pub const __INT8_FMTd__ = "hhd";
|
||||
pub const __INT8_FMTi__ = "hhi";
|
||||
pub const __INT8_C_SUFFIX__ = "";
|
||||
pub const __INT16_TYPE__ = c_short;
|
||||
pub const __INT16_FMTd__ = "hd";
|
||||
pub const __INT16_FMTi__ = "hi";
|
||||
pub const __INT16_C_SUFFIX__ = "";
|
||||
pub const __INT32_TYPE__ = c_int;
|
||||
pub const __INT32_FMTd__ = "d";
|
||||
pub const __INT32_FMTi__ = "i";
|
||||
pub const __INT32_C_SUFFIX__ = "";
|
||||
pub const __INT64_TYPE__ = c_longlong;
|
||||
pub const __INT64_FMTd__ = "lld";
|
||||
pub const __INT64_FMTi__ = "lli";
|
||||
pub const __UINT8_TYPE__ = u8;
|
||||
pub const __UINT8_FMTo__ = "hho";
|
||||
pub const __UINT8_FMTu__ = "hhu";
|
||||
pub const __UINT8_FMTx__ = "hhx";
|
||||
pub const __UINT8_FMTX__ = "hhX";
|
||||
pub const __UINT8_C_SUFFIX__ = "";
|
||||
pub const __UINT8_MAX__ = @as(c_int, 255);
|
||||
pub const __INT8_MAX__ = @as(c_int, 127);
|
||||
pub const __UINT16_TYPE__ = c_ushort;
|
||||
pub const __UINT16_FMTo__ = "ho";
|
||||
pub const __UINT16_FMTu__ = "hu";
|
||||
pub const __UINT16_FMTx__ = "hx";
|
||||
pub const __UINT16_FMTX__ = "hX";
|
||||
pub const __UINT16_C_SUFFIX__ = "";
|
||||
pub const __UINT16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal);
|
||||
pub const __INT16_MAX__ = @as(c_int, 32767);
|
||||
pub const __UINT32_TYPE__ = c_uint;
|
||||
pub const __UINT32_FMTo__ = "o";
|
||||
pub const __UINT32_FMTu__ = "u";
|
||||
pub const __UINT32_FMTx__ = "x";
|
||||
pub const __UINT32_FMTX__ = "X";
|
||||
pub const __UINT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal);
|
||||
pub const __INT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal);
|
||||
pub const __UINT64_TYPE__ = c_ulonglong;
|
||||
pub const __UINT64_FMTo__ = "llo";
|
||||
pub const __UINT64_FMTu__ = "llu";
|
||||
pub const __UINT64_FMTx__ = "llx";
|
||||
pub const __UINT64_FMTX__ = "llX";
|
||||
pub const __UINT64_MAX__ = @as(c_ulonglong, 18446744073709551615);
|
||||
pub const __INT64_MAX__ = @as(c_longlong, 9223372036854775807);
|
||||
pub const __INT_LEAST8_TYPE__ = i8;
|
||||
pub const __INT_LEAST8_MAX__ = @as(c_int, 127);
|
||||
pub const __INT_LEAST8_FMTd__ = "hhd";
|
||||
pub const __INT_LEAST8_FMTi__ = "hhi";
|
||||
pub const __UINT_LEAST8_TYPE__ = u8;
|
||||
pub const __UINT_LEAST8_MAX__ = @as(c_int, 255);
|
||||
pub const __UINT_LEAST8_FMTo__ = "hho";
|
||||
pub const __UINT_LEAST8_FMTu__ = "hhu";
|
||||
pub const __UINT_LEAST8_FMTx__ = "hhx";
|
||||
pub const __UINT_LEAST8_FMTX__ = "hhX";
|
||||
pub const __INT_LEAST16_TYPE__ = c_short;
|
||||
pub const __INT_LEAST16_MAX__ = @as(c_int, 32767);
|
||||
pub const __INT_LEAST16_FMTd__ = "hd";
|
||||
pub const __INT_LEAST16_FMTi__ = "hi";
|
||||
pub const __UINT_LEAST16_TYPE__ = c_ushort;
|
||||
pub const __UINT_LEAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal);
|
||||
pub const __UINT_LEAST16_FMTo__ = "ho";
|
||||
pub const __UINT_LEAST16_FMTu__ = "hu";
|
||||
pub const __UINT_LEAST16_FMTx__ = "hx";
|
||||
pub const __UINT_LEAST16_FMTX__ = "hX";
|
||||
pub const __INT_LEAST32_TYPE__ = c_int;
|
||||
pub const __INT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal);
|
||||
pub const __INT_LEAST32_FMTd__ = "d";
|
||||
pub const __INT_LEAST32_FMTi__ = "i";
|
||||
pub const __UINT_LEAST32_TYPE__ = c_uint;
|
||||
pub const __UINT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal);
|
||||
pub const __UINT_LEAST32_FMTo__ = "o";
|
||||
pub const __UINT_LEAST32_FMTu__ = "u";
|
||||
pub const __UINT_LEAST32_FMTx__ = "x";
|
||||
pub const __UINT_LEAST32_FMTX__ = "X";
|
||||
pub const __INT_LEAST64_TYPE__ = c_longlong;
|
||||
pub const __INT_LEAST64_MAX__ = @as(c_longlong, 9223372036854775807);
|
||||
pub const __INT_LEAST64_FMTd__ = "lld";
|
||||
pub const __INT_LEAST64_FMTi__ = "lli";
|
||||
pub const __UINT_LEAST64_TYPE__ = c_ulonglong;
|
||||
pub const __UINT_LEAST64_MAX__ = @as(c_ulonglong, 18446744073709551615);
|
||||
pub const __UINT_LEAST64_FMTo__ = "llo";
|
||||
pub const __UINT_LEAST64_FMTu__ = "llu";
|
||||
pub const __UINT_LEAST64_FMTx__ = "llx";
|
||||
pub const __UINT_LEAST64_FMTX__ = "llX";
|
||||
pub const __INT_FAST8_TYPE__ = i8;
|
||||
pub const __INT_FAST8_MAX__ = @as(c_int, 127);
|
||||
pub const __INT_FAST8_FMTd__ = "hhd";
|
||||
pub const __INT_FAST8_FMTi__ = "hhi";
|
||||
pub const __UINT_FAST8_TYPE__ = u8;
|
||||
pub const __UINT_FAST8_MAX__ = @as(c_int, 255);
|
||||
pub const __UINT_FAST8_FMTo__ = "hho";
|
||||
pub const __UINT_FAST8_FMTu__ = "hhu";
|
||||
pub const __UINT_FAST8_FMTx__ = "hhx";
|
||||
pub const __UINT_FAST8_FMTX__ = "hhX";
|
||||
pub const __INT_FAST16_TYPE__ = c_short;
|
||||
pub const __INT_FAST16_MAX__ = @as(c_int, 32767);
|
||||
pub const __INT_FAST16_FMTd__ = "hd";
|
||||
pub const __INT_FAST16_FMTi__ = "hi";
|
||||
pub const __UINT_FAST16_TYPE__ = c_ushort;
|
||||
pub const __UINT_FAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal);
|
||||
pub const __UINT_FAST16_FMTo__ = "ho";
|
||||
pub const __UINT_FAST16_FMTu__ = "hu";
|
||||
pub const __UINT_FAST16_FMTx__ = "hx";
|
||||
pub const __UINT_FAST16_FMTX__ = "hX";
|
||||
pub const __INT_FAST32_TYPE__ = c_int;
|
||||
pub const __INT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal);
|
||||
pub const __INT_FAST32_FMTd__ = "d";
|
||||
pub const __INT_FAST32_FMTi__ = "i";
|
||||
pub const __UINT_FAST32_TYPE__ = c_uint;
|
||||
pub const __UINT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal);
|
||||
pub const __UINT_FAST32_FMTo__ = "o";
|
||||
pub const __UINT_FAST32_FMTu__ = "u";
|
||||
pub const __UINT_FAST32_FMTx__ = "x";
|
||||
pub const __UINT_FAST32_FMTX__ = "X";
|
||||
pub const __INT_FAST64_TYPE__ = c_longlong;
|
||||
pub const __INT_FAST64_MAX__ = @as(c_longlong, 9223372036854775807);
|
||||
pub const __INT_FAST64_FMTd__ = "lld";
|
||||
pub const __INT_FAST64_FMTi__ = "lli";
|
||||
pub const __UINT_FAST64_TYPE__ = c_ulonglong;
|
||||
pub const __UINT_FAST64_MAX__ = @as(c_ulonglong, 18446744073709551615);
|
||||
pub const __UINT_FAST64_FMTo__ = "llo";
|
||||
pub const __UINT_FAST64_FMTu__ = "llu";
|
||||
pub const __UINT_FAST64_FMTx__ = "llx";
|
||||
pub const __UINT_FAST64_FMTX__ = "llX";
|
||||
pub const __FINITE_MATH_ONLY__ = @as(c_int, 0);
|
||||
pub const __GNUC_STDC_INLINE__ = @as(c_int, 1);
|
||||
pub const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = @as(c_int, 1);
|
||||
pub const __CLANG_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_INT_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __CLANG_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_INT_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __GCC_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2);
|
||||
pub const __PIC__ = @as(c_int, 2);
|
||||
pub const __pic__ = @as(c_int, 2);
|
||||
pub const __FLT_EVAL_METHOD__ = @as(c_int, 0);
|
||||
pub const __FLT_RADIX__ = @as(c_int, 2);
|
||||
pub const __DECIMAL_DIG__ = __LDBL_DECIMAL_DIG__;
|
||||
pub const __SSP_STRONG__ = @as(c_int, 2);
|
||||
pub const __AARCH64EL__ = @as(c_int, 1);
|
||||
pub const __aarch64__ = @as(c_int, 1);
|
||||
pub const __AARCH64_CMODEL_SMALL__ = @as(c_int, 1);
|
||||
pub const __ARM_ACLE = @as(c_int, 200);
|
||||
pub const __ARM_ARCH = @as(c_int, 8);
|
||||
pub const __ARM_ARCH_PROFILE = 'A';
|
||||
pub const __ARM_64BIT_STATE = @as(c_int, 1);
|
||||
pub const __ARM_PCS_AAPCS64 = @as(c_int, 1);
|
||||
pub const __ARM_ARCH_ISA_A64 = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_CLZ = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_FMA = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_LDREX = @as(c_int, 0xF);
|
||||
pub const __ARM_FEATURE_IDIV = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_DIV = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_NUMERIC_MAXMIN = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_DIRECTED_ROUNDING = @as(c_int, 1);
|
||||
pub const __ARM_ALIGN_MAX_STACK_PWR = @as(c_int, 4);
|
||||
pub const __ARM_FP = @as(c_int, 0xE);
|
||||
pub const __ARM_FP16_FORMAT_IEEE = @as(c_int, 1);
|
||||
pub const __ARM_FP16_ARGS = @as(c_int, 1);
|
||||
pub const __ARM_SIZEOF_WCHAR_T = @as(c_int, 4);
|
||||
pub const __ARM_SIZEOF_MINIMAL_ENUM = @as(c_int, 4);
|
||||
pub const __ARM_NEON = @as(c_int, 1);
|
||||
pub const __ARM_NEON_FP = @as(c_int, 0xE);
|
||||
pub const __ARM_FEATURE_CRC32 = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_CRYPTO = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_AES = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_SHA2 = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_SHA3 = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_SHA512 = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_UNALIGNED = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_FP16_VECTOR_ARITHMETIC = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_FP16_SCALAR_ARITHMETIC = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_DOTPROD = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_ATOMICS = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_FP16_FML = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_COMPLEX = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_JCVT = @as(c_int, 1);
|
||||
pub const __ARM_FEATURE_QRDMX = @as(c_int, 1);
|
||||
pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = @as(c_int, 1);
|
||||
pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = @as(c_int, 1);
|
||||
pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = @as(c_int, 1);
|
||||
pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = @as(c_int, 1);
|
||||
pub const __AARCH64_SIMD__ = @as(c_int, 1);
|
||||
pub const __ARM64_ARCH_8__ = @as(c_int, 1);
|
||||
pub const __ARM_NEON__ = @as(c_int, 1);
|
||||
pub const __REGISTER_PREFIX__ = "";
|
||||
pub const __arm64 = @as(c_int, 1);
|
||||
pub const __arm64__ = @as(c_int, 1);
|
||||
pub const __APPLE_CC__ = @as(c_int, 6000);
|
||||
pub const __APPLE__ = @as(c_int, 1);
|
||||
pub const __STDC_NO_THREADS__ = @as(c_int, 1);
|
||||
pub const __strong = "";
|
||||
pub const __unsafe_unretained = "";
|
||||
pub const __DYNAMIC__ = @as(c_int, 1);
|
||||
pub const __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 120400, .decimal);
|
||||
pub const __MACH__ = @as(c_int, 1);
|
||||
pub const __STDC__ = @as(c_int, 1);
|
||||
pub const __STDC_HOSTED__ = @as(c_int, 1);
|
||||
pub const __STDC_VERSION__ = @as(c_long, 201710);
|
||||
pub const __STDC_UTF_16__ = @as(c_int, 1);
|
||||
pub const __STDC_UTF_32__ = @as(c_int, 1);
|
||||
pub const _DEBUG = @as(c_int, 1);
|
||||
pub const __GCC_HAVE_DWARF2_CFI_ASM = @as(c_int, 1);
|
||||
pub const IS_BIG_ENDIAN = @as(c_int, 0);
|
||||
pub const USE_JSVALUE64 = @as(c_int, 1);
|
||||
pub const USE_JSVALUE32_64 = @as(c_int, 0);
|
||||
pub const @"true" = @as(c_int, 1);
|
||||
pub const @"false" = @as(c_int, 0);
|
||||
pub const DoubleEncodeOffsetBit = @as(c_int, 49);
|
||||
pub const DoubleEncodeOffset = @as(c_longlong, 1) << DoubleEncodeOffsetBit;
|
||||
pub const OtherTag = @as(c_int, 0x2);
|
||||
pub const BoolTag = @as(c_int, 0x4);
|
||||
pub const UndefinedTag = @as(c_int, 0x8);
|
||||
pub const TagValueFalse = (OtherTag | BoolTag) | @"false";
|
||||
pub const TagValueTrue = (OtherTag | BoolTag) | @"true";
|
||||
pub const TagValueUndefined = OtherTag | UndefinedTag;
|
||||
pub const TagValueNull = OtherTag;
|
||||
pub const NotCellMask = NumberTag | OtherTag;
|
||||
pub const MAX_INT32 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483648, .decimal);
|
||||
pub const MAX_INT52 = @import("std").zig.c_translation.promoteIntLiteral(c_int, 9007199254740991, .decimal);
|
||||
pub const NumberTag = @import("std").zig.c_translation.promoteIntLiteral(c_longlong, 0xfffe000000000000, .hexadecimal);
|
||||
@@ -1,10 +1 @@
|
||||
|
||||
static const HashTableValue JSArrayBufferSinkPrototypeTableValues[]
|
||||
= {
|
||||
{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__close), (intptr_t)(0) } },
|
||||
{ "closeWithError"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__closeWithError), (intptr_t)(1) } },
|
||||
{ "drain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__drain), (intptr_t)(1) } },
|
||||
{ "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__end), (intptr_t)(0) } },
|
||||
{ "start"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__start), (intptr_t)(1) } },
|
||||
{ "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__write), (intptr_t)(1) } },
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
// AUTO-GENERATED FILE. DO NOT EDIT.
|
||||
// Generated by /Users/jarred/Code/bun/src/javascript/jsc/generate-jssink.js at 2022-06-13T03:43:14.001Z
|
||||
// Generated by /Users/jarred/Code/bun/src/javascript/jsc/generate-JSSink.js at 2022-06-14T08:19:26.544Z
|
||||
// To regenerate this file, run:
|
||||
//
|
||||
// bun src/javascript/jsc/generate-jssink.js
|
||||
// bun src/javascript/jsc/generate-JSSink.js
|
||||
//
|
||||
#include "root.h"
|
||||
#include "JSSink.h"
|
||||
@@ -52,8 +52,6 @@
|
||||
namespace WebCore {
|
||||
using namespace JSC;
|
||||
|
||||
|
||||
|
||||
JSC_DEFINE_CUSTOM_GETTER(functionArrayBufferSink__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
|
||||
{
|
||||
auto& vm = lexicalGlobalObject->vm();
|
||||
@@ -62,6 +60,41 @@ JSC_DEFINE_CUSTOM_GETTER(functionArrayBufferSink__getter, (JSC::JSGlobalObject *
|
||||
return JSC::JSValue::encode(globalObject->ArrayBufferSink());
|
||||
}
|
||||
|
||||
JSC_DEFINE_CUSTOM_GETTER(functionReadableArrayBufferSinkController__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
|
||||
{
|
||||
auto& vm = lexicalGlobalObject->vm();
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
|
||||
|
||||
return JSC::JSValue::encode(globalObject->ArrayBufferSinkController());
|
||||
}
|
||||
|
||||
JSC_DECLARE_HOST_FUNCTION(functionReadableArrayBufferSinkController__run);
|
||||
JSC_DEFINE_HOST_FUNCTION(functionReadableArrayBufferSinkController__run, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
auto& vm = lexicalGlobalObject->vm();
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
|
||||
if (callFrame->argumentCount() < 6) {
|
||||
throwException(callFrame, scope, createNotEnoughArgumentsError(callFrame));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
WebCore::JSReadableStream* readableStream = JSC::jsDynamicCast<WebCore::JSReadableStream*>(vm, callFrame->argument(0));
|
||||
if (!readableStream) {
|
||||
throwException(callFrame, scope, createTypeError(callFrame, "first argument is not a ReadableStream"));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
void* sinkPtr = reinterpret_cast<void*>(bitwise_cast<uintptr_t>(callFrame->argument(1).toDouble(globalObject)));
|
||||
JSObject* startFunctionObj = callFrame->argument(2).getObject();
|
||||
JSObject* pullFunctionObj = callFrame->argument(3).getObject();
|
||||
JSObject* cancelFunctionObj = callFrame->argument(4).getObject();
|
||||
|
||||
JSFunction* pullFunction = pullFunctionObj != nullptr && startFunctionObj->isCallbable() ? JSC::jsCast<JSFunction*>(pullFunctionObj) : nullptr;
|
||||
JSFunction* cancelFunction = cancelFunctionObj != nullptr && startFunctionObj->isCallbable() ? JSC::jsCast<JSFunction*>(cancelFunctionObj) : nullptr;
|
||||
}
|
||||
|
||||
static const HashTableValue JSArrayBufferSinkPrototypeTableValues[]
|
||||
= {
|
||||
{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ArrayBufferSink__close), (intptr_t)(0) } },
|
||||
@@ -106,12 +139,48 @@ private:
|
||||
};
|
||||
STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSArrayBufferSinkPrototype, JSArrayBufferSinkPrototype::Base);
|
||||
|
||||
class JSReadableArrayBufferSinkControllerPrototype final : public JSC::JSNonFinalObject {
|
||||
public:
|
||||
using Base = JSC::JSNonFinalObject;
|
||||
|
||||
static JSReadableArrayBufferSinkControllerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure)
|
||||
{
|
||||
JSReadableArrayBufferSinkControllerPrototype* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkControllerPrototype>(vm)) JSReadableArrayBufferSinkControllerPrototype(vm, globalObject, structure);
|
||||
ptr->finishCreation(vm, globalObject);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
DECLARE_INFO;
|
||||
template<typename CellType, JSC::SubspaceAccess>
|
||||
static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
return &vm.plainObjectSpace();
|
||||
}
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
|
||||
}
|
||||
|
||||
private:
|
||||
JSReadableArrayBufferSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
|
||||
: Base(vm, structure)
|
||||
{
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
|
||||
};
|
||||
STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, JSReadableArrayBufferSinkControllerPrototype::Base);
|
||||
|
||||
// Classes without streams
|
||||
const ClassInfo JSArrayBufferSinkPrototype::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkPrototype) };
|
||||
const ClassInfo JSArrayBufferSink::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSink) };
|
||||
const ClassInfo JSArrayBufferSinkConstructor::s_info = { "ArrayBufferSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSArrayBufferSinkConstructor) };
|
||||
|
||||
// Classes with streams
|
||||
const ClassInfo JSReadableArrayBufferSinkControllerPrototype::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkControllerPrototype) };
|
||||
const ClassInfo JSReadableArrayBufferSinkController::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkController) };
|
||||
const ClassInfo JSReadableArrayBufferSinkControllerConstructor::s_info = { "ReadableArrayBufferSinkController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableArrayBufferSinkControllerConstructor) };
|
||||
|
||||
JSArrayBufferSink::~JSArrayBufferSink()
|
||||
{
|
||||
if (m_sinkPtr) {
|
||||
@@ -119,8 +188,12 @@ JSArrayBufferSink::~JSArrayBufferSink()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController()
|
||||
{
|
||||
if (m_sinkPtr) {
|
||||
ArrayBufferSink__finalizeController(m_sinkPtr);
|
||||
}
|
||||
}
|
||||
|
||||
JSArrayBufferSinkConstructor* JSArrayBufferSinkConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype)
|
||||
{
|
||||
@@ -129,6 +202,13 @@ JSArrayBufferSinkConstructor* JSArrayBufferSinkConstructor::create(JSC::VM& vm,
|
||||
return ptr;
|
||||
}
|
||||
|
||||
JSReadableArrayBufferSinkControllerConstructor* JSReadableArrayBufferSinkControllerConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype)
|
||||
{
|
||||
JSReadableArrayBufferSinkControllerConstructor* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkControllerConstructor>(vm)) JSReadableArrayBufferSinkControllerConstructor(vm, structure, ArrayBufferSink__constructController);
|
||||
ptr->finishCreation(vm, globalObject, prototype);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
JSArrayBufferSink* JSArrayBufferSink::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr)
|
||||
{
|
||||
JSArrayBufferSink* ptr = new (NotNull, JSC::allocateCell<JSArrayBufferSink>(vm)) JSArrayBufferSink(vm, structure, sinkPtr);
|
||||
@@ -136,6 +216,13 @@ JSArrayBufferSink* JSArrayBufferSink::create(JSC::VM& vm, JSC::JSGlobalObject* g
|
||||
return ptr;
|
||||
}
|
||||
|
||||
JSReadableArrayBufferSinkController* JSReadableArrayBufferSinkController::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr)
|
||||
{
|
||||
JSReadableArrayBufferSinkController* ptr = new (NotNull, JSC::allocateCell<JSReadableArrayBufferSinkController>(vm)) JSReadableArrayBufferSinkController(vm, structure, sinkPtr);
|
||||
ptr->finishCreation(vm);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void JSArrayBufferSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
@@ -143,10 +230,22 @@ void JSArrayBufferSinkConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* g
|
||||
initializeProperties(vm, globalObject, prototype);
|
||||
}
|
||||
|
||||
JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSArrayBufferSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) {
|
||||
void JSReadableArrayBufferSinkControllerConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
ASSERT(inherits(info()));
|
||||
initializeProperties(vm, globalObject, prototype);
|
||||
}
|
||||
|
||||
JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSArrayBufferSinkConstructor::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame)
|
||||
{
|
||||
return ArrayBufferSink__construct(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSReadableArrayBufferSinkController::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame)
|
||||
{
|
||||
return ArrayBufferSink__constructController(globalObject, callFrame);
|
||||
}
|
||||
|
||||
void JSArrayBufferSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
{
|
||||
@@ -156,6 +255,14 @@ void JSArrayBufferSinkConstructor::initializeProperties(VM& vm, JSC::JSGlobalObj
|
||||
putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
|
||||
}
|
||||
|
||||
void JSReadableArrayBufferSinkControllerConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
{
|
||||
putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
|
||||
JSString* nameString = jsNontrivialString(vm, "ArrayBufferSink"_s);
|
||||
m_originalName.set(vm, this, nameString);
|
||||
putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
|
||||
}
|
||||
|
||||
void JSArrayBufferSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
@@ -163,12 +270,38 @@ void JSArrayBufferSinkPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject
|
||||
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
|
||||
}
|
||||
|
||||
void JSReadableArrayBufferSinkControllerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
reifyStaticProperties(vm, JSReadableArrayBufferSinkControllerPrototype::info(), ReadableArrayBufferSinkControllerPrototypeTableValues, *this);
|
||||
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
|
||||
}
|
||||
|
||||
void JSArrayBufferSink::finishCreation(VM& vm)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
ASSERT(inherits(info()));
|
||||
}
|
||||
|
||||
void ReadableArrayBufferSinkController::finishCreation(VM& vm)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
ASSERT(inherits(info()));
|
||||
}
|
||||
|
||||
template<typename Visitor>
|
||||
void JSReadableArrayBufferSinkController::visitChildrenImpl(JSCell* cell, Visitor& visitor)
|
||||
{
|
||||
auto* thisObject = jsCast<JSReadableArrayBufferSinkController*>(cell);
|
||||
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
|
||||
Base::visitChildren(thisObject, visitor);
|
||||
visitor.append(thisObject->m_pull);
|
||||
visitor.append(thisObject->m_close);
|
||||
visitor.append(thisObject->m_start);
|
||||
}
|
||||
|
||||
DEFINE_VISIT_CHILDREN(JSReadableArrayBufferSinkController);
|
||||
|
||||
void JSArrayBufferSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
|
||||
{
|
||||
auto* thisObject = jsCast<JSArrayBufferSink*>(cell);
|
||||
@@ -180,27 +313,51 @@ void JSArrayBufferSink::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
|
||||
Base::analyzeHeap(cell, analyzer);
|
||||
}
|
||||
|
||||
void JSReadableArrayBufferSinkController::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
|
||||
{
|
||||
auto* thisObject = jsCast<JSReadableArrayBufferSinkController*>(cell);
|
||||
if (void* wrapped = thisObject->wrapped()) {
|
||||
analyzer.setWrappedObjectForCell(cell, wrapped);
|
||||
// if (thisObject->scriptExecutionContext())
|
||||
// analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
|
||||
}
|
||||
Base::analyzeHeap(cell, analyzer);
|
||||
}
|
||||
|
||||
void JSArrayBufferSink::destroy(JSCell* cell)
|
||||
{
|
||||
static_cast<JSArrayBufferSink*>(cell)->JSArrayBufferSink::~JSArrayBufferSink();
|
||||
}
|
||||
|
||||
void JSReadableArrayBufferSinkController::destroy(JSCell* cell)
|
||||
{
|
||||
static_cast<JSReadableArrayBufferSinkController*>(cell)->JSReadableArrayBufferSinkController::~JSReadableArrayBufferSinkController();
|
||||
}
|
||||
|
||||
JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID)
|
||||
{
|
||||
switch (sinkID) {
|
||||
|
||||
JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID)
|
||||
{
|
||||
switch (sinkID) {
|
||||
|
||||
case ArrayBufferSink:
|
||||
return JSArrayBufferSinkPrototype::create(vm, globalObject, JSArrayBufferSinkPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
|
||||
|
||||
default:
|
||||
RELEASE_ASSERT_NOT_REACHED();
|
||||
default:
|
||||
RELEASE_ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
JSObject* createJSSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, SinkID sinkID)
|
||||
{
|
||||
switch (sinkID) {
|
||||
|
||||
case ArrayBufferSink:
|
||||
return JSReadableArrayBufferSinkControllerPrototype::create(vm, globalObject, JSReadableArrayBufferSinkControllerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
|
||||
|
||||
default:
|
||||
RELEASE_ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
} // namespace WebCore
|
||||
|
||||
|
||||
extern "C" JSC__JSValue ArrayBufferSink__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr)
|
||||
{
|
||||
auto& vm = arg0->vm();
|
||||
@@ -210,6 +367,15 @@ extern "C" JSC__JSValue ArrayBufferSink__createObject(JSC__JSGlobalObject* arg0,
|
||||
return JSC::JSValue::encode(WebCore::JSArrayBufferSink::create(vm, globalObject, structure, sinkPtr));
|
||||
}
|
||||
|
||||
extern "C" JSC__JSValue ArrayBufferSink__setStreamController(JSC__JSGlobalObject* arg0, JSC__JSValue readableStream, void* sinkPtr)
|
||||
{
|
||||
auto& vm = arg0->vm();
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0);
|
||||
JSC::JSValue prototype = globalObject->ArrayBufferSinkControllerPrototype();
|
||||
JSC::Structure* structure = WebCore::JSReadableArrayBufferSinkController::createStructure(vm, globalObject, prototype);
|
||||
return JSC::JSValue::encode(WebCore::JSReadableArrayBufferSinkController::create(vm, globalObject, structure, sinkPtr));
|
||||
}
|
||||
|
||||
extern "C" void* ArrayBufferSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1)
|
||||
{
|
||||
JSC::VM& vm = WebCore::getVM(arg0);
|
||||
@@ -218,3 +384,12 @@ extern "C" void* ArrayBufferSink__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void* JSReadableArrayBufferSinkController__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1)
|
||||
{
|
||||
JSC::VM& vm = WebCore::getVM(arg0);
|
||||
if (auto* sink = JSC::jsDynamicCast<WebCore::JSReadableArrayBufferSinkController*>(JSC::JSValue::decode(JSValue1)))
|
||||
return sink->wrapped();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// AUTO-GENERATED FILE. DO NOT EDIT.
|
||||
// Generated by /Users/jarred/Code/bun/src/javascript/jsc/generate-jssink.js at 2022-06-13T03:43:13.999Z
|
||||
// Generated by /Users/jarred/Code/bun/src/javascript/jsc/generate-JSSink.js at 2022-06-14T08:19:26.543Z
|
||||
//
|
||||
#pragma once
|
||||
|
||||
@@ -15,92 +15,186 @@ extern "C" bool JSSink_isSink(JSC::JSGlobalObject*, JSC::EncodedJSValue);
|
||||
|
||||
namespace WebCore {
|
||||
using namespace JSC;
|
||||
class JSArrayBufferSinkConstructor final : public JSC::InternalFunction {
|
||||
public:
|
||||
using Base = JSC::InternalFunction;
|
||||
static JSArrayBufferSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype);
|
||||
static constexpr SinkID Sink = SinkID::ArrayBufferSink;
|
||||
|
||||
static constexpr unsigned StructureFlags = Base::StructureFlags;
|
||||
static constexpr bool needsDestruction = false;
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<JSArrayBufferSinkConstructor, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); });
|
||||
}
|
||||
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info());
|
||||
}
|
||||
void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);
|
||||
|
||||
|
||||
// Must be defined for each specialization class.
|
||||
static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*);
|
||||
|
||||
private:
|
||||
JSArrayBufferSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction)
|
||||
: Base(vm, structure, nativeFunction, nativeFunction)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);
|
||||
};
|
||||
|
||||
class JSArrayBufferSink final : public JSC::JSDestructibleObject {
|
||||
public:
|
||||
using Base = JSC::JSDestructibleObject;
|
||||
static JSArrayBufferSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr);
|
||||
static constexpr SinkID Sink = SinkID::ArrayBufferSink;
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<JSArrayBufferSink, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForJSSink.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); });
|
||||
}
|
||||
|
||||
static void destroy(JSC::JSCell*);
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
|
||||
}
|
||||
|
||||
~JSArrayBufferSink();
|
||||
|
||||
void* wrapped() const { return m_sinkPtr; }
|
||||
|
||||
static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
|
||||
|
||||
void* m_sinkPtr;
|
||||
|
||||
JSArrayBufferSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr)
|
||||
: Base(vm, structure)
|
||||
{
|
||||
m_sinkPtr = sinkPtr;
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&);
|
||||
};
|
||||
JSC_DECLARE_CUSTOM_GETTER(functionArrayBufferSink__getter);
|
||||
class JSArrayBufferSinkConstructor final : public JSC::InternalFunction {
|
||||
public:
|
||||
using Base = JSC::InternalFunction;
|
||||
static JSArrayBufferSinkConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype);
|
||||
static constexpr SinkID Sink = SinkID::ArrayBufferSink;
|
||||
|
||||
static constexpr unsigned StructureFlags = Base::StructureFlags;
|
||||
static constexpr bool needsDestruction = false;
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<JSArrayBufferSinkConstructor, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); });
|
||||
}
|
||||
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info());
|
||||
}
|
||||
void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);
|
||||
|
||||
// Must be defined for each specialization class.
|
||||
static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*);
|
||||
|
||||
private:
|
||||
JSArrayBufferSinkConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction)
|
||||
: Base(vm, structure, nativeFunction, nativeFunction)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);
|
||||
};
|
||||
|
||||
class JSReadableArrayBufferSinkControllerConstructor final : public JSC::InternalFunction {
|
||||
public:
|
||||
using Base = JSC::InternalFunction;
|
||||
static JSReadableArrayBufferSinkControllerConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype);
|
||||
static constexpr SinkID Sink = SinkID::ArrayBufferSink;
|
||||
|
||||
static constexpr unsigned StructureFlags = Base::StructureFlags;
|
||||
static constexpr bool needsDestruction = false;
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<JSReadableArrayBufferSinkControllerConstructor, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForJSSinkConstructor.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkConstructor = WTFMove(space); });
|
||||
}
|
||||
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info());
|
||||
}
|
||||
void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);
|
||||
|
||||
// Must be defined for each specialization class.
|
||||
static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*);
|
||||
|
||||
private:
|
||||
JSReadableArrayBufferSinkControllerConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction)
|
||||
: Base(vm, structure, nativeFunction, nativeFunction)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);
|
||||
};
|
||||
|
||||
class JSArrayBufferSink final : public JSC::JSDestructibleObject {
|
||||
public:
|
||||
using Base = JSC::JSDestructibleObject;
|
||||
static JSArrayBufferSink* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr);
|
||||
static constexpr SinkID Sink = SinkID::ArrayBufferSink;
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<JSArrayBufferSink, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForJSSink.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForJSSink = WTFMove(space); });
|
||||
}
|
||||
|
||||
static void destroy(JSC::JSCell*);
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
|
||||
}
|
||||
|
||||
~JSArrayBufferSink();
|
||||
|
||||
void* wrapped() const { return m_sinkPtr; }
|
||||
|
||||
static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
|
||||
|
||||
void* m_sinkPtr;
|
||||
|
||||
JSArrayBufferSink(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr)
|
||||
: Base(vm, structure)
|
||||
{
|
||||
m_sinkPtr = sinkPtr;
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&);
|
||||
};
|
||||
|
||||
class JSReadableArrayBufferSinkController final : public JSC::JSDestructibleObject {
|
||||
public:
|
||||
using Base = JSC::JSDestructibleObject;
|
||||
static JSReadableArrayBufferSinkController* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr, JSC::JSFunction* pullFunction, JSC::JSFunction* cancelFunction);
|
||||
static constexpr SinkID Sink = SinkID::ArrayBufferSink;
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<JSReadableArrayBufferSinkController, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); });
|
||||
}
|
||||
|
||||
static void destroy(JSC::JSCell*);
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
|
||||
}
|
||||
|
||||
~JSReadableArrayBufferSinkController();
|
||||
|
||||
void* wrapped() const { return m_sinkPtr; }
|
||||
|
||||
static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
|
||||
|
||||
void* m_sinkPtr;
|
||||
mutable WriteBarrier<JSFunction> m_pull;
|
||||
mutable WriteBarrier<JSFunction> m_cancel;
|
||||
// start is not stored because it doesn't need to be
|
||||
|
||||
DECLARE_VISIT_CHILDREN;
|
||||
|
||||
JSReadableArrayBufferSinkController(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr, JSC::JSFunction* pullFunction, JSC::JSFunction* cancelFunction)
|
||||
: Base(vm, structure)
|
||||
{
|
||||
if (pullFunction != nullptr)
|
||||
m_pull.set(vm, this, pullFunction);
|
||||
if (cancelFunction != nullptr)
|
||||
m_cancel.set(vm, this, cancelFunction);
|
||||
|
||||
m_sinkPtr = sinkPtr;
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&);
|
||||
};
|
||||
|
||||
JSC_DECLARE_CUSTOM_GETTER(functionArrayBufferSink__getter);
|
||||
JSC_DECLARE_CUSTOM_GETTER(functionArrayBufferSinkController__getter);
|
||||
|
||||
|
||||
JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID);
|
||||
JSObject* createJSSinkControllerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID);
|
||||
|
||||
} // namespace WebCore
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace WebCore {
|
||||
|
||||
const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 2344;
|
||||
const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 1782;
|
||||
static const JSC::Intrinsic s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode =
|
||||
"(function (stream, underlyingByteSource, highWaterMark)\n" \
|
||||
@@ -69,7 +69,7 @@ const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStre
|
||||
" @putByIdDirectPrivate(this, \"pulling\", false);\n" \
|
||||
" @readableByteStreamControllerClearPendingPullIntos(this);\n" \
|
||||
" @putByIdDirectPrivate(this, \"queue\", @newQueue());\n" \
|
||||
" @putByIdDirectPrivate(this, \"started\", false);\n" \
|
||||
" @putByIdDirectPrivate(this, \"started\", -1);\n" \
|
||||
" @putByIdDirectPrivate(this, \"closeRequested\", false);\n" \
|
||||
"\n" \
|
||||
" let hwm = @toNumber(highWaterMark);\n" \
|
||||
@@ -86,17 +86,6 @@ const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStre
|
||||
" @putByIdDirectPrivate(this, \"autoAllocateChunkSize\", autoAllocateChunkSize);\n" \
|
||||
" @putByIdDirectPrivate(this, \"pendingPullIntos\", @createFIFO());\n" \
|
||||
"\n" \
|
||||
" const controller = this;\n" \
|
||||
" const startResult = @promiseInvokeOrNoopNoCatch(underlyingByteSource, \"start\", [this]).@then(() => {\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", true);\n" \
|
||||
" @assert(!@getByIdDirectPrivate(controller, \"pulling\"));\n" \
|
||||
" @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \
|
||||
" @readableByteStreamControllerCallPullIfNeeded(controller);\n" \
|
||||
" }, (error) => {\n" \
|
||||
" if (@getByIdDirectPrivate(stream, \"state\") === @streamReadable)\n" \
|
||||
" @readableByteStreamControllerError(controller, error);\n" \
|
||||
" });\n" \
|
||||
"\n" \
|
||||
" @putByIdDirectPrivate(this, \"cancel\", @readableByteStreamControllerCancel);\n" \
|
||||
" @putByIdDirectPrivate(this, \"pull\", @readableByteStreamControllerPull);\n" \
|
||||
"\n" \
|
||||
@@ -104,6 +93,32 @@ const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStre
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength = 829;
|
||||
static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCode =
|
||||
"(function (controller) {\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" if (@getByIdDirectPrivate(controller, \"started\") !== -1)\n" \
|
||||
" return;\n" \
|
||||
"\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", 0);\n" \
|
||||
"\n" \
|
||||
" return @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"start\", [controller]).@then(() => {\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", 1);\n" \
|
||||
" @assert(!@getByIdDirectPrivate(controller, \"pulling\"));\n" \
|
||||
" @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \
|
||||
" @readableByteStreamControllerCallPullIfNeeded(controller);\n" \
|
||||
" }, (error) => {\n" \
|
||||
" var stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \
|
||||
" if (stream && @getByIdDirectPrivate(stream, \"state\") === @streamReadable)\n" \
|
||||
" @readableByteStreamControllerError(controller, error);\n" \
|
||||
" });\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength = 187;
|
||||
@@ -366,7 +381,7 @@ const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullC
|
||||
|
||||
const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength = 873;
|
||||
const int s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength = 879;
|
||||
static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCode =
|
||||
"(function (controller)\n" \
|
||||
@@ -379,7 +394,7 @@ const char* const s_readableByteStreamInternalsReadableByteStreamControllerShoul
|
||||
" return false;\n" \
|
||||
" if (@getByIdDirectPrivate(controller, \"closeRequested\"))\n" \
|
||||
" return false;\n" \
|
||||
" if (!@getByIdDirectPrivate(controller, \"started\"))\n" \
|
||||
" if (!(@getByIdDirectPrivate(controller, \"started\") > 0))\n" \
|
||||
" return false;\n" \
|
||||
" const reader = @getByIdDirectPrivate(stream, \"reader\");\n" \
|
||||
" \n" \
|
||||
|
||||
@@ -51,6 +51,10 @@ extern const char* const s_readableByteStreamInternalsPrivateInitializeReadableB
|
||||
extern const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength;
|
||||
extern const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility;
|
||||
extern const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind;
|
||||
extern const char* const s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCode;
|
||||
extern const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength;
|
||||
extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility;
|
||||
extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructorKind;
|
||||
extern const char* const s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode;
|
||||
extern const int s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength;
|
||||
extern const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructAbility;
|
||||
@@ -190,6 +194,7 @@ extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAdd
|
||||
|
||||
#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_DATA(macro) \
|
||||
macro(privateInitializeReadableByteStreamController, readableByteStreamInternalsPrivateInitializeReadableByteStreamController, 3) \
|
||||
macro(readableStreamByteStreamControllerStart, readableByteStreamInternalsReadableStreamByteStreamControllerStart, 1) \
|
||||
macro(privateInitializeReadableStreamBYOBRequest, readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequest, 2) \
|
||||
macro(isReadableByteStreamController, readableByteStreamInternalsIsReadableByteStreamController, 1) \
|
||||
macro(isReadableStreamBYOBRequest, readableByteStreamInternalsIsReadableStreamBYOBRequest, 1) \
|
||||
@@ -226,6 +231,7 @@ extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAdd
|
||||
macro(readableStreamAddReadIntoRequest, readableByteStreamInternalsReadableStreamAddReadIntoRequest, 1) \
|
||||
|
||||
#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_PRIVATEINITIALIZEREADABLEBYTESTREAMCONTROLLER 1
|
||||
#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMBYTESTREAMCONTROLLERSTART 1
|
||||
#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_PRIVATEINITIALIZEREADABLESTREAMBYOBREQUEST 1
|
||||
#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLEBYTESTREAMCONTROLLER 1
|
||||
#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLESTREAMBYOBREQUEST 1
|
||||
@@ -263,6 +269,7 @@ extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAdd
|
||||
|
||||
#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(macro) \
|
||||
macro(readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode, privateInitializeReadableByteStreamController, ASCIILiteral(), s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength) \
|
||||
macro(readableByteStreamInternalsReadableStreamByteStreamControllerStartCode, readableStreamByteStreamControllerStart, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength) \
|
||||
macro(readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode, privateInitializeReadableStreamBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength) \
|
||||
macro(readableByteStreamInternalsIsReadableByteStreamControllerCode, isReadableByteStreamController, ASCIILiteral(), s_readableByteStreamInternalsIsReadableByteStreamControllerCodeLength) \
|
||||
macro(readableByteStreamInternalsIsReadableStreamBYOBRequestCode, isReadableStreamBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeLength) \
|
||||
@@ -329,6 +336,7 @@ extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAdd
|
||||
macro(readableByteStreamControllerShouldCallPull) \
|
||||
macro(readableStreamAddReadIntoRequest) \
|
||||
macro(readableStreamBYOBReaderRead) \
|
||||
macro(readableStreamByteStreamControllerStart) \
|
||||
macro(readableStreamFulfillReadIntoRequest) \
|
||||
macro(readableStreamHasBYOBReader) \
|
||||
macro(readableStreamHasDefaultReader) \
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace WebCore {
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamInitializeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamInitializeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamInitializeReadableStreamCodeLength = 2408;
|
||||
const int s_readableStreamInitializeReadableStreamCodeLength = 2367;
|
||||
static const JSC::Intrinsic s_readableStreamInitializeReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamInitializeReadableStreamCode =
|
||||
"(function (underlyingSource, strategy)\n" \
|
||||
@@ -70,6 +70,7 @@ const char* const s_readableStreamInitializeReadableStreamCode =
|
||||
" @putByIdDirectPrivate(this, \"state\", @streamReadable);\n" \
|
||||
" \n" \
|
||||
" @putByIdDirectPrivate(this, \"reader\", @undefined);\n" \
|
||||
" @putByIdDirectPrivate(this, \"sink\", @undefined);\n" \
|
||||
" \n" \
|
||||
" @putByIdDirectPrivate(this, \"storedError\", @undefined);\n" \
|
||||
" \n" \
|
||||
@@ -102,8 +103,6 @@ const char* const s_readableStreamInitializeReadableStreamCode =
|
||||
" if (strategy.size !== @undefined)\n" \
|
||||
" @throwRangeError(\"Strategy for a ReadableByteStreamController cannot have a size\");\n" \
|
||||
"\n" \
|
||||
" let readableByteStreamControllerConstructor = @ReadableByteStreamController;\n" \
|
||||
" \n" \
|
||||
" @putByIdDirectPrivate(this, \"readableStreamController\", new @ReadableByteStreamController(this, underlyingSource, strategy.highWaterMark, @isReadableStream));\n" \
|
||||
" } else if (type === @undefined) {\n" \
|
||||
" if (strategy.highWaterMark === @undefined)\n" \
|
||||
@@ -268,7 +267,7 @@ const char* const s_readableStreamReadableStreamToArrayPublicCode =
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamConsumeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamConsumeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamConsumeReadableStreamCodeLength = 3683;
|
||||
const int s_readableStreamConsumeReadableStreamCodeLength = 3696;
|
||||
static const JSC::Intrinsic s_readableStreamConsumeReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamConsumeReadableStreamCode =
|
||||
"(function (nativePtr, nativeType, inputStream) {\n" \
|
||||
@@ -369,6 +368,8 @@ const char* const s_readableStreamConsumeReadableStreamCode =
|
||||
" if (!this.#ptr) return @throwTypeError(\"ReadableStreamSink is already closed\");\n" \
|
||||
" return this.processResult(this.#reader.readMany());\n" \
|
||||
" }\n" \
|
||||
"\n" \
|
||||
" \n" \
|
||||
" };\n" \
|
||||
"\n" \
|
||||
" const minlength = nativeType + 1;\n" \
|
||||
@@ -382,20 +383,18 @@ const char* const s_readableStreamConsumeReadableStreamCode =
|
||||
" @throwTypeError(\"Cannot start reading from a locked stream\");\n" \
|
||||
" }\n" \
|
||||
"\n" \
|
||||
" return new Prototype(inputStream.getReader(), nativePtr);\n" \
|
||||
" return new Prototype(inputStream.getReader(), nativePtr);\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamCreateEmptyReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamCreateEmptyReadableStreamCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamCreateEmptyReadableStreamCodeLength = 178;
|
||||
const int s_readableStreamCreateEmptyReadableStreamCodeLength = 137;
|
||||
static const JSC::Intrinsic s_readableStreamCreateEmptyReadableStreamCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamCreateEmptyReadableStreamCode =
|
||||
"(function () {\n" \
|
||||
" var stream = new @ReadableStream({\n" \
|
||||
" pull() {},\n" \
|
||||
" start() {},\n" \
|
||||
" cancel() {},\n" \
|
||||
" });\n" \
|
||||
" @readableStreamClose(stream);\n" \
|
||||
" return stream;\n" \
|
||||
@@ -520,7 +519,7 @@ const char* const s_readableStreamCancelCode =
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamGetReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamGetReaderCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamGetReaderCodeLength = 481;
|
||||
const int s_readableStreamGetReaderCodeLength = 759;
|
||||
static const JSC::Intrinsic s_readableStreamGetReaderCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamGetReaderCode =
|
||||
"(function (options)\n" \
|
||||
@@ -535,8 +534,15 @@ const char* const s_readableStreamGetReaderCode =
|
||||
" return new @ReadableStreamDefaultReader(this);\n" \
|
||||
"\n" \
|
||||
" //\n" \
|
||||
" if (mode == 'byob')\n" \
|
||||
" if (mode == 'byob') {\n" \
|
||||
" var controller = @getByIdDirectPrivate(this, \"controller\");\n" \
|
||||
" if (@isReadableStreamDefaultController(controller))\n" \
|
||||
" @readableStreamDefaultControllerStart(controller)\n" \
|
||||
" else\n" \
|
||||
" @readableStreamByteStreamControllerStart(controller);\n" \
|
||||
"\n" \
|
||||
" return new @ReadableStreamBYOBReader(this);\n" \
|
||||
" }\n" \
|
||||
"\n" \
|
||||
" \n" \
|
||||
" @throwTypeError(\"Invalid mode is specified\");\n" \
|
||||
|
||||
@@ -89,7 +89,7 @@ const char* const s_readableStreamDefaultReaderCancelCode =
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamDefaultReaderReadManyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamDefaultReaderReadManyCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamDefaultReaderReadManyCodeLength = 3235;
|
||||
const int s_readableStreamDefaultReaderReadManyCodeLength = 3414;
|
||||
static const JSC::Intrinsic s_readableStreamDefaultReaderReadManyCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamDefaultReaderReadManyCode =
|
||||
"(function ()\n" \
|
||||
@@ -118,19 +118,20 @@ const char* const s_readableStreamDefaultReaderReadManyCode =
|
||||
" var size = @getByIdDirectPrivate(controller, \"queue\").size;\n" \
|
||||
" var values = content.toArray(false);\n" \
|
||||
" var length = values.length;\n" \
|
||||
" \n" \
|
||||
"\n" \
|
||||
" if (length > 0) {\n" \
|
||||
" for (var i = 0; i < values.length; i++) {\n" \
|
||||
" const buf = values[i];\n" \
|
||||
" if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n" \
|
||||
" values[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n" \
|
||||
"\n" \
|
||||
" if (@isReadableByteStreamController(controller)) {\n" \
|
||||
" for (var i = 0; i < value.length; i++) {\n" \
|
||||
" const buf = value[i];\n" \
|
||||
" if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n" \
|
||||
" value[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" \n" \
|
||||
" @resetQueue(@getByIdDirectPrivate(controller, \"queue\"));\n" \
|
||||
"\n" \
|
||||
" \n" \
|
||||
" if (@getByIdDirectPrivate(controller, \"closeRequested\"))\n" \
|
||||
" @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n" \
|
||||
" else if (@isReadableStreamDefaultController(controller)) \n" \
|
||||
@@ -149,13 +150,16 @@ const char* const s_readableStreamDefaultReaderReadManyCode =
|
||||
" \n" \
|
||||
" var queue = @getByIdDirectPrivate(controller, \"queue\");\n" \
|
||||
" var value = [result.value].concat(queue.content.toArray(false));\n" \
|
||||
" for (var i = 0; i < value.length; i++) {\n" \
|
||||
" const buf = value[i];\n" \
|
||||
" if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n" \
|
||||
" value[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n" \
|
||||
"\n" \
|
||||
" if (@isReadableByteStreamController(controller)) {\n" \
|
||||
" for (var i = 0; i < value.length; i++) {\n" \
|
||||
" const buf = value[i];\n" \
|
||||
" if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n" \
|
||||
" value[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
" }\n" \
|
||||
"\n" \
|
||||
" \n" \
|
||||
" var size = queue.size;\n" \
|
||||
" @resetQueue(queue);\n" \
|
||||
"\n" \
|
||||
|
||||
@@ -71,7 +71,7 @@ const char* const s_readableStreamInternalsReadableStreamReaderGenericInitialize
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength = 908;
|
||||
const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength = 910;
|
||||
static const JSC::Intrinsic s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode =
|
||||
"(function (stream, underlyingSource, size, highWaterMark)\n" \
|
||||
@@ -90,12 +90,13 @@ const char* const s_readableStreamInternalsPrivateInitializeReadableStreamDefaul
|
||||
" @putByIdDirectPrivate(this, \"controlledReadableStream\", stream);\n" \
|
||||
" @putByIdDirectPrivate(this, \"underlyingSource\", underlyingSource);\n" \
|
||||
" @putByIdDirectPrivate(this, \"queue\", @newQueue());\n" \
|
||||
" @putByIdDirectPrivate(this, \"started\", false);\n" \
|
||||
" @putByIdDirectPrivate(this, \"started\", -1);\n" \
|
||||
" @putByIdDirectPrivate(this, \"closeRequested\", false);\n" \
|
||||
" @putByIdDirectPrivate(this, \"pullAgain\", false);\n" \
|
||||
" @putByIdDirectPrivate(this, \"pulling\", false);\n" \
|
||||
" @putByIdDirectPrivate(this, \"strategy\", @validateAndNormalizeQueuingStrategy(size, highWaterMark));\n" \
|
||||
" \n" \
|
||||
" \n" \
|
||||
"\n" \
|
||||
"\n" \
|
||||
" return this;\n" \
|
||||
@@ -104,7 +105,7 @@ const char* const s_readableStreamInternalsPrivateInitializeReadableStreamDefaul
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength = 1378;
|
||||
const int s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength = 876;
|
||||
static const JSC::Intrinsic s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerCode =
|
||||
"(function (stream, underlyingSource, size, highWaterMark, startMethod, pullMethod, cancelMethod)\n" \
|
||||
@@ -112,7 +113,7 @@ const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerC
|
||||
" \"use strict\";\n" \
|
||||
" \n" \
|
||||
" const controller = new @ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark, @isReadableStream);\n" \
|
||||
" const startAlgorithm = () => @promiseInvokeOrNoopMethodNoCatch(underlyingSource, startMethod, [controller]);\n" \
|
||||
" \n" \
|
||||
" const pullAlgorithm = () => @promiseInvokeOrNoopMethod(underlyingSource, pullMethod, [controller]);\n" \
|
||||
" const cancelAlgorithm = (reason) => @promiseInvokeOrNoopMethod(underlyingSource, cancelMethod, [reason]);\n" \
|
||||
" \n" \
|
||||
@@ -122,8 +123,25 @@ const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerC
|
||||
" @putByIdDirectPrivate(controller, \"cancel\", @readableStreamDefaultControllerCancel);\n" \
|
||||
" @putByIdDirectPrivate(stream, \"readableStreamController\", controller);\n" \
|
||||
"\n" \
|
||||
" startAlgorithm().@then(() => {\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", true);\n" \
|
||||
" \n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength = 782;
|
||||
static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerStartCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamInternalsReadableStreamDefaultControllerStartCode =
|
||||
"(function (controller) {\n" \
|
||||
" if (@getByIdDirectPrivate(controller, \"started\") !== -1)\n" \
|
||||
" return;\n" \
|
||||
"\n" \
|
||||
" const underlyingSource = @getByIdDirectPrivate(controller, \"underlyingSource\");\n" \
|
||||
" const startMethod = @getByIdDirectPrivate(underlyingSource, \"start\");\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", 0);\n" \
|
||||
"\n" \
|
||||
" return @promiseInvokeOrNoopMethodNoCatch(underlyingSource, startMethod, [controller]).@then(() => {\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", 1);\n" \
|
||||
" @assert(!@getByIdDirectPrivate(controller, \"pulling\"));\n" \
|
||||
" @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \
|
||||
" @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \
|
||||
@@ -188,11 +206,18 @@ const char* const s_readableStreamInternalsReadableStreamPipeToCode =
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength = 77;
|
||||
const int s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength = 356;
|
||||
static const JSC::Intrinsic s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamInternalsAcquireReadableStreamDefaultReaderCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" var controller = @getByIdDirectPrivate(stream, \"readableStreamController\");\n" \
|
||||
" if (@isReadableStreamDefaultController(controller)) {\n" \
|
||||
" @readableStreamDefaultControllerStart(controller);\n" \
|
||||
" } else {\n" \
|
||||
" @readableStreamByteStreamControllerStart(controller);\n" \
|
||||
" }\n" \
|
||||
"\n" \
|
||||
" return new @ReadableStreamDefaultReader(stream);\n" \
|
||||
"})\n" \
|
||||
;
|
||||
@@ -726,7 +751,7 @@ const char* const s_readableStreamInternalsReadableStreamErrorCode =
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength = 659;
|
||||
const int s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength = 665;
|
||||
static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCode =
|
||||
"(function (controller)\n" \
|
||||
@@ -735,7 +760,7 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerShould
|
||||
"\n" \
|
||||
" if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller))\n" \
|
||||
" return false;\n" \
|
||||
" if (!@getByIdDirectPrivate(controller, \"started\"))\n" \
|
||||
" if (!(@getByIdDirectPrivate(controller, \"started\") > 0))\n" \
|
||||
" return false;\n" \
|
||||
" if ((!@isReadableStreamLocked(stream) || !@getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\")?.isNotEmpty()) && @readableStreamDefaultControllerGetDesiredSize(controller) <= 0)\n" \
|
||||
" return false;\n" \
|
||||
@@ -747,7 +772,7 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerShould
|
||||
|
||||
const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength = 1246;
|
||||
const int s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength = 1252;
|
||||
static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCode =
|
||||
"(function (controller)\n" \
|
||||
@@ -759,7 +784,7 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerCallPu
|
||||
"\n" \
|
||||
" if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller))\n" \
|
||||
" return;\n" \
|
||||
" if (!@getByIdDirectPrivate(controller, \"started\"))\n" \
|
||||
" if (!(@getByIdDirectPrivate(controller, \"started\") > 0))\n" \
|
||||
" return;\n" \
|
||||
" if ((!@isReadableStreamLocked(stream) || !@getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\")?.isNotEmpty()) && @readableStreamDefaultControllerGetDesiredSize(controller) <= 0)\n" \
|
||||
" return;\n" \
|
||||
|
||||
@@ -59,6 +59,10 @@ extern const char* const s_readableStreamInternalsSetupReadableStreamDefaultCont
|
||||
extern const int s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength;
|
||||
extern const JSC::ConstructAbility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructAbility;
|
||||
extern const JSC::ConstructorKind s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructorKind;
|
||||
extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerStartCode;
|
||||
extern const int s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength;
|
||||
extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructAbility;
|
||||
extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructorKind;
|
||||
extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerErrorCode;
|
||||
extern const int s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength;
|
||||
extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructAbility;
|
||||
@@ -216,6 +220,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefault
|
||||
macro(readableStreamReaderGenericInitialize, readableStreamInternalsReadableStreamReaderGenericInitialize, 2) \
|
||||
macro(privateInitializeReadableStreamDefaultController, readableStreamInternalsPrivateInitializeReadableStreamDefaultController, 4) \
|
||||
macro(setupReadableStreamDefaultController, readableStreamInternalsSetupReadableStreamDefaultController, 7) \
|
||||
macro(readableStreamDefaultControllerStart, readableStreamInternalsReadableStreamDefaultControllerStart, 1) \
|
||||
macro(readableStreamDefaultControllerError, readableStreamInternalsReadableStreamDefaultControllerError, 2) \
|
||||
macro(readableStreamPipeTo, readableStreamInternalsReadableStreamPipeTo, 2) \
|
||||
macro(acquireReadableStreamDefaultReader, readableStreamInternalsAcquireReadableStreamDefaultReader, 1) \
|
||||
@@ -258,6 +263,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefault
|
||||
#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMREADERGENERICINITIALIZE 1
|
||||
#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PRIVATEINITIALIZEREADABLESTREAMDEFAULTCONTROLLER 1
|
||||
#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_SETUPREADABLESTREAMDEFAULTCONTROLLER 1
|
||||
#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERSTART 1
|
||||
#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERERROR 1
|
||||
#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMPIPETO 1
|
||||
#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ACQUIREREADABLESTREAMDEFAULTREADER 1
|
||||
@@ -301,6 +307,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefault
|
||||
macro(readableStreamInternalsReadableStreamReaderGenericInitializeCode, readableStreamReaderGenericInitialize, ASCIILiteral(), s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength) \
|
||||
macro(readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode, privateInitializeReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength) \
|
||||
macro(readableStreamInternalsSetupReadableStreamDefaultControllerCode, setupReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength) \
|
||||
macro(readableStreamInternalsReadableStreamDefaultControllerStartCode, readableStreamDefaultControllerStart, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength) \
|
||||
macro(readableStreamInternalsReadableStreamDefaultControllerErrorCode, readableStreamDefaultControllerError, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength) \
|
||||
macro(readableStreamInternalsReadableStreamPipeToCode, readableStreamPipeTo, ASCIILiteral(), s_readableStreamInternalsReadableStreamPipeToCodeLength) \
|
||||
macro(readableStreamInternalsAcquireReadableStreamDefaultReaderCode, acquireReadableStreamDefaultReader, ASCIILiteral(), s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength) \
|
||||
@@ -369,6 +376,7 @@ extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefault
|
||||
macro(readableStreamDefaultControllerGetDesiredSize) \
|
||||
macro(readableStreamDefaultControllerPull) \
|
||||
macro(readableStreamDefaultControllerShouldCallPull) \
|
||||
macro(readableStreamDefaultControllerStart) \
|
||||
macro(readableStreamDefaultReaderRead) \
|
||||
macro(readableStreamError) \
|
||||
macro(readableStreamFulfillReadRequest) \
|
||||
|
||||
@@ -75,11 +75,12 @@ const char* const s_writableStreamInternalsIsWritableStreamDefaultWriterCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength = 77;
|
||||
const int s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength = 165;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsAcquireWritableStreamDefaultWriterCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" @writableStreamDefaultControllerStart(@getByIdDirectPrivate(stream, \"controller\"));\n" \
|
||||
" return new @WritableStreamDefaultWriter(stream);\n" \
|
||||
"})\n" \
|
||||
;
|
||||
@@ -160,11 +161,12 @@ const char* const s_writableStreamInternalsCreateInternalWritableStreamFromUnder
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength = 745;
|
||||
const int s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength = 762;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsInitializeWritableStreamSlotsCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsInitializeWritableStreamSlotsCode =
|
||||
"(function (stream, underlyingSink)\n" \
|
||||
"{\n" \
|
||||
"{ \"use strict\";\n" \
|
||||
"\n" \
|
||||
" @putByIdDirectPrivate(stream, \"state\", \"writable\");\n" \
|
||||
" @putByIdDirectPrivate(stream, \"storedError\", @undefined);\n" \
|
||||
" @putByIdDirectPrivate(stream, \"writer\", @undefined);\n" \
|
||||
@@ -181,11 +183,12 @@ const char* const s_writableStreamInternalsInitializeWritableStreamSlotsCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength = 417;
|
||||
const int s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength = 434;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseForBindingsCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamCloseForBindingsCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
"{ \"use strict\";\n" \
|
||||
"\n" \
|
||||
" if (@isWritableStreamLocked(stream))\n" \
|
||||
" return @Promise.@reject(@makeTypeError(\"WritableStream.close method can only be used on non locked WritableStream\"));\n" \
|
||||
"\n" \
|
||||
@@ -198,11 +201,12 @@ const char* const s_writableStreamInternalsWritableStreamCloseForBindingsCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength = 249;
|
||||
const int s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength = 266;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAbortForBindingsCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamAbortForBindingsCode =
|
||||
"(function (stream, reason)\n" \
|
||||
"{\n" \
|
||||
"{ \"use strict\";\n" \
|
||||
"\n" \
|
||||
" if (@isWritableStreamLocked(stream))\n" \
|
||||
" return @Promise.@reject(@makeTypeError(\"WritableStream.abort method can only be used on non locked WritableStream\"));\n" \
|
||||
"\n" \
|
||||
@@ -212,22 +216,24 @@ const char* const s_writableStreamInternalsWritableStreamAbortForBindingsCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamLockedCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsIsWritableStreamLockedCodeLength = 91;
|
||||
const int s_writableStreamInternalsIsWritableStreamLockedCodeLength = 108;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsIsWritableStreamLockedCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsIsWritableStreamLockedCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
"{ \"use strict\";\n" \
|
||||
"\n" \
|
||||
" return @getByIdDirectPrivate(stream, \"writer\") !== @undefined;\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength = 1521;
|
||||
const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength = 1538;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode =
|
||||
"(function (writer, stream)\n" \
|
||||
"{\n" \
|
||||
"{ \"use strict\";\n" \
|
||||
"\n" \
|
||||
" if (@isWritableStreamLocked(stream))\n" \
|
||||
" @throwTypeError(\"WritableStream is locked\");\n" \
|
||||
"\n" \
|
||||
@@ -262,11 +268,12 @@ const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamAbortCodeLength = 910;
|
||||
const int s_writableStreamInternalsWritableStreamAbortCodeLength = 928;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAbortCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamAbortCode =
|
||||
"(function (stream, reason)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const state = @getByIdDirectPrivate(stream, \"state\");\n" \
|
||||
" if (state === \"closed\" || state === \"errored\")\n" \
|
||||
" return @Promise.@resolve();\n" \
|
||||
@@ -293,11 +300,13 @@ const char* const s_writableStreamInternalsWritableStreamAbortCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamCloseCodeLength = 885;
|
||||
const int s_writableStreamInternalsWritableStreamCloseCodeLength = 904;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamCloseCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const state = @getByIdDirectPrivate(stream, \"state\");\n" \
|
||||
" if (state === \"closed\" || state === \"errored\")\n" \
|
||||
" return @Promise.@reject(@makeTypeError(\"Cannot close a writable stream that is closed or errored\"));\n" \
|
||||
@@ -320,11 +329,13 @@ const char* const s_writableStreamInternalsWritableStreamCloseCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength = 372;
|
||||
const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength = 391;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAddWriteRequestCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" @assert(@isWritableStreamLocked(stream))\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \
|
||||
"\n" \
|
||||
@@ -337,22 +348,26 @@ const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength = 169;
|
||||
const int s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength = 188;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" return @getByIdDirectPrivate(stream, \"closeRequest\") !== @undefined || @getByIdDirectPrivate(stream, \"inFlightCloseRequest\") !== @undefined;\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength = 275;
|
||||
const int s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength = 294;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDealWithRejectionCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDealWithRejectionCode =
|
||||
"(function (stream, error)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const state = @getByIdDirectPrivate(stream, \"state\");\n" \
|
||||
" if (state === \"writable\") {\n" \
|
||||
" @writableStreamStartErroring(stream, error);\n" \
|
||||
@@ -366,11 +381,13 @@ const char* const s_writableStreamInternalsWritableStreamDealWithRejectionCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishErroringCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength = 1556;
|
||||
const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength = 1575;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishErroringCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamFinishErroringCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"state\") === \"erroring\");\n" \
|
||||
" @assert(!@writableStreamHasOperationMarkedInFlight(stream));\n" \
|
||||
"\n" \
|
||||
@@ -412,11 +429,13 @@ const char* const s_writableStreamInternalsWritableStreamFinishErroringCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength = 1092;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength = 1111;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const inFlightCloseRequest = @getByIdDirectPrivate(stream, \"inFlightCloseRequest\");\n" \
|
||||
" inFlightCloseRequest.@resolve.@call();\n" \
|
||||
"\n" \
|
||||
@@ -447,11 +466,13 @@ const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength = 734;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength = 753;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode =
|
||||
"(function (stream, error)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const inFlightCloseRequest = @getByIdDirectPrivate(stream, \"inFlightCloseRequest\");\n" \
|
||||
" @assert(inFlightCloseRequest !== @undefined);\n" \
|
||||
" inFlightCloseRequest.@reject.@call(@undefined, error);\n" \
|
||||
@@ -473,11 +494,13 @@ const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWith
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength = 277;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength = 296;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const inFlightWriteRequest = @getByIdDirectPrivate(stream, \"inFlightWriteRequest\");\n" \
|
||||
" @assert(inFlightWriteRequest !== @undefined);\n" \
|
||||
" inFlightWriteRequest.@resolve.@call();\n" \
|
||||
@@ -488,11 +511,13 @@ const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength = 472;
|
||||
const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength = 491;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode =
|
||||
"(function (stream, error)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const inFlightWriteRequest = @getByIdDirectPrivate(stream, \"inFlightWriteRequest\");\n" \
|
||||
" @assert(inFlightWriteRequest !== @undefined);\n" \
|
||||
" inFlightWriteRequest.@reject.@call(@undefined, error);\n" \
|
||||
@@ -508,22 +533,26 @@ const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWith
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength = 177;
|
||||
const int s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength = 196;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" return @getByIdDirectPrivate(stream, \"inFlightWriteRequest\") !== @undefined || @getByIdDirectPrivate(stream, \"inFlightCloseRequest\") !== @undefined;\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength = 358;
|
||||
const int s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength = 377;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const closeRequest = @getByIdDirectPrivate(stream, \"closeRequest\");\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"inFlightCloseRequest\") === @undefined);\n" \
|
||||
" @assert(closeRequest !== @undefined);\n" \
|
||||
@@ -535,11 +564,13 @@ const char* const s_writableStreamInternalsWritableStreamMarkCloseRequestInFligh
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength = 344;
|
||||
const int s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength = 363;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const writeRequests = @getByIdDirectPrivate(stream, \"writeRequests\");\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"inFlightWriteRequest\") === @undefined);\n" \
|
||||
" @assert(writeRequests.isNotEmpty());\n" \
|
||||
@@ -551,11 +582,13 @@ const char* const s_writableStreamInternalsWritableStreamMarkFirstWriteRequestIn
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength = 790;
|
||||
const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength = 809;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode =
|
||||
"(function (stream)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"state\") === \"errored\");\n" \
|
||||
"\n" \
|
||||
" const storedError = @getByIdDirectPrivate(stream, \"storedError\");\n" \
|
||||
@@ -578,11 +611,13 @@ const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPro
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamStartErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamStartErroringCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamStartErroringCodeLength = 727;
|
||||
const int s_writableStreamInternalsWritableStreamStartErroringCodeLength = 752;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamStartErroringCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamStartErroringCode =
|
||||
"(function (stream, reason)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"storedError\") === @undefined);\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \
|
||||
" \n" \
|
||||
@@ -596,18 +631,19 @@ const char* const s_writableStreamInternalsWritableStreamStartErroringCode =
|
||||
" if (writer !== @undefined)\n" \
|
||||
" @writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n" \
|
||||
"\n" \
|
||||
" if (!@writableStreamHasOperationMarkedInFlight(stream) && @getByIdDirectPrivate(controller, \"started\"))\n" \
|
||||
" if (!@writableStreamHasOperationMarkedInFlight(stream) && @getByIdDirectPrivate(controller, \"started\") === 1)\n" \
|
||||
" @writableStreamFinishErroring(stream);\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength = 603;
|
||||
const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength = 621;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamUpdateBackpressureCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode =
|
||||
"(function (stream, backpressure)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \
|
||||
" @assert(!@writableStreamCloseQueuedOrInFlight(stream));\n" \
|
||||
"\n" \
|
||||
@@ -624,11 +660,12 @@ const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength = 177;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength = 195;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterAbortCode =
|
||||
"(function (writer, reason)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
" return @writableStreamAbort(stream, reason);\n" \
|
||||
@@ -637,11 +674,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterAbortCode
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength = 161;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength = 179;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseCode =
|
||||
"(function (writer)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
" return @writableStreamClose(stream);\n" \
|
||||
@@ -650,11 +688,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseCode
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength = 515;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength = 533;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCode =
|
||||
"(function (writer)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
"\n" \
|
||||
@@ -673,11 +712,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseWithE
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength = 607;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength = 625;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode =
|
||||
"(function (writer, error)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" let closedPromiseCapability = @getByIdDirectPrivate(writer, \"closedPromise\");\n" \
|
||||
" let closedPromise = closedPromiseCapability.@promise;\n" \
|
||||
"\n" \
|
||||
@@ -694,11 +734,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClos
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength = 595;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength = 613;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode =
|
||||
"(function (writer, error)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" let readyPromiseCapability = @getByIdDirectPrivate(writer, \"readyPromise\");\n" \
|
||||
" let readyPromise = readyPromiseCapability.@promise;\n" \
|
||||
"\n" \
|
||||
@@ -715,11 +756,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureRead
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength = 406;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength = 424;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCode =
|
||||
"(function (writer)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
"\n" \
|
||||
@@ -737,11 +779,13 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterGetDesired
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength = 549;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength = 568;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterReleaseCode =
|
||||
"(function (writer)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"writer\") === writer);\n" \
|
||||
@@ -758,11 +802,13 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterReleaseCod
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength = 1247;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength = 1266;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultWriterWriteCode =
|
||||
"(function (writer, chunk)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
"\n" \
|
||||
@@ -796,11 +842,13 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterWriteCode
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength = 1587;
|
||||
const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength = 1086;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerCode =
|
||||
"(function (stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" @assert(@isWritableStream(stream));\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"controller\") === @undefined);\n" \
|
||||
"\n" \
|
||||
@@ -809,7 +857,8 @@ const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerC
|
||||
"\n" \
|
||||
" @resetQueue(@getByIdDirectPrivate(controller, \"queue\"));\n" \
|
||||
"\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", false);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", -1);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"startAlgorithm\", startAlgorithm);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"strategySizeAlgorithm\", sizeAlgorithm);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"strategyHWM\", highWaterMark);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"writeAlgorithm\", writeAlgorithm);\n" \
|
||||
@@ -818,16 +867,34 @@ const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerC
|
||||
"\n" \
|
||||
" const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);\n" \
|
||||
" @writableStreamUpdateBackpressure(stream, backpressure);\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength = 982;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerStartCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerStartCode =
|
||||
"(function (controller) {\n" \
|
||||
" \"use strict\";\n" \
|
||||
"\n" \
|
||||
" @Promise.@resolve(startAlgorithm.@call()).@then(() => {\n" \
|
||||
" if (@getByIdDirectPrivate(controller, \"started\") !== -1)\n" \
|
||||
" return;\n" \
|
||||
"\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", 0);\n" \
|
||||
"\n" \
|
||||
" const startAlgorithm = @getByIdDirectPrivate(controller, \"startAlgorithm\");\n" \
|
||||
" @putByIdDirectPrivate(controller, \"startAlgorithm\", @undefined);\n" \
|
||||
" const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \
|
||||
" return @Promise.@resolve(startAlgorithm.@call()).@then(() => {\n" \
|
||||
" const state = @getByIdDirectPrivate(stream, \"state\");\n" \
|
||||
" @assert(state === \"writable\" || state === \"erroring\");\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", true);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", 1);\n" \
|
||||
" @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n" \
|
||||
" }, (error) => {\n" \
|
||||
" const state = @getByIdDirectPrivate(stream, \"state\");\n" \
|
||||
" @assert(state === \"writable\" || state === \"erroring\");\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", true);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"started\", 1);\n" \
|
||||
" @writableStreamDealWithRejection(stream, error);\n" \
|
||||
" });\n" \
|
||||
"})\n" \
|
||||
@@ -835,11 +902,12 @@ const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerC
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength = 1376;
|
||||
const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength = 1394;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode =
|
||||
"(function (stream, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const controller = new @WritableStreamDefaultController();\n" \
|
||||
"\n" \
|
||||
" let startAlgorithm = () => { };\n" \
|
||||
@@ -870,14 +938,15 @@ const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerF
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength = 872;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength = 895;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode =
|
||||
"(function (controller)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \
|
||||
"\n" \
|
||||
" if (!@getByIdDirectPrivate(controller, \"started\"))\n" \
|
||||
" if (@getByIdDirectPrivate(controller, \"started\") !== 1)\n" \
|
||||
" return;\n" \
|
||||
"\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
@@ -914,11 +983,12 @@ const char* const s_writableStreamInternalsIsCloseSentinelCode =
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength = 311;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength = 329;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCode =
|
||||
"(function (controller)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" @putByIdDirectPrivate(controller, \"writeAlgorithm\", @undefined);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"closeAlgorithm\", @undefined);\n" \
|
||||
" @putByIdDirectPrivate(controller, \"abortAlgorithm\", @undefined);\n" \
|
||||
@@ -928,11 +998,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerClearA
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength = 190;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength = 208;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerCloseCode =
|
||||
"(function (controller)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" @enqueueValueWithSize(@getByIdDirectPrivate(controller, \"queue\"), @isCloseSentinel, 0);\n" \
|
||||
" @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n" \
|
||||
"})\n" \
|
||||
@@ -940,11 +1011,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerCloseC
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength = 318;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength = 336;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorCode =
|
||||
"(function (controller, error)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \
|
||||
" @assert(stream !== @undefined);\n" \
|
||||
" @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \
|
||||
@@ -956,11 +1028,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorC
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength = 228;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength = 246;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCode =
|
||||
"(function (controller, error)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \
|
||||
" if (@getByIdDirectPrivate(stream, \"state\") === \"writable\")\n" \
|
||||
" @writableStreamDefaultControllerError(controller, error);\n" \
|
||||
@@ -969,11 +1042,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorI
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength = 141;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength = 159;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCode =
|
||||
"(function (controller)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const desiredSize = @writableStreamDefaultControllerGetDesiredSize(controller);\n" \
|
||||
" return desiredSize <= 0;\n" \
|
||||
"})\n" \
|
||||
@@ -981,11 +1055,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetBac
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength = 257;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength = 275;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCode =
|
||||
"(function (controller, chunk)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" try {\n" \
|
||||
" return @getByIdDirectPrivate(controller, \"strategySizeAlgorithm\").@call(@undefined, chunk);\n" \
|
||||
" } catch (e) {\n" \
|
||||
@@ -997,22 +1072,24 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetChu
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength = 139;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength = 157;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCode =
|
||||
"(function (controller)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" return @getByIdDirectPrivate(controller, \"strategyHWM\") - @getByIdDirectPrivate(controller, \"queue\").size;\n" \
|
||||
"})\n" \
|
||||
;
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength = 628;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength = 646;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCode =
|
||||
"(function (controller)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \
|
||||
"\n" \
|
||||
" @writableStreamMarkCloseRequestInFlight(stream);\n" \
|
||||
@@ -1033,11 +1110,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerProces
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength = 1147;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength = 1165;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCode =
|
||||
"(function (controller, chunk)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \
|
||||
"\n" \
|
||||
" @writableStreamMarkFirstWriteRequestInFlight(stream);\n" \
|
||||
@@ -1067,11 +1145,12 @@ const char* const s_writableStreamInternalsWritableStreamDefaultControllerProces
|
||||
|
||||
const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
|
||||
const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructorKind = JSC::ConstructorKind::None;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength = 707;
|
||||
const int s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength = 725;
|
||||
static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeIntrinsic = JSC::NoIntrinsic;
|
||||
const char* const s_writableStreamInternalsWritableStreamDefaultControllerWriteCode =
|
||||
"(function (controller, chunk, chunkSize)\n" \
|
||||
"{\n" \
|
||||
" \"use strict\";\n" \
|
||||
" try {\n" \
|
||||
" @enqueueValueWithSize(@getByIdDirectPrivate(controller, \"queue\"), chunk, chunkSize);\n" \
|
||||
"\n" \
|
||||
|
||||
@@ -187,6 +187,10 @@ extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultCont
|
||||
extern const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength;
|
||||
extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructAbility;
|
||||
extern const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructorKind;
|
||||
extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerStartCode;
|
||||
extern const int s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength;
|
||||
extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructAbility;
|
||||
extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructorKind;
|
||||
extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode;
|
||||
extern const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength;
|
||||
extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructAbility;
|
||||
@@ -276,6 +280,7 @@ extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefault
|
||||
macro(writableStreamDefaultWriterRelease, writableStreamInternalsWritableStreamDefaultWriterRelease, 1) \
|
||||
macro(writableStreamDefaultWriterWrite, writableStreamInternalsWritableStreamDefaultWriterWrite, 2) \
|
||||
macro(setUpWritableStreamDefaultController, writableStreamInternalsSetUpWritableStreamDefaultController, 8) \
|
||||
macro(writableStreamDefaultControllerStart, writableStreamInternalsWritableStreamDefaultControllerStart, 1) \
|
||||
macro(setUpWritableStreamDefaultControllerFromUnderlyingSink, writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSink, 5) \
|
||||
macro(writableStreamDefaultControllerAdvanceQueueIfNeeded, writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeeded, 1) \
|
||||
macro(isCloseSentinel, writableStreamInternalsIsCloseSentinel, 0) \
|
||||
@@ -325,6 +330,7 @@ extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefault
|
||||
#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERRELEASE 1
|
||||
#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERWRITE 1
|
||||
#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTCONTROLLER 1
|
||||
#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERSTART 1
|
||||
#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTCONTROLLERFROMUNDERLYINGSINK 1
|
||||
#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERADVANCEQUEUEIFNEEDED 1
|
||||
#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISCLOSESENTINEL 1
|
||||
@@ -375,6 +381,7 @@ extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefault
|
||||
macro(writableStreamInternalsWritableStreamDefaultWriterReleaseCode, writableStreamDefaultWriterRelease, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength) \
|
||||
macro(writableStreamInternalsWritableStreamDefaultWriterWriteCode, writableStreamDefaultWriterWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength) \
|
||||
macro(writableStreamInternalsSetUpWritableStreamDefaultControllerCode, setUpWritableStreamDefaultController, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength) \
|
||||
macro(writableStreamInternalsWritableStreamDefaultControllerStartCode, writableStreamDefaultControllerStart, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength) \
|
||||
macro(writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode, setUpWritableStreamDefaultControllerFromUnderlyingSink, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength) \
|
||||
macro(writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode, writableStreamDefaultControllerAdvanceQueueIfNeeded, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength) \
|
||||
macro(writableStreamInternalsIsCloseSentinelCode, isCloseSentinel, ASCIILiteral(), s_writableStreamInternalsIsCloseSentinelCodeLength) \
|
||||
@@ -418,6 +425,7 @@ extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefault
|
||||
macro(writableStreamDefaultControllerGetDesiredSize) \
|
||||
macro(writableStreamDefaultControllerProcessClose) \
|
||||
macro(writableStreamDefaultControllerProcessWrite) \
|
||||
macro(writableStreamDefaultControllerStart) \
|
||||
macro(writableStreamDefaultControllerWrite) \
|
||||
macro(writableStreamDefaultWriterAbort) \
|
||||
macro(writableStreamDefaultWriterClose) \
|
||||
|
||||
@@ -888,7 +888,7 @@ static JSC_DEFINE_HOST_FUNCTION(functionReportError,
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
extern "C" JSC__JSValue Bun__createUninitializedArrayBuffer(JSC::JSGlobalObject* globalObject, const void* ptr, size_t len)
|
||||
extern "C" JSC__JSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject* globalObject, const void* ptr, size_t len)
|
||||
{
|
||||
auto scope = DECLARE_THROW_SCOPE(globalObject->vm());
|
||||
auto arrayBuffer = JSC::ArrayBuffer::tryCreateUninitialized(len, 1);
|
||||
@@ -898,9 +898,28 @@ extern "C" JSC__JSValue Bun__createUninitializedArrayBuffer(JSC::JSGlobalObject*
|
||||
return JSC::JSValue::encode(JSC::JSValue {});
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
memcpy(arrayBuffer->data(), ptr, len);
|
||||
|
||||
RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTFMove(arrayBuffer))));
|
||||
}
|
||||
|
||||
extern "C" JSC__JSValue Bun__createUint8ArrayForCopy(JSC::JSGlobalObject* globalObject, const void* ptr, size_t len)
|
||||
{
|
||||
auto scope = DECLARE_THROW_SCOPE(globalObject->vm());
|
||||
JSC::JSUint8Array* array = JSC::JSUint8Array::createUninitialized(globalObject, globalObject->m_typedArrayUint8.get(globalObject), len);
|
||||
|
||||
if (UNLIKELY(!array)) {
|
||||
JSC::throwOutOfMemoryError(globalObject, scope);
|
||||
return JSC::JSValue::encode(JSC::JSValue {});
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
memcpy(array->vector(), ptr, len);
|
||||
|
||||
RELEASE_AND_RETURN(scope, JSValue::encode(array));
|
||||
}
|
||||
|
||||
JSC_DECLARE_HOST_FUNCTION(functionCreateUninitializedArrayBuffer);
|
||||
JSC_DEFINE_HOST_FUNCTION(functionCreateUninitializedArrayBuffer,
|
||||
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
|
||||
@@ -1744,12 +1763,12 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.cloneArrayBufferPrivateName(), JSFunction::create(vm, this, 3, String(), cloneArrayBuffer), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.structuredCloneForStreamPrivateName(), JSFunction::create(vm, this, 1, String(), structuredCloneForStream), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(vm.propertyNames->builtinNames().ArrayBufferPrivateName(), arrayBufferConstructor(), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamClosedPrivateName(), jsNumber(1), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamClosingPrivateName(), jsNumber(2), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamErroredPrivateName(), jsNumber(3), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamReadablePrivateName(), jsNumber(4), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamWaitingPrivateName(), jsNumber(5), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamWritablePrivateName(), jsNumber(6), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamClosedPrivateName(), jsNumber(1), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly | PropertyAttribute::ConstantInteger));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamClosingPrivateName(), jsNumber(2), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly | PropertyAttribute::ConstantInteger));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamErroredPrivateName(), jsNumber(3), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly | PropertyAttribute::ConstantInteger));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamReadablePrivateName(), jsNumber(4), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly | PropertyAttribute::ConstantInteger));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamWaitingPrivateName(), jsNumber(5), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly | PropertyAttribute::ConstantInteger));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.streamWritablePrivateName(), jsNumber(6), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly | PropertyAttribute::ConstantInteger));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.isAbortSignalPrivateName(), JSFunction::create(vm, this, 1, String(), isAbortSignal), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.getInternalWritableStreamPrivateName(), JSFunction::create(vm, this, 1, String(), getInternalWritableStream), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
extraStaticGlobals.uncheckedAppend(GlobalPropertyInfo(builtinNames.createWritableStreamFromInternalPrivateName(), JSFunction::create(vm, this, 1, String(), createWritableStreamFromInternal), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly));
|
||||
|
||||
@@ -41,7 +41,7 @@ function privateInitializeReadableByteStreamController(stream, underlyingByteSou
|
||||
@putByIdDirectPrivate(this, "pulling", false);
|
||||
@readableByteStreamControllerClearPendingPullIntos(this);
|
||||
@putByIdDirectPrivate(this, "queue", @newQueue());
|
||||
@putByIdDirectPrivate(this, "started", false);
|
||||
@putByIdDirectPrivate(this, "started", -1);
|
||||
@putByIdDirectPrivate(this, "closeRequested", false);
|
||||
|
||||
let hwm = @toNumber(highWaterMark);
|
||||
@@ -58,23 +58,32 @@ function privateInitializeReadableByteStreamController(stream, underlyingByteSou
|
||||
@putByIdDirectPrivate(this, "autoAllocateChunkSize", autoAllocateChunkSize);
|
||||
@putByIdDirectPrivate(this, "pendingPullIntos", @createFIFO());
|
||||
|
||||
const controller = this;
|
||||
const startResult = @promiseInvokeOrNoopNoCatch(underlyingByteSource, "start", [this]).@then(() => {
|
||||
@putByIdDirectPrivate(controller, "started", true);
|
||||
@assert(!@getByIdDirectPrivate(controller, "pulling"));
|
||||
@assert(!@getByIdDirectPrivate(controller, "pullAgain"));
|
||||
@readableByteStreamControllerCallPullIfNeeded(controller);
|
||||
}, (error) => {
|
||||
if (@getByIdDirectPrivate(stream, "state") === @streamReadable)
|
||||
@readableByteStreamControllerError(controller, error);
|
||||
});
|
||||
|
||||
@putByIdDirectPrivate(this, "cancel", @readableByteStreamControllerCancel);
|
||||
@putByIdDirectPrivate(this, "pull", @readableByteStreamControllerPull);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
function readableStreamByteStreamControllerStart(controller) {
|
||||
"use strict";
|
||||
|
||||
if (@getByIdDirectPrivate(controller, "started") !== -1)
|
||||
return;
|
||||
|
||||
@putByIdDirectPrivate(controller, "started", 0);
|
||||
var stream = @getByIdDirectPrivate(controller, "controlledReadableStream");
|
||||
return @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, "underlyingByteSource"), "start", [controller]).@then(() => {
|
||||
@putByIdDirectPrivate(controller, "started", 1);
|
||||
@assert(!@getByIdDirectPrivate(controller, "pulling"));
|
||||
@assert(!@getByIdDirectPrivate(controller, "pullAgain"));
|
||||
@readableByteStreamControllerCallPullIfNeeded(controller);
|
||||
}, (error) => {
|
||||
var stream = @getByIdDirectPrivate(controller, "controlledReadableStream");
|
||||
if (stream && @getByIdDirectPrivate(stream, "state") === @streamReadable)
|
||||
@readableByteStreamControllerError(controller, error);
|
||||
});
|
||||
}
|
||||
|
||||
function privateInitializeReadableStreamBYOBRequest(controller, view)
|
||||
{
|
||||
"use strict";
|
||||
@@ -267,7 +276,7 @@ function readableByteStreamControllerShouldCallPull(controller)
|
||||
return false;
|
||||
if (@getByIdDirectPrivate(controller, "closeRequested"))
|
||||
return false;
|
||||
if (!@getByIdDirectPrivate(controller, "started"))
|
||||
if (!(@getByIdDirectPrivate(controller, "started") > 0))
|
||||
return false;
|
||||
const reader = @getByIdDirectPrivate(stream, "reader");
|
||||
|
||||
|
||||
@@ -49,12 +49,18 @@ function initializeReadableStream(underlyingSource, strategy)
|
||||
|
||||
// Initialized with null value to enable distinction with undefined case.
|
||||
@putByIdDirectPrivate(this, "readableStreamController", null);
|
||||
|
||||
const isDirect = underlyingSource.type === "direct";
|
||||
// direct streams are always lazy
|
||||
const isLazy = isDirect || !!underlyingSource.@lazy;
|
||||
|
||||
|
||||
@putByIdDirectPrivate(this, "direct", isDirect);
|
||||
|
||||
// FIXME: We should introduce https://streams.spec.whatwg.org/#create-readable-stream.
|
||||
// For now, we emulate this with underlyingSource with private properties.
|
||||
if (@getByIdDirectPrivate(underlyingSource, "pull") !== @undefined) {
|
||||
|
||||
@putByIdDirectPrivate(this, "underlyingSource", @undefined);
|
||||
const size = @getByIdDirectPrivate(strategy, "size");
|
||||
const highWaterMark = @getByIdDirectPrivate(strategy, "highWaterMark");
|
||||
@setupReadableStreamDefaultController(this, underlyingSource, size, highWaterMark !== @undefined ? highWaterMark : 1, @getByIdDirectPrivate(underlyingSource, "start"), @getByIdDirectPrivate(underlyingSource, "pull"), @getByIdDirectPrivate(underlyingSource, "cancel"));
|
||||
@@ -62,6 +68,296 @@ function initializeReadableStream(underlyingSource, strategy)
|
||||
return this;
|
||||
}
|
||||
|
||||
if (isLazy) {
|
||||
|
||||
if (isDirect) {
|
||||
if ("start" in underlyingSource && typeof underlyingSource.start === "function")
|
||||
@throwTypeError("\"start\" for direct streams are not implemented yet");
|
||||
|
||||
|
||||
@putByIdDirectPrivate(this, "underlyingSource", underlyingSource);
|
||||
@putByIdDirectPrivate(this, "start", () => @createReadableStreamController(this, underlyingSource, strategy, true));
|
||||
} else {
|
||||
@putByIdDirectPrivate(this, "underlyingSource", @undefined);
|
||||
const autoAllocateChunkSize = underlyingSource.autoAllocateChunkSize;
|
||||
@putByIdDirectPrivate(this, "start", () => @lazyLoadStream(this, autoAllocateChunkSize));
|
||||
}
|
||||
} else {
|
||||
@putByIdDirectPrivate(this, "underlyingSource", @undefined);
|
||||
@putByIdDirectPrivate(this, "start", @undefined);
|
||||
@createReadableStreamController.@call(this, underlyingSource, strategy, false);
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
function handleDirectStreamError(e) {
|
||||
"use strict";
|
||||
|
||||
var controller = this;
|
||||
var sink = controller.@sink;
|
||||
if (sink) {
|
||||
@putByIdDirectPrivate(controller "sink", @undefined);
|
||||
try {
|
||||
sink.close(e);
|
||||
} catch (f) {}
|
||||
}
|
||||
|
||||
this.error = this.drain = this.write = this.close = this.end = @onReadableStreamDirectControllerClosed;
|
||||
|
||||
if (typeof this.@underlyingSource.close === 'function') {
|
||||
try {
|
||||
this.@underlyingSource.close.@call(this.@underlyingSource, e);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var pend = controller._pendingRead;
|
||||
if (pend) {
|
||||
controller._pendingRead = @undefined;
|
||||
@rejectPromise(pend, e);
|
||||
}
|
||||
} catch (f) {}
|
||||
var stream = controller.@controlledReadableStream;
|
||||
if (stream) @readableStreamError(stream, e);
|
||||
}
|
||||
|
||||
function handleDirectStreamErrorReject(e) {
|
||||
@handleDirectStreamError.@call(this, e);
|
||||
return @Promise.@reject(e);
|
||||
}
|
||||
|
||||
function onPullDirectStream(controller)
|
||||
{
|
||||
|
||||
"use strict";
|
||||
|
||||
var stream = controller.@controlledReadableStream;
|
||||
if (!stream || @getByIdDirectPrivate(stream, "state") !== @streamReadable)
|
||||
return;
|
||||
|
||||
// pull is in progress
|
||||
// this is a recursive call
|
||||
// ignore it
|
||||
if (controller._deferClose === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
controller._deferClose = -1;
|
||||
controller._deferDrain = -1;
|
||||
var deferClose;
|
||||
var deferDrain;
|
||||
|
||||
// Direct streams allow @pull to be called multiple times, unlike the spec.
|
||||
// Backpressure is handled by the destination, not by the underlying source.
|
||||
// In this case, we rely on the heuristic that repeatedly draining in the same tick
|
||||
// is bad for performance
|
||||
// this code is only run when consuming a direct stream from JS
|
||||
// without the HTTP server or anything else
|
||||
try {
|
||||
var result = controller.@underlyingSource.@pull(
|
||||
controller,
|
||||
);
|
||||
|
||||
if (result && @isPromise(result)) {
|
||||
if (controller._handleError === @undefined) {
|
||||
controller._handleError = @handleDirectStreamErrorReject.@bind(controller);
|
||||
}
|
||||
|
||||
@Promise.prototype.@catch.@call(result, controller._handleError);
|
||||
}
|
||||
} catch(e) {
|
||||
return @handleDirectStreamErrorReject.@call(controller, e);
|
||||
} finally {
|
||||
deferDrain = controller._deferClose;
|
||||
deferClose = controller._deferDrain;
|
||||
controller._deferDrain = 0;
|
||||
controller._deferClose = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var promiseToReturn;
|
||||
|
||||
|
||||
if (controller._pendingRead === @undefined) {
|
||||
controller._pendingRead = promiseToReturn = @newPromise();
|
||||
} else {
|
||||
promiseToReturn = @readableStreamAddReadRequest(stream);
|
||||
}
|
||||
|
||||
// they called close during @pull()
|
||||
// we delay that
|
||||
if (deferClose === 1) {
|
||||
var reason = controller._deferCloseReason;
|
||||
controller._deferCloseReason = @undefined;
|
||||
@onCloseDirectStream.@call(controller, reason);
|
||||
return promiseToReturn;
|
||||
}
|
||||
|
||||
// not done, but they called drain()
|
||||
if (deferDrain === 1) {
|
||||
@onDrainDirectStream.@call(controller);
|
||||
}
|
||||
|
||||
|
||||
return promiseToReturn;
|
||||
}
|
||||
|
||||
function noopDoneFunction() {
|
||||
return @Promise.@resolve({value: @undefined, done: true});
|
||||
}
|
||||
|
||||
function onReadableStreamDirectControllerClosed(reason)
|
||||
{
|
||||
"use strict";
|
||||
@throwTypeError("ReadableStreamDirectController is now closed");
|
||||
}
|
||||
|
||||
function onCloseDirectStream(reason)
|
||||
{
|
||||
"use strict";
|
||||
var stream = this.@controlledReadableStream;
|
||||
if (!stream || @getByIdDirectPrivate(stream, "state") !== @streamReadable)
|
||||
return;
|
||||
|
||||
if (this._deferClose !== 0) {
|
||||
this._deferClose = 1;
|
||||
this._deferCloseReason = reason;
|
||||
return;
|
||||
}
|
||||
|
||||
@putByIdDirectPrivate(stream, "state", @streamClosing);
|
||||
if (typeof this.@underlyingSource.close === 'function') {
|
||||
try {
|
||||
this.@underlyingSource.close.@call(this.@underlyingSource, reason);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var drained;
|
||||
try {
|
||||
drained = this.@sink.end();
|
||||
@putByIdDirectPrivate(this, "sink", @undefined);
|
||||
} catch (e) {
|
||||
if (this._pendingRead) {
|
||||
var read = this._pendingRead;
|
||||
this._pendingRead = @undefined;
|
||||
@rejectPromise(read, e);
|
||||
}
|
||||
@readableStreamError(stream, e);
|
||||
return;
|
||||
}
|
||||
|
||||
this.error = this.drain = this.write = this.close = this.end = @onReadableStreamDirectControllerClosed;
|
||||
|
||||
var reader = @getByIdDirectPrivate(stream, "reader");
|
||||
|
||||
if (reader && @isReadableStreamDefaultReader(reader)) {
|
||||
var _pendingRead = this._pendingRead;
|
||||
if (_pendingRead && @isPromise(_pendingRead) && drained?.byteLength) {
|
||||
this._pendingRead = @undefined;
|
||||
@fulfillPromise(_pendingRead, {value: drained, done: false});
|
||||
@readableStreamClose(stream);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (drained?.byteLength) {
|
||||
var requests = @getByIdDirectPrivate(reader, "readRequests");
|
||||
if (requests?.isNotEmpty()) {
|
||||
@readableStreamFulfillReadRequest(stream, drained, false);
|
||||
@readableStreamClose(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
@putByIdDirectPrivate(stream, "state", @streamReadable);
|
||||
this.@pull = () => {
|
||||
var thisResult = @createFulfilledPromise({value: drained, done: false});
|
||||
drained = @undefined;
|
||||
@readableStreamClose(stream);
|
||||
stream = @undefined;
|
||||
return thisResult;
|
||||
};
|
||||
} else if (this._pendingRead) {
|
||||
var read = this._pendingRead;
|
||||
this._pendingRead = @undefined;
|
||||
@putByIdDirectPrivate(this, "pull", @noopDoneFunction);
|
||||
@fulfillPromise(read, {value: @undefined, done: true});
|
||||
}
|
||||
|
||||
@readableStreamClose(stream);
|
||||
}
|
||||
|
||||
function onDrainDirectStream()
|
||||
{
|
||||
"use strict";
|
||||
|
||||
var straem = this.@controlledReadableStream;
|
||||
var reader = @getByIdDirectPrivate(stream, "reader");
|
||||
if (!reader || !@isReadableStreamDefaultReader(reader)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _pendingRead = this._pendingRead;
|
||||
this._pendingRead = @undefined;
|
||||
if (_pendingRead && @isPromise(_pendingRead)) {
|
||||
var drained = this.@sink.drain();
|
||||
if (drained?.byteLength) {
|
||||
this._pendingRead = @getByIdDirectPrivate(stream, "readRequests")?.shift();
|
||||
@fulfillPromise(_pendingRead, {value: drained, done: false});
|
||||
} else {
|
||||
this._pendingRead = _pendingRead;
|
||||
}
|
||||
} else if (@getByIdDirectPrivate(stream, "readRequests")?.isNotEmpty()) {
|
||||
var drained = this.@sink.drain();
|
||||
if (drained?.byteLength) {
|
||||
@readableStreamFulfillReadRequest(stream, drained, false);
|
||||
}
|
||||
} else if (this._deferDrain === -1) {
|
||||
this._deferDrain = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function initializeArrayBufferStream(underlyingSource, highWaterMark)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
// This is the fallback implementation for direct streams
|
||||
// When we don't know what the destination type is
|
||||
// We assume it is a Uint8Array.
|
||||
var sink = new globalThis.Bun.ArrayBufferSink(highWaterMark ? {highWaterMark, stream: true, asUint8Array: true} : {stream: true, asUint8Array: true});
|
||||
var controller = {
|
||||
@underlyingSource: underlyingSource,
|
||||
@pull: @onPullDirectStream,
|
||||
@controlledReadableStream: this,
|
||||
@sink: sink,
|
||||
close: @onCloseDirectStream,
|
||||
write: sink.write.@bind(sink),
|
||||
end: @onCloseDirectStream,
|
||||
drain: @onDrainDirectStream,
|
||||
_pendingRead: @undefined,
|
||||
_deferClose: 0,
|
||||
_deferDrain: 0,
|
||||
_deferCloseReason: @undefined,
|
||||
_handleError: @undefined,
|
||||
};
|
||||
|
||||
|
||||
@putByIdDirectPrivate(this, "readableStreamController", controller);
|
||||
|
||||
}
|
||||
|
||||
function createReadableStreamController(underlyingSource, strategy, fromLazy) {
|
||||
if (fromLazy) {
|
||||
@putByIdDirectPrivate(this, "start", @undefined);
|
||||
}
|
||||
|
||||
const type = underlyingSource.type;
|
||||
const typeString = @toString(type);
|
||||
|
||||
@@ -74,10 +370,14 @@ function initializeReadableStream(underlyingSource, strategy)
|
||||
if (strategy.size !== @undefined)
|
||||
@throwRangeError("Strategy for a ReadableByteStreamController cannot have a size");
|
||||
|
||||
let readableByteStreamControllerConstructor = @ReadableByteStreamController;
|
||||
|
||||
@putByIdDirectPrivate(this, "readableStreamController", new @ReadableByteStreamController(this, underlyingSource, strategy.highWaterMark, @isReadableStream));
|
||||
} else if (type === @undefined) {
|
||||
} else if (typeString === "direct") {
|
||||
if (strategy.size !== @undefined)
|
||||
@throwRangeError("Strategy for a ReadableDirectStreamController cannot have a size");
|
||||
|
||||
var highWaterMark = strategy.highWaterMark;
|
||||
@initializeArrayBufferStream.@call(this, underlyingSource, highWaterMark);
|
||||
} else if (type === @undefined) {
|
||||
if (strategy.highWaterMark === @undefined)
|
||||
strategy.highWaterMark = 1;
|
||||
|
||||
@@ -85,7 +385,6 @@ function initializeReadableStream(underlyingSource, strategy)
|
||||
} else
|
||||
@throwRangeError("Invalid type for underlying source");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@globalPrivate
|
||||
@@ -335,16 +634,18 @@ function consumeReadableStream(nativePtr, nativeType, inputStream) {
|
||||
function createEmptyReadableStream() {
|
||||
var stream = new @ReadableStream({
|
||||
pull() {},
|
||||
start() {},
|
||||
cancel() {},
|
||||
});
|
||||
@readableStreamClose(stream);
|
||||
return stream;
|
||||
}
|
||||
|
||||
@globalPrivate
|
||||
function createNativeReadableStream(nativePtr, nativeType, autoAllocateChunkSize) {
|
||||
function lazyLoadStream(stream, autoAllocateChunkSize) {
|
||||
"use strict";
|
||||
|
||||
@putByIdDirectPrivate(stream, "start", @undefined);
|
||||
var bunNativeType = @getByIdDirectPrivate(stream, "bunNativeType");
|
||||
var bunNativePtr = @getByIdDirectPrivate(stream, "bunNativePtr");
|
||||
|
||||
var cached = globalThis[Symbol.for("Bun.nativeReadableStreamPrototype")] ||= new @Map;
|
||||
var Prototype = cached.@get(nativeType);
|
||||
if (Prototype === @undefined) {
|
||||
@@ -415,7 +716,7 @@ function createNativeReadableStream(nativePtr, nativeType, autoAllocateChunkSize
|
||||
}
|
||||
cached.@set(nativeType, Prototype);
|
||||
}
|
||||
|
||||
|
||||
// either returns the chunk size
|
||||
// or throws an error
|
||||
// should never return a Promise
|
||||
@@ -423,12 +724,22 @@ function createNativeReadableStream(nativePtr, nativeType, autoAllocateChunkSize
|
||||
|
||||
// empty file, no need for native back-and-forth on this
|
||||
if (chunkSize === 0) {
|
||||
return @createEmptyReadableStream();
|
||||
@readableStreamClose(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
var instance = new Prototype(nativePtr, chunkSize);
|
||||
Prototype.registry.register(instance, nativePtr);
|
||||
var stream = new @ReadableStream(instance);
|
||||
@createReadableStreamController.@call(stream, instance, @undefined, true);
|
||||
}
|
||||
|
||||
@globalPrivate
|
||||
function createNativeReadableStream(nativePtr, nativeType, autoAllocateChunkSize) {
|
||||
"use strict";
|
||||
stream = new @ReadableStream({
|
||||
@lazy: true,
|
||||
autoAllocateChunkSize: autoAllocateChunkSize,
|
||||
});
|
||||
@putByIdDirectPrivate(stream, "bunNativeType", nativeType);
|
||||
@putByIdDirectPrivate(stream, "bunNativePtr", nativePtr);
|
||||
return stream;
|
||||
@@ -459,8 +770,16 @@ function getReader(options)
|
||||
return new @ReadableStreamDefaultReader(this);
|
||||
|
||||
// String conversion is required by spec, hence double equals.
|
||||
if (mode == 'byob')
|
||||
if (mode == 'byob') {
|
||||
var controller = @getByIdDirectPrivate(this, "controller");
|
||||
if (@isReadableStreamDefaultController(controller)) {
|
||||
@readableStreamDefaultControllerStart(controller);
|
||||
} else {
|
||||
@readableStreamByteStreamControllerStart(controller);
|
||||
}
|
||||
|
||||
return new @ReadableStreamBYOBReader(this);
|
||||
}
|
||||
|
||||
|
||||
@throwTypeError("Invalid mode is specified");
|
||||
|
||||
@@ -77,19 +77,20 @@ function readMany()
|
||||
var size = @getByIdDirectPrivate(controller, "queue").size;
|
||||
var values = content.toArray(false);
|
||||
var length = values.length;
|
||||
|
||||
|
||||
if (length > 0) {
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
const buf = values[i];
|
||||
if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {
|
||||
values[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
|
||||
if (@isReadableByteStreamController(controller)) {
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
const buf = value[i];
|
||||
if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {
|
||||
value[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@resetQueue(@getByIdDirectPrivate(controller, "queue"));
|
||||
|
||||
|
||||
if (@getByIdDirectPrivate(controller, "closeRequested"))
|
||||
@readableStreamClose(@getByIdDirectPrivate(controller, "controlledReadableStream"));
|
||||
else if (@isReadableStreamDefaultController(controller))
|
||||
@@ -108,13 +109,16 @@ function readMany()
|
||||
|
||||
var queue = @getByIdDirectPrivate(controller, "queue");
|
||||
var value = [result.value].concat(queue.content.toArray(false));
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
const buf = value[i];
|
||||
if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {
|
||||
value[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
|
||||
if (@isReadableByteStreamController(controller)) {
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
const buf = value[i];
|
||||
if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {
|
||||
value[i] = new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var size = queue.size;
|
||||
@resetQueue(queue);
|
||||
|
||||
|
||||
@@ -58,13 +58,11 @@ function privateInitializeReadableStreamDefaultController(stream, underlyingSour
|
||||
@putByIdDirectPrivate(this, "controlledReadableStream", stream);
|
||||
@putByIdDirectPrivate(this, "underlyingSource", underlyingSource);
|
||||
@putByIdDirectPrivate(this, "queue", @newQueue());
|
||||
@putByIdDirectPrivate(this, "started", false);
|
||||
@putByIdDirectPrivate(this, "started", -1);
|
||||
@putByIdDirectPrivate(this, "closeRequested", false);
|
||||
@putByIdDirectPrivate(this, "pullAgain", false);
|
||||
@putByIdDirectPrivate(this, "pulling", false);
|
||||
@putByIdDirectPrivate(this, "strategy", @validateAndNormalizeQueuingStrategy(size, highWaterMark));
|
||||
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -77,7 +75,7 @@ function setupReadableStreamDefaultController(stream, underlyingSource, size, hi
|
||||
"use strict";
|
||||
|
||||
const controller = new @ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark, @isReadableStream);
|
||||
const startAlgorithm = () => @promiseInvokeOrNoopMethodNoCatch(underlyingSource, startMethod, [controller]);
|
||||
|
||||
const pullAlgorithm = () => @promiseInvokeOrNoopMethod(underlyingSource, pullMethod, [controller]);
|
||||
const cancelAlgorithm = (reason) => @promiseInvokeOrNoopMethod(underlyingSource, cancelMethod, [reason]);
|
||||
|
||||
@@ -87,12 +85,25 @@ function setupReadableStreamDefaultController(stream, underlyingSource, size, hi
|
||||
@putByIdDirectPrivate(controller, "cancel", @readableStreamDefaultControllerCancel);
|
||||
@putByIdDirectPrivate(stream, "readableStreamController", controller);
|
||||
|
||||
startAlgorithm().@then(() => {
|
||||
@putByIdDirectPrivate(controller, "started", true);
|
||||
if (@getByIdDirectPrivate(controller, "sink") === @undefined) {
|
||||
@readableStreamDefaultControllerStart(controller);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function readableStreamDefaultControllerStart(controller) {
|
||||
if (@getByIdDirectPrivate(controller, "started") !== -1)
|
||||
return;
|
||||
|
||||
const underlyingSource = @getByIdDirectPrivate(controller, "underlyingSource");
|
||||
const startMethod = underlyingSource.start;
|
||||
@putByIdDirectPrivate(controller, "started", 0);
|
||||
|
||||
return @promiseInvokeOrNoopMethodNoCatch(underlyingSource, startMethod, [controller]).@then(() => {
|
||||
@putByIdDirectPrivate(controller, "started", 1);
|
||||
@assert(!@getByIdDirectPrivate(controller, "pulling"));
|
||||
@assert(!@getByIdDirectPrivate(controller, "pullAgain"));
|
||||
@readableStreamDefaultControllerCallPullIfNeeded(controller);
|
||||
|
||||
}, (error) => {
|
||||
@readableStreamDefaultControllerError(controller, error);
|
||||
});
|
||||
@@ -106,6 +117,7 @@ function readableStreamDefaultControllerError(controller, error)
|
||||
if (@getByIdDirectPrivate(stream, "state") !== @streamReadable)
|
||||
return;
|
||||
@putByIdDirectPrivate(controller, "queue", @newQueue());
|
||||
|
||||
@readableStreamError(stream, error);
|
||||
}
|
||||
|
||||
@@ -138,8 +150,16 @@ function readableStreamPipeTo(stream, sink)
|
||||
doPipe();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function acquireReadableStreamDefaultReader(stream)
|
||||
{
|
||||
"use strict";
|
||||
var start = @getByIdDirectPrivate(stream, "start");
|
||||
if (start) {
|
||||
start();
|
||||
}
|
||||
|
||||
return new @ReadableStreamDefaultReader(stream);
|
||||
}
|
||||
|
||||
@@ -147,6 +167,8 @@ function acquireReadableStreamDefaultReader(stream)
|
||||
// This method implements the latest https://streams.spec.whatwg.org/#readable-stream-pipe-to.
|
||||
function readableStreamPipeToWritableStream(source, destination, preventClose, preventAbort, preventCancel, signal)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
@assert(@isReadableStream(source));
|
||||
@assert(@isWritableStream(destination));
|
||||
@assert(!@isReadableStreamLocked(source));
|
||||
@@ -217,6 +239,7 @@ function readableStreamPipeToWritableStream(source, destination, preventClose, p
|
||||
|
||||
function pipeToLoop(pipeState)
|
||||
{
|
||||
"use strict";
|
||||
if (pipeState.shuttingDown)
|
||||
return;
|
||||
|
||||
@@ -228,6 +251,7 @@ function pipeToLoop(pipeState)
|
||||
|
||||
function pipeToDoReadWrite(pipeState)
|
||||
{
|
||||
"use strict";
|
||||
@assert(!pipeState.shuttingDown);
|
||||
|
||||
pipeState.pendingReadPromiseCapability = @newPromiseCapability(@Promise);
|
||||
@@ -275,6 +299,7 @@ function pipeToErrorsMustBePropagatedForward(pipeState)
|
||||
|
||||
function pipeToErrorsMustBePropagatedBackward(pipeState)
|
||||
{
|
||||
"use strict";
|
||||
const action = () => {
|
||||
const error = @getByIdDirectPrivate(pipeState.destination, "storedError");
|
||||
if (!pipeState.preventCancel) {
|
||||
@@ -325,6 +350,8 @@ function pipeToClosingMustBePropagatedBackward(pipeState)
|
||||
|
||||
function pipeToShutdownWithAction(pipeState, action)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
if (pipeState.shuttingDown)
|
||||
return;
|
||||
|
||||
@@ -356,6 +383,8 @@ function pipeToShutdownWithAction(pipeState, action)
|
||||
|
||||
function pipeToShutdown(pipeState)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
if (pipeState.shuttingDown)
|
||||
return;
|
||||
|
||||
@@ -381,6 +410,8 @@ function pipeToShutdown(pipeState)
|
||||
|
||||
function pipeToFinalize(pipeState)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
@writableStreamDefaultWriterRelease(pipeState.writer);
|
||||
@readableStreamReaderGenericRelease(pipeState.reader);
|
||||
|
||||
@@ -570,7 +601,7 @@ function readableStreamDefaultControllerShouldCallPull(controller)
|
||||
|
||||
if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller))
|
||||
return false;
|
||||
if (!@getByIdDirectPrivate(controller, "started"))
|
||||
if (!(@getByIdDirectPrivate(controller, "started") > 0))
|
||||
return false;
|
||||
if ((!@isReadableStreamLocked(stream) || !@getByIdDirectPrivate(@getByIdDirectPrivate(stream, "reader"), "readRequests")?.isNotEmpty()) && @readableStreamDefaultControllerGetDesiredSize(controller) <= 0)
|
||||
return false;
|
||||
@@ -588,7 +619,7 @@ function readableStreamDefaultControllerCallPullIfNeeded(controller)
|
||||
|
||||
if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller))
|
||||
return;
|
||||
if (!@getByIdDirectPrivate(controller, "started"))
|
||||
if (!(@getByIdDirectPrivate(controller, "started") > 0))
|
||||
return;
|
||||
if ((!@isReadableStreamLocked(stream) || !@getByIdDirectPrivate(@getByIdDirectPrivate(stream, "reader"), "readRequests")?.isNotEmpty()) && @readableStreamDefaultControllerGetDesiredSize(controller) <= 0)
|
||||
return;
|
||||
@@ -656,7 +687,9 @@ function readableStreamCancel(stream, reason)
|
||||
if (state === @streamErrored)
|
||||
return @Promise.@reject(@getByIdDirectPrivate(stream, "storedError"));
|
||||
@readableStreamClose(stream);
|
||||
return @getByIdDirectPrivate(stream, "readableStreamController").@cancel(@getByIdDirectPrivate(stream, "readableStreamController"), reason).@then(function() { });
|
||||
|
||||
var controller = @getByIdDirectPrivate(stream, "readableStreamController");
|
||||
return controller.@cancel(controller, reason).@then(function() { });
|
||||
}
|
||||
|
||||
function readableStreamDefaultControllerCancel(controller, reason)
|
||||
|
||||
@@ -42,6 +42,7 @@ function isWritableStreamDefaultWriter(writer)
|
||||
|
||||
function acquireWritableStreamDefaultWriter(stream)
|
||||
{
|
||||
@writableStreamDefaultControllerStart(@getByIdDirectPrivate(stream, "controller"));
|
||||
return new @WritableStreamDefaultWriter(stream);
|
||||
}
|
||||
|
||||
@@ -109,7 +110,8 @@ function createInternalWritableStreamFromUnderlyingSink(underlyingSink, strategy
|
||||
}
|
||||
|
||||
function initializeWritableStreamSlots(stream, underlyingSink)
|
||||
{
|
||||
{ "use strict";
|
||||
|
||||
@putByIdDirectPrivate(stream, "state", "writable");
|
||||
@putByIdDirectPrivate(stream, "storedError", @undefined);
|
||||
@putByIdDirectPrivate(stream, "writer", @undefined);
|
||||
@@ -124,7 +126,8 @@ function initializeWritableStreamSlots(stream, underlyingSink)
|
||||
}
|
||||
|
||||
function writableStreamCloseForBindings(stream)
|
||||
{
|
||||
{ "use strict";
|
||||
|
||||
if (@isWritableStreamLocked(stream))
|
||||
return @Promise.@reject(@makeTypeError("WritableStream.close method can only be used on non locked WritableStream"));
|
||||
|
||||
@@ -135,7 +138,8 @@ function writableStreamCloseForBindings(stream)
|
||||
}
|
||||
|
||||
function writableStreamAbortForBindings(stream, reason)
|
||||
{
|
||||
{ "use strict";
|
||||
|
||||
if (@isWritableStreamLocked(stream))
|
||||
return @Promise.@reject(@makeTypeError("WritableStream.abort method can only be used on non locked WritableStream"));
|
||||
|
||||
@@ -143,12 +147,14 @@ function writableStreamAbortForBindings(stream, reason)
|
||||
}
|
||||
|
||||
function isWritableStreamLocked(stream)
|
||||
{
|
||||
{ "use strict";
|
||||
|
||||
return @getByIdDirectPrivate(stream, "writer") !== @undefined;
|
||||
}
|
||||
|
||||
function setUpWritableStreamDefaultWriter(writer, stream)
|
||||
{
|
||||
{ "use strict";
|
||||
|
||||
if (@isWritableStreamLocked(stream))
|
||||
@throwTypeError("WritableStream is locked");
|
||||
|
||||
@@ -182,6 +188,7 @@ function setUpWritableStreamDefaultWriter(writer, stream)
|
||||
|
||||
function writableStreamAbort(stream, reason)
|
||||
{
|
||||
"use strict";
|
||||
const state = @getByIdDirectPrivate(stream, "state");
|
||||
if (state === "closed" || state === "errored")
|
||||
return @Promise.@resolve();
|
||||
@@ -207,6 +214,8 @@ function writableStreamAbort(stream, reason)
|
||||
|
||||
function writableStreamClose(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const state = @getByIdDirectPrivate(stream, "state");
|
||||
if (state === "closed" || state === "errored")
|
||||
return @Promise.@reject(@makeTypeError("Cannot close a writable stream that is closed or errored"));
|
||||
@@ -228,6 +237,8 @@ function writableStreamClose(stream)
|
||||
|
||||
function writableStreamAddWriteRequest(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
@assert(@isWritableStreamLocked(stream))
|
||||
@assert(@getByIdDirectPrivate(stream, "state") === "writable");
|
||||
|
||||
@@ -239,11 +250,15 @@ function writableStreamAddWriteRequest(stream)
|
||||
|
||||
function writableStreamCloseQueuedOrInFlight(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
return @getByIdDirectPrivate(stream, "closeRequest") !== @undefined || @getByIdDirectPrivate(stream, "inFlightCloseRequest") !== @undefined;
|
||||
}
|
||||
|
||||
function writableStreamDealWithRejection(stream, error)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const state = @getByIdDirectPrivate(stream, "state");
|
||||
if (state === "writable") {
|
||||
@writableStreamStartErroring(stream, error);
|
||||
@@ -256,6 +271,8 @@ function writableStreamDealWithRejection(stream, error)
|
||||
|
||||
function writableStreamFinishErroring(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
@assert(@getByIdDirectPrivate(stream, "state") === "erroring");
|
||||
@assert(!@writableStreamHasOperationMarkedInFlight(stream));
|
||||
|
||||
@@ -296,6 +313,8 @@ function writableStreamFinishErroring(stream)
|
||||
|
||||
function writableStreamFinishInFlightClose(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const inFlightCloseRequest = @getByIdDirectPrivate(stream, "inFlightCloseRequest");
|
||||
inFlightCloseRequest.@resolve.@call();
|
||||
|
||||
@@ -325,6 +344,8 @@ function writableStreamFinishInFlightClose(stream)
|
||||
|
||||
function writableStreamFinishInFlightCloseWithError(stream, error)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const inFlightCloseRequest = @getByIdDirectPrivate(stream, "inFlightCloseRequest");
|
||||
@assert(inFlightCloseRequest !== @undefined);
|
||||
inFlightCloseRequest.@reject.@call(@undefined, error);
|
||||
@@ -345,6 +366,8 @@ function writableStreamFinishInFlightCloseWithError(stream, error)
|
||||
|
||||
function writableStreamFinishInFlightWrite(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const inFlightWriteRequest = @getByIdDirectPrivate(stream, "inFlightWriteRequest");
|
||||
@assert(inFlightWriteRequest !== @undefined);
|
||||
inFlightWriteRequest.@resolve.@call();
|
||||
@@ -354,6 +377,8 @@ function writableStreamFinishInFlightWrite(stream)
|
||||
|
||||
function writableStreamFinishInFlightWriteWithError(stream, error)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const inFlightWriteRequest = @getByIdDirectPrivate(stream, "inFlightWriteRequest");
|
||||
@assert(inFlightWriteRequest !== @undefined);
|
||||
inFlightWriteRequest.@reject.@call(@undefined, error);
|
||||
@@ -368,11 +393,15 @@ function writableStreamFinishInFlightWriteWithError(stream, error)
|
||||
|
||||
function writableStreamHasOperationMarkedInFlight(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
return @getByIdDirectPrivate(stream, "inFlightWriteRequest") !== @undefined || @getByIdDirectPrivate(stream, "inFlightCloseRequest") !== @undefined;
|
||||
}
|
||||
|
||||
function writableStreamMarkCloseRequestInFlight(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const closeRequest = @getByIdDirectPrivate(stream, "closeRequest");
|
||||
@assert(@getByIdDirectPrivate(stream, "inFlightCloseRequest") === @undefined);
|
||||
@assert(closeRequest !== @undefined);
|
||||
@@ -383,6 +412,8 @@ function writableStreamMarkCloseRequestInFlight(stream)
|
||||
|
||||
function writableStreamMarkFirstWriteRequestInFlight(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const writeRequests = @getByIdDirectPrivate(stream, "writeRequests");
|
||||
@assert(@getByIdDirectPrivate(stream, "inFlightWriteRequest") === @undefined);
|
||||
@assert(writeRequests.isNotEmpty());
|
||||
@@ -393,6 +424,8 @@ function writableStreamMarkFirstWriteRequestInFlight(stream)
|
||||
|
||||
function writableStreamRejectCloseAndClosedPromiseIfNeeded(stream)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
@assert(@getByIdDirectPrivate(stream, "state") === "errored");
|
||||
|
||||
const storedError = @getByIdDirectPrivate(stream, "storedError");
|
||||
@@ -414,6 +447,8 @@ function writableStreamRejectCloseAndClosedPromiseIfNeeded(stream)
|
||||
|
||||
function writableStreamStartErroring(stream, reason)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
@assert(@getByIdDirectPrivate(stream, "storedError") === @undefined);
|
||||
@assert(@getByIdDirectPrivate(stream, "state") === "writable");
|
||||
|
||||
@@ -427,12 +462,13 @@ function writableStreamStartErroring(stream, reason)
|
||||
if (writer !== @undefined)
|
||||
@writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
|
||||
|
||||
if (!@writableStreamHasOperationMarkedInFlight(stream) && @getByIdDirectPrivate(controller, "started"))
|
||||
if (!@writableStreamHasOperationMarkedInFlight(stream) && @getByIdDirectPrivate(controller, "started") === 1)
|
||||
@writableStreamFinishErroring(stream);
|
||||
}
|
||||
|
||||
function writableStreamUpdateBackpressure(stream, backpressure)
|
||||
{
|
||||
"use strict";
|
||||
@assert(@getByIdDirectPrivate(stream, "state") === "writable");
|
||||
@assert(!@writableStreamCloseQueuedOrInFlight(stream));
|
||||
|
||||
@@ -448,6 +484,7 @@ function writableStreamUpdateBackpressure(stream, backpressure)
|
||||
|
||||
function writableStreamDefaultWriterAbort(writer, reason)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(writer, "stream");
|
||||
@assert(stream !== @undefined);
|
||||
return @writableStreamAbort(stream, reason);
|
||||
@@ -455,6 +492,7 @@ function writableStreamDefaultWriterAbort(writer, reason)
|
||||
|
||||
function writableStreamDefaultWriterClose(writer)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(writer, "stream");
|
||||
@assert(stream !== @undefined);
|
||||
return @writableStreamClose(stream);
|
||||
@@ -462,6 +500,7 @@ function writableStreamDefaultWriterClose(writer)
|
||||
|
||||
function writableStreamDefaultWriterCloseWithErrorPropagation(writer)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(writer, "stream");
|
||||
@assert(stream !== @undefined);
|
||||
|
||||
@@ -479,6 +518,7 @@ function writableStreamDefaultWriterCloseWithErrorPropagation(writer)
|
||||
|
||||
function writableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error)
|
||||
{
|
||||
"use strict";
|
||||
let closedPromiseCapability = @getByIdDirectPrivate(writer, "closedPromise");
|
||||
let closedPromise = closedPromiseCapability.@promise;
|
||||
|
||||
@@ -494,6 +534,7 @@ function writableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error)
|
||||
|
||||
function writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error)
|
||||
{
|
||||
"use strict";
|
||||
let readyPromiseCapability = @getByIdDirectPrivate(writer, "readyPromise");
|
||||
let readyPromise = readyPromiseCapability.@promise;
|
||||
|
||||
@@ -509,6 +550,7 @@ function writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error)
|
||||
|
||||
function writableStreamDefaultWriterGetDesiredSize(writer)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(writer, "stream");
|
||||
@assert(stream !== @undefined);
|
||||
|
||||
@@ -525,6 +567,8 @@ function writableStreamDefaultWriterGetDesiredSize(writer)
|
||||
|
||||
function writableStreamDefaultWriterRelease(writer)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const stream = @getByIdDirectPrivate(writer, "stream");
|
||||
@assert(stream !== @undefined);
|
||||
@assert(@getByIdDirectPrivate(stream, "writer") === writer);
|
||||
@@ -540,6 +584,8 @@ function writableStreamDefaultWriterRelease(writer)
|
||||
|
||||
function writableStreamDefaultWriterWrite(writer, chunk)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
const stream = @getByIdDirectPrivate(writer, "stream");
|
||||
@assert(stream !== @undefined);
|
||||
|
||||
@@ -572,6 +618,8 @@ function writableStreamDefaultWriterWrite(writer, chunk)
|
||||
|
||||
function setUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
@assert(@isWritableStream(stream));
|
||||
@assert(@getByIdDirectPrivate(stream, "controller") === @undefined);
|
||||
|
||||
@@ -580,7 +628,8 @@ function setUpWritableStreamDefaultController(stream, controller, startAlgorithm
|
||||
|
||||
@resetQueue(@getByIdDirectPrivate(controller, "queue"));
|
||||
|
||||
@putByIdDirectPrivate(controller, "started", false);
|
||||
@putByIdDirectPrivate(controller, "started", -1);
|
||||
@putByIdDirectPrivate(controller, "startAlgorithm", startAlgorithm);
|
||||
@putByIdDirectPrivate(controller, "strategySizeAlgorithm", sizeAlgorithm);
|
||||
@putByIdDirectPrivate(controller, "strategyHWM", highWaterMark);
|
||||
@putByIdDirectPrivate(controller, "writeAlgorithm", writeAlgorithm);
|
||||
@@ -590,21 +639,36 @@ function setUpWritableStreamDefaultController(stream, controller, startAlgorithm
|
||||
const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);
|
||||
@writableStreamUpdateBackpressure(stream, backpressure);
|
||||
|
||||
@Promise.@resolve(startAlgorithm.@call()).@then(() => {
|
||||
@writableStreamDefaultControllerStart(controller);
|
||||
}
|
||||
|
||||
function writableStreamDefaultControllerStart(controller) {
|
||||
"use strict";
|
||||
|
||||
if (@getByIdDirectPrivate(controller, "started") !== -1)
|
||||
return;
|
||||
|
||||
@putByIdDirectPrivate(controller, "started", 0);
|
||||
|
||||
const startAlgorithm = @getByIdDirectPrivate(controller, "startAlgorithm");
|
||||
@putByIdDirectPrivate(controller, "startAlgorithm", @undefined);
|
||||
const stream = @getByIdDirectPrivate(controller, "stream");
|
||||
return @Promise.@resolve(startAlgorithm.@call()).@then(() => {
|
||||
const state = @getByIdDirectPrivate(stream, "state");
|
||||
@assert(state === "writable" || state === "erroring");
|
||||
@putByIdDirectPrivate(controller, "started", true);
|
||||
@putByIdDirectPrivate(controller, "started", 1);
|
||||
@writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
||||
}, (error) => {
|
||||
const state = @getByIdDirectPrivate(stream, "state");
|
||||
@assert(state === "writable" || state === "erroring");
|
||||
@putByIdDirectPrivate(controller, "started", true);
|
||||
@putByIdDirectPrivate(controller, "started", 1);
|
||||
@writableStreamDealWithRejection(stream, error);
|
||||
});
|
||||
}
|
||||
|
||||
function setUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm)
|
||||
{
|
||||
"use strict";
|
||||
const controller = new @WritableStreamDefaultController();
|
||||
|
||||
let startAlgorithm = () => { };
|
||||
@@ -634,9 +698,10 @@ function setUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyi
|
||||
|
||||
function writableStreamDefaultControllerAdvanceQueueIfNeeded(controller)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(controller, "stream");
|
||||
|
||||
if (!@getByIdDirectPrivate(controller, "started"))
|
||||
if (@getByIdDirectPrivate(controller, "started") !== 1)
|
||||
return;
|
||||
|
||||
@assert(stream !== @undefined);
|
||||
@@ -666,6 +731,7 @@ function isCloseSentinel()
|
||||
|
||||
function writableStreamDefaultControllerClearAlgorithms(controller)
|
||||
{
|
||||
"use strict";
|
||||
@putByIdDirectPrivate(controller, "writeAlgorithm", @undefined);
|
||||
@putByIdDirectPrivate(controller, "closeAlgorithm", @undefined);
|
||||
@putByIdDirectPrivate(controller, "abortAlgorithm", @undefined);
|
||||
@@ -674,12 +740,14 @@ function writableStreamDefaultControllerClearAlgorithms(controller)
|
||||
|
||||
function writableStreamDefaultControllerClose(controller)
|
||||
{
|
||||
"use strict";
|
||||
@enqueueValueWithSize(@getByIdDirectPrivate(controller, "queue"), @isCloseSentinel, 0);
|
||||
@writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
|
||||
}
|
||||
|
||||
function writableStreamDefaultControllerError(controller, error)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(controller, "stream");
|
||||
@assert(stream !== @undefined);
|
||||
@assert(@getByIdDirectPrivate(stream, "state") === "writable");
|
||||
@@ -690,6 +758,7 @@ function writableStreamDefaultControllerError(controller, error)
|
||||
|
||||
function writableStreamDefaultControllerErrorIfNeeded(controller, error)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(controller, "stream");
|
||||
if (@getByIdDirectPrivate(stream, "state") === "writable")
|
||||
@writableStreamDefaultControllerError(controller, error);
|
||||
@@ -697,12 +766,14 @@ function writableStreamDefaultControllerErrorIfNeeded(controller, error)
|
||||
|
||||
function writableStreamDefaultControllerGetBackpressure(controller)
|
||||
{
|
||||
"use strict";
|
||||
const desiredSize = @writableStreamDefaultControllerGetDesiredSize(controller);
|
||||
return desiredSize <= 0;
|
||||
}
|
||||
|
||||
function writableStreamDefaultControllerGetChunkSize(controller, chunk)
|
||||
{
|
||||
"use strict";
|
||||
try {
|
||||
return @getByIdDirectPrivate(controller, "strategySizeAlgorithm").@call(@undefined, chunk);
|
||||
} catch (e) {
|
||||
@@ -713,11 +784,13 @@ function writableStreamDefaultControllerGetChunkSize(controller, chunk)
|
||||
|
||||
function writableStreamDefaultControllerGetDesiredSize(controller)
|
||||
{
|
||||
"use strict";
|
||||
return @getByIdDirectPrivate(controller, "strategyHWM") - @getByIdDirectPrivate(controller, "queue").size;
|
||||
}
|
||||
|
||||
function writableStreamDefaultControllerProcessClose(controller)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(controller, "stream");
|
||||
|
||||
@writableStreamMarkCloseRequestInFlight(stream);
|
||||
@@ -737,6 +810,7 @@ function writableStreamDefaultControllerProcessClose(controller)
|
||||
|
||||
function writableStreamDefaultControllerProcessWrite(controller, chunk)
|
||||
{
|
||||
"use strict";
|
||||
const stream = @getByIdDirectPrivate(controller, "stream");
|
||||
|
||||
@writableStreamMarkFirstWriteRequestInFlight(stream);
|
||||
@@ -765,6 +839,7 @@ function writableStreamDefaultControllerProcessWrite(controller, chunk)
|
||||
|
||||
function writableStreamDefaultControllerWrite(controller, chunk, chunkSize)
|
||||
{
|
||||
"use strict";
|
||||
try {
|
||||
@enqueueValueWithSize(@getByIdDirectPrivate(controller, "queue"), chunk, chunkSize);
|
||||
|
||||
|
||||
@@ -40,13 +40,11 @@
|
||||
#include <wtf/GetPtr.h>
|
||||
#include <wtf/PointerPreparations.h>
|
||||
|
||||
|
||||
namespace WebCore {
|
||||
using namespace JSC;
|
||||
|
||||
// Functions
|
||||
|
||||
|
||||
// Attributes
|
||||
|
||||
static JSC_DECLARE_CUSTOM_GETTER(jsReadableStreamDefaultControllerConstructor);
|
||||
@@ -109,13 +107,12 @@ template<> FunctionExecutable* JSReadableStreamDefaultControllerDOMConstructor::
|
||||
|
||||
/* Hash table for prototype */
|
||||
|
||||
static const HashTableValue JSReadableStreamDefaultControllerPrototypeTableValues[] =
|
||||
{
|
||||
{ "constructor"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsReadableStreamDefaultControllerConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
|
||||
{ "desiredSize"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Accessor | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamDefaultControllerDesiredSizeCodeGenerator), (intptr_t) (0) } },
|
||||
{ "enqueue"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamDefaultControllerEnqueueCodeGenerator), (intptr_t) (0) } },
|
||||
{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamDefaultControllerCloseCodeGenerator), (intptr_t) (0) } },
|
||||
{ "error"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(readableStreamDefaultControllerErrorCodeGenerator), (intptr_t) (0) } },
|
||||
static const HashTableValue JSReadableStreamDefaultControllerPrototypeTableValues[] = {
|
||||
{ "constructor"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsReadableStreamDefaultControllerConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
|
||||
{ "desiredSize"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Accessor | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t) static_cast<BuiltinGenerator>(readableStreamDefaultControllerDesiredSizeCodeGenerator), (intptr_t)(0) } },
|
||||
{ "enqueue"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t) static_cast<BuiltinGenerator>(readableStreamDefaultControllerEnqueueCodeGenerator), (intptr_t)(0) } },
|
||||
{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t) static_cast<BuiltinGenerator>(readableStreamDefaultControllerCloseCodeGenerator), (intptr_t)(0) } },
|
||||
{ "error"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Builtin), NoIntrinsic, { (intptr_t) static_cast<BuiltinGenerator>(readableStreamDefaultControllerErrorCodeGenerator), (intptr_t)(0) } },
|
||||
};
|
||||
|
||||
const ClassInfo JSReadableStreamDefaultControllerPrototype::s_info = { "ReadableStreamDefaultController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamDefaultControllerPrototype) };
|
||||
@@ -125,18 +122,22 @@ void JSReadableStreamDefaultControllerPrototype::finishCreation(VM& vm)
|
||||
Base::finishCreation(vm);
|
||||
reifyStaticProperties(vm, JSReadableStreamDefaultController::info(), JSReadableStreamDefaultControllerPrototypeTableValues, *this);
|
||||
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
|
||||
|
||||
auto clientData = WebCore::clientData(vm);
|
||||
this->putDirect(vm, clientData->builtinNames().sinkPublicName(), jsUndefined(), JSC::PropertyAttribute::DontDelete | 0);
|
||||
}
|
||||
|
||||
const ClassInfo JSReadableStreamDefaultController::s_info = { "ReadableStreamDefaultController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamDefaultController) };
|
||||
|
||||
JSReadableStreamDefaultController::JSReadableStreamDefaultController(Structure* structure, JSDOMGlobalObject& globalObject)
|
||||
: JSDOMObject(structure, globalObject) { }
|
||||
: JSDOMObject(structure, globalObject)
|
||||
{
|
||||
}
|
||||
|
||||
void JSReadableStreamDefaultController::finishCreation(VM& vm)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
ASSERT(inherits(info()));
|
||||
|
||||
}
|
||||
|
||||
JSObject* JSReadableStreamDefaultController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
|
||||
@@ -160,7 +161,7 @@ void JSReadableStreamDefaultController::destroy(JSC::JSCell* cell)
|
||||
thisObject->JSReadableStreamDefaultController::~JSReadableStreamDefaultController();
|
||||
}
|
||||
|
||||
JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamDefaultControllerConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
|
||||
JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
|
||||
{
|
||||
VM& vm = JSC::getVM(lexicalGlobalObject);
|
||||
auto throwScope = DECLARE_THROW_SCOPE(vm);
|
||||
@@ -172,13 +173,12 @@ JSC_DEFINE_CUSTOM_GETTER(jsReadableStreamDefaultControllerConstructor, (JSGlobal
|
||||
|
||||
JSC::GCClient::IsoSubspace* JSReadableStreamDefaultController::subspaceForImpl(JSC::VM& vm)
|
||||
{
|
||||
return WebCore::subspaceForImpl<JSReadableStreamDefaultController, UseCustomHeapCellType::No>(vm,
|
||||
[] (auto& spaces) { return spaces.m_clientSubspaceForReadableStreamDefaultController.get(); },
|
||||
[] (auto& spaces, auto&& space) { spaces.m_clientSubspaceForReadableStreamDefaultController = WTFMove(space); },
|
||||
[] (auto& spaces) { return spaces.m_subspaceForReadableStreamDefaultController.get(); },
|
||||
[] (auto& spaces, auto&& space) { spaces.m_subspaceForReadableStreamDefaultController = WTFMove(space); }
|
||||
);
|
||||
return WebCore::subspaceForImpl<JSReadableStreamDefaultController, UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForReadableStreamDefaultController.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForReadableStreamDefaultController = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForReadableStreamDefaultController.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForReadableStreamDefaultController = WTFMove(space); });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
const classes = ["ArrayBufferSink"];
|
||||
const classes = [ "ArrayBufferSink" ];
|
||||
|
||||
function names(name) {
|
||||
return {
|
||||
constructor : `JS${name}Constructor`,
|
||||
className : `JS${name}`,
|
||||
controller : `JSReadable${name}Controller`,
|
||||
controllerName : `Readable${name}Controller`,
|
||||
prototypeName : `JS${name}Prototype`,
|
||||
controllerPrototypeName : `JSReadable${name}ControllerPrototype`,
|
||||
};
|
||||
}
|
||||
function header() {
|
||||
function classTemplate(idName) {
|
||||
const name = `JS${idName}`;
|
||||
const constructor = `${name}Constructor`;
|
||||
const constructorName = `JS${name}Constructor`;
|
||||
function classTemplate(name) {
|
||||
const {constructor, className, controller} = names(name);
|
||||
|
||||
return `class ${constructor} final : public JSC::InternalFunction {
|
||||
return `class ${
|
||||
constructor} final : public JSC::InternalFunction {
|
||||
public:
|
||||
using Base = JSC::InternalFunction;
|
||||
static ${constructor}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype);
|
||||
static constexpr SinkID Sink = SinkID::${idName};
|
||||
static ${
|
||||
constructor}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSC::JSObject* prototype);
|
||||
static constexpr SinkID Sink = SinkID::${name};
|
||||
|
||||
static constexpr unsigned StructureFlags = Base::StructureFlags;
|
||||
static constexpr bool needsDestruction = false;
|
||||
@@ -20,7 +30,8 @@ function header() {
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<${constructor}, WebCore::UseCustomHeapCellType::No>(
|
||||
return WebCore::subspaceForImpl<${
|
||||
constructor}, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSinkConstructor.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkConstructor = WTFMove(space); },
|
||||
@@ -39,7 +50,8 @@ function header() {
|
||||
static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*);
|
||||
|
||||
private:
|
||||
${constructor}(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction)
|
||||
${
|
||||
constructor}(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction)
|
||||
: Base(vm, structure, nativeFunction, nativeFunction)
|
||||
|
||||
{
|
||||
@@ -48,18 +60,22 @@ function header() {
|
||||
void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);
|
||||
};
|
||||
|
||||
class ${name} final : public JSC::JSDestructibleObject {
|
||||
class ${
|
||||
className} final : public JSC::JSDestructibleObject {
|
||||
public:
|
||||
using Base = JSC::JSDestructibleObject;
|
||||
static ${name}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr);
|
||||
static constexpr SinkID Sink = SinkID::${idName};
|
||||
static ${
|
||||
className}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr);
|
||||
static constexpr SinkID Sink = SinkID::${
|
||||
name};
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<${name}, WebCore::UseCustomHeapCellType::No>(
|
||||
return WebCore::subspaceForImpl<${
|
||||
className}, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSink.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSink = WTFMove(space); },
|
||||
@@ -73,15 +89,21 @@ function header() {
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
|
||||
}
|
||||
|
||||
~${name}();
|
||||
~${
|
||||
className}();
|
||||
|
||||
void* wrapped() const { return m_sinkPtr; }
|
||||
|
||||
|
||||
void detach() {
|
||||
m_sinkPtr = nullptr;
|
||||
}
|
||||
|
||||
static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
|
||||
|
||||
void* m_sinkPtr;
|
||||
|
||||
${name}(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr)
|
||||
${
|
||||
className}(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr)
|
||||
: Base(vm, structure)
|
||||
{
|
||||
m_sinkPtr = sinkPtr;
|
||||
@@ -89,7 +111,68 @@ function header() {
|
||||
|
||||
void finishCreation(JSC::VM&);
|
||||
};
|
||||
JSC_DECLARE_CUSTOM_GETTER(function${idName}__getter);
|
||||
|
||||
class ${
|
||||
controller} final : public JSC::JSDestructibleObject {
|
||||
public:
|
||||
using Base = JSC::JSDestructibleObject;
|
||||
static ${
|
||||
controller}* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr);
|
||||
static constexpr SinkID Sink = SinkID::${
|
||||
name};
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
|
||||
{
|
||||
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
|
||||
return nullptr;
|
||||
return WebCore::subspaceForImpl<${
|
||||
controller}, WebCore::UseCustomHeapCellType::No>(
|
||||
vm,
|
||||
[](auto& spaces) { return spaces.m_clientSubspaceForJSSinkController.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForJSSinkController = WTFMove(space); },
|
||||
[](auto& spaces) { return spaces.m_subspaceForJSSinkController.get(); },
|
||||
[](auto& spaces, auto&& space) { spaces.m_subspaceForJSSinkController = WTFMove(space); });
|
||||
}
|
||||
|
||||
static void destroy(JSC::JSCell*);
|
||||
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
|
||||
{
|
||||
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
|
||||
}
|
||||
|
||||
~${
|
||||
controller}();
|
||||
|
||||
|
||||
void* wrapped() const { return m_sinkPtr; }
|
||||
void detach() {
|
||||
m_sinkPtr = nullptr;
|
||||
}
|
||||
|
||||
void start(JSC::JSGlobalObject *globalObject, JSC::JSValue readableStream, JSC::JSFunction *onPull, JSC::JSFunction *onClose);
|
||||
DECLARE_VISIT_CHILDREN;
|
||||
|
||||
static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
|
||||
|
||||
void* m_sinkPtr;
|
||||
mutable WriteBarrier<JSC::JSFunction> m_onPull;
|
||||
mutable WriteBarrier<JSC::JSFunction> m_onClose;
|
||||
JSC::Weak<Unknown> m_weakReadableStream;
|
||||
|
||||
${
|
||||
controller}(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr)
|
||||
: Base(vm, structure)
|
||||
{
|
||||
m_sinkPtr = sinkPtr;
|
||||
}
|
||||
|
||||
void finishCreation(JSC::VM&);
|
||||
};
|
||||
|
||||
JSC_DECLARE_CUSTOM_GETTER(function${name}__getter);
|
||||
|
||||
|
||||
|
||||
`;
|
||||
}
|
||||
@@ -111,9 +194,12 @@ extern "C" bool JSSink_isSink(JSC::JSGlobalObject*, JSC::EncodedJSValue);
|
||||
|
||||
namespace WebCore {
|
||||
using namespace JSC;
|
||||
|
||||
JSC_DECLARE_HOST_FUNCTION(functionStartDirectStream);
|
||||
`;
|
||||
|
||||
const bottom = `JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID);
|
||||
const bottom =
|
||||
`JSObject* createJSSinkPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, WebCore::SinkID sinkID);
|
||||
|
||||
} // namespace WebCore
|
||||
`;
|
||||
@@ -181,18 +267,150 @@ namespace WebCore {
|
||||
using namespace JSC;
|
||||
|
||||
|
||||
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(functionStartDirectStream, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame))
|
||||
{
|
||||
|
||||
auto& vm = lexicalGlobalObject->vm();
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
|
||||
|
||||
JSC::JSValue readableStream = callFrame->argument(0);
|
||||
JSC::JSValue onPull = callFrame->argument(1);
|
||||
JSC::JSValue onClose = callFrame->argument(2);
|
||||
if (!readableStream.isObject()) {
|
||||
scope.throwException(callFrame, JSC::createTypeError(callFrame, "Expected ReadableStream"_s))
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
if (!onPull.isObject() || !onPull.isCallable()) {
|
||||
onPull = JSC::jsUndefined();
|
||||
}
|
||||
|
||||
if (!onClose.isObject() || !onClose.isCallable()) {
|
||||
onClose = JSC::jsUndefined();
|
||||
}
|
||||
|
||||
`;
|
||||
var templ = head;
|
||||
|
||||
var isFirst = true;
|
||||
for (let name of classes) {
|
||||
const {
|
||||
className,
|
||||
controller,
|
||||
prototypeName,
|
||||
controllerPrototypeName,
|
||||
constructor,
|
||||
} = names(name);
|
||||
|
||||
templ += `
|
||||
JSC_DEFINE_CUSTOM_GETTER(function${name}__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
|
||||
|
||||
${isFirst ? "" : "else"} if (${controller}* ${
|
||||
name}Controller = JSC::jsDynamicCast<${
|
||||
controller}*>(callFrame->thisValue())) {
|
||||
if (${name}Controller->wrapped() == nullptr) {
|
||||
scope.throwException(callFrame, JSC::createTypeError(callFrame, "Controller is already closed"_s));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
${name}Controller->start(globalObject, readableStream, onPull, onClose);
|
||||
}
|
||||
}
|
||||
`;
|
||||
isFirst = false;
|
||||
}
|
||||
|
||||
templ += `
|
||||
else {
|
||||
scope.throwException(callFrame, JSC::createTypeError(callFrame, "Unknown direct controller. This is a bug in Bun."_s));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsUndefined()));
|
||||
}
|
||||
`;
|
||||
|
||||
for (let name of classes) {
|
||||
const {
|
||||
className,
|
||||
controller,
|
||||
prototypeName,
|
||||
controllerName,
|
||||
controllerPrototypeName,
|
||||
constructor,
|
||||
} = names(name);
|
||||
|
||||
templ += `
|
||||
JSC_DEFINE_CUSTOM_GETTER(function${
|
||||
name}__getter, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
|
||||
{
|
||||
auto& vm = lexicalGlobalObject->vm();
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
|
||||
|
||||
return JSC::JSValue::encode(globalObject->${name}());
|
||||
}
|
||||
|
||||
|
||||
JSC_DECLARE_HOST_FUNCTION(${controller}__close);
|
||||
JSC_DEFINE_HOST_FUNCTION(${
|
||||
controller}__close, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame *callFrame))
|
||||
{
|
||||
|
||||
auto& vm = lexicalGlobalObject->vm();
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
|
||||
${controller}* controller = JSC::jsDynamicCast<${
|
||||
controller}*>(callFrame->thisValue());
|
||||
if (!${controller}) {
|
||||
scope.throwException(callFrame, JSC::createTypeError(callFrame, "Expected ${
|
||||
controller}"_s));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
void *ptr = controller->wrapped();
|
||||
if (ptr == nullptr) {
|
||||
scope.throwException(callFrame, JSC::createTypeError(callFrame, "Controller is already closed"_s));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
controller->detach();
|
||||
${name}__close(ptr, callFrame->argument(0));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static const HashTableValue JS${name}PrototypeTableValues[]
|
||||
= {
|
||||
{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__close), (intptr_t)(0) } },
|
||||
{ "drain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__drain), (intptr_t)(1) } },
|
||||
{ "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__end), (intptr_t)(0) } },
|
||||
{ "start"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__start), (intptr_t)(1) } },
|
||||
{ "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__write), (intptr_t)(1) } },
|
||||
};
|
||||
|
||||
static const HashTableValue ${controllerPrototypeName}TableValues[]
|
||||
= {
|
||||
{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
controller}__close), (intptr_t)(0) } },
|
||||
{ "drain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__drain), (intptr_t)(1) } },
|
||||
{ "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__end), (intptr_t)(0) } },
|
||||
{ "start"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(function${
|
||||
controller}__start), (intptr_t)(1) } },
|
||||
{ "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(${
|
||||
name}__write), (intptr_t)(1) } },
|
||||
};
|
||||
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -206,10 +424,14 @@ ${(await Bun.file(import.meta.dir + "/bindings/JSSink+custom.h").text()).trim()}
|
||||
`;
|
||||
|
||||
for (let name of classes) {
|
||||
const constructorName = `JS${name}Constructor`;
|
||||
const className = `JS${name}`;
|
||||
const prototypeName = `JS${name}Prototype`;
|
||||
|
||||
const {
|
||||
className,
|
||||
controller,
|
||||
prototypeName,
|
||||
controllerPrototypeName,
|
||||
constructor,
|
||||
controllerName,
|
||||
} = names(name);
|
||||
templ += `
|
||||
#pragma mark - ${name}
|
||||
|
||||
@@ -217,9 +439,11 @@ class ${prototypeName} final : public JSC::JSNonFinalObject {
|
||||
public:
|
||||
using Base = JSC::JSNonFinalObject;
|
||||
|
||||
static ${prototypeName}* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure)
|
||||
static ${
|
||||
prototypeName}* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure)
|
||||
{
|
||||
${prototypeName}* ptr = new (NotNull, JSC::allocateCell<${prototypeName}>(vm)) ${prototypeName}(vm, globalObject, structure);
|
||||
${prototypeName}* ptr = new (NotNull, JSC::allocateCell<${
|
||||
prototypeName}>(vm)) ${prototypeName}(vm, globalObject, structure);
|
||||
ptr->finishCreation(vm, globalObject);
|
||||
return ptr;
|
||||
}
|
||||
@@ -245,11 +469,23 @@ private:
|
||||
};
|
||||
STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(${prototypeName}, ${prototypeName}::Base);
|
||||
|
||||
const ClassInfo ${prototypeName}::s_info = { "${
|
||||
name}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${
|
||||
prototypeName}) };
|
||||
const ClassInfo ${className}::s_info = { "${
|
||||
name}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${
|
||||
className}) };
|
||||
const ClassInfo ${constructor}::s_info = { "${
|
||||
name}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${
|
||||
constructor}) };
|
||||
|
||||
|
||||
const ClassInfo ${prototypeName}::s_info = { "${name}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${prototypeName}) };
|
||||
const ClassInfo ${className}::s_info = { "${name}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${className}) };
|
||||
const ClassInfo ${constructorName}::s_info = { "${name}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${constructorName}) };
|
||||
const ClassInfo ${controllerPrototypeName}::s_info = { "${
|
||||
controllerName}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${
|
||||
controllerPrototypeName}) };
|
||||
const ClassInfo ${controller}::s_info = { "${
|
||||
controllerName}"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(${
|
||||
controller}) };
|
||||
|
||||
${className}::~${className}()
|
||||
{
|
||||
@@ -259,37 +495,59 @@ ${className}::~${className}()
|
||||
}
|
||||
|
||||
|
||||
${controller}::~${controller}()
|
||||
{
|
||||
if (m_sinkPtr) {
|
||||
${name}__finalize(m_sinkPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
|
||||
templ += `
|
||||
|
||||
${constructorName}* ${constructorName}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype)
|
||||
${constructor}* ${
|
||||
constructor}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSObject* prototype)
|
||||
{
|
||||
${constructorName}* ptr = new (NotNull, JSC::allocateCell<${constructorName}>(vm)) ${constructorName}(vm, structure, ${name}__construct);
|
||||
${constructor}* ptr = new (NotNull, JSC::allocateCell<${
|
||||
constructor}>(vm)) ${constructor}(vm, structure, ${name}__construct);
|
||||
ptr->finishCreation(vm, globalObject, prototype);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
${className}* ${className}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr)
|
||||
${className}* ${
|
||||
className}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr)
|
||||
{
|
||||
${className}* ptr = new (NotNull, JSC::allocateCell<${className}>(vm)) ${className}(vm, structure, sinkPtr);
|
||||
${className}* ptr = new (NotNull, JSC::allocateCell<${className}>(vm)) ${
|
||||
className}(vm, structure, sinkPtr);
|
||||
ptr->finishCreation(vm);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void ${constructorName}::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
${controller}* ${
|
||||
controller}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* sinkPtr)
|
||||
{
|
||||
${controller}* ptr = new (NotNull, JSC::allocateCell<${controller}>(vm)) ${
|
||||
controller}(vm, structure, sinkPtr);
|
||||
ptr->finishCreation(vm);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void ${constructor}::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
ASSERT(inherits(info()));
|
||||
initializeProperties(vm, globalObject, prototype);
|
||||
}
|
||||
|
||||
JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${constructorName}::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) {
|
||||
JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${
|
||||
constructor}::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) {
|
||||
return ${name}__construct(globalObject, callFrame);
|
||||
}
|
||||
|
||||
|
||||
void ${constructorName}::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
void ${constructor}::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
|
||||
{
|
||||
putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
|
||||
JSString* nameString = jsNontrivialString(vm, "${name}"_s);
|
||||
@@ -300,7 +558,16 @@ void ${constructorName}::initializeProperties(VM& vm, JSC::JSGlobalObject* globa
|
||||
void ${prototypeName}::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
reifyStaticProperties(vm, ${className}::info(), ${className}PrototypeTableValues, *this);
|
||||
reifyStaticProperties(vm, ${className}::info(), ${
|
||||
className}PrototypeTableValues, *this);
|
||||
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
|
||||
}
|
||||
|
||||
void ${controllerPrototypeName}::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
reifyStaticProperties(vm, ${controller}::info(), ${
|
||||
controller}PrototypeTableValues, *this);
|
||||
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
|
||||
}
|
||||
|
||||
@@ -310,6 +577,13 @@ void ${className}::finishCreation(VM& vm)
|
||||
ASSERT(inherits(info()));
|
||||
}
|
||||
|
||||
void ${controller}::finishCreation(VM& vm)
|
||||
{
|
||||
Base::finishCreation(vm);
|
||||
ASSERT(inherits(info()));
|
||||
}
|
||||
|
||||
|
||||
void ${className}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
|
||||
{
|
||||
auto* thisObject = jsCast<${className}*>(cell);
|
||||
@@ -321,12 +595,44 @@ void ${className}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
|
||||
Base::analyzeHeap(cell, analyzer);
|
||||
}
|
||||
|
||||
void ${controller}::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
|
||||
{
|
||||
auto* thisObject = jsCast<${controller}*>(cell);
|
||||
if (void* wrapped = thisObject->wrapped()) {
|
||||
analyzer.setWrappedObjectForCell(cell, wrapped);
|
||||
// if (thisObject->scriptExecutionContext())
|
||||
// analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
|
||||
}
|
||||
Base::analyzeHeap(cell, analyzer);
|
||||
}
|
||||
|
||||
|
||||
template<typename Visitor>
|
||||
void ${controller}::visitChildrenImpl(JSCell* cell, Visitor& visitor)
|
||||
{
|
||||
auto* thisObject = jsCast<${controller}*>(cell);
|
||||
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
|
||||
Base::visitChildren(thisObject, visitor);
|
||||
visitor.append(thisObject->m_onPull);
|
||||
visitor.append(thisObject->m_onClose);
|
||||
visitor.append(thisObject->m_weakReadableStream);
|
||||
}
|
||||
|
||||
DEFINE_VISIT_CHILDREN(${controller});
|
||||
|
||||
|
||||
void ${className}::destroy(JSCell* cell)
|
||||
{
|
||||
static_cast<${className}*>(cell)->${className}::~${className}();
|
||||
}
|
||||
|
||||
|
||||
void ${controller}::destroy(JSCell* cell)
|
||||
{
|
||||
static_cast<${controller}*>(cell)->${controller}::~${controller}();
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -338,7 +644,8 @@ void ${className}::destroy(JSCell* cell)
|
||||
for (let name of classes) {
|
||||
templ += `
|
||||
case ${name}:
|
||||
return JS${name}Prototype::create(vm, globalObject, JS${name}Prototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
|
||||
return JS${name}Prototype::create(vm, globalObject, JS${
|
||||
name}Prototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
|
||||
`;
|
||||
}
|
||||
templ += `
|
||||
@@ -350,31 +657,73 @@ default:
|
||||
templ += footer;
|
||||
|
||||
for (let name of classes) {
|
||||
const {
|
||||
className,
|
||||
controller,
|
||||
prototypeName,
|
||||
controllerPrototypeName,
|
||||
constructor,
|
||||
} = names(name);
|
||||
|
||||
templ += `
|
||||
extern "C" JSC__JSValue ${name}__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr)
|
||||
extern "C" JSC__JSValue ${
|
||||
name}__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr)
|
||||
{
|
||||
auto& vm = arg0->vm();
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0);
|
||||
JSC::JSValue prototype = globalObject->${name}Prototype();
|
||||
JSC::Structure* structure = WebCore::JS${name}::createStructure(vm, globalObject, prototype);
|
||||
return JSC::JSValue::encode(WebCore::JS${name}::create(vm, globalObject, structure, sinkPtr));
|
||||
JSC::Structure* structure = WebCore::JS${
|
||||
name}::createStructure(vm, globalObject, prototype);
|
||||
return JSC::JSValue::encode(WebCore::JS${
|
||||
name}::create(vm, globalObject, structure, sinkPtr));
|
||||
}
|
||||
|
||||
extern "C" void* ${name}__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1)
|
||||
extern "C" void* ${
|
||||
name}__fromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1)
|
||||
{
|
||||
JSC::VM& vm = WebCore::getVM(arg0);
|
||||
if (auto* sink = JSC::jsDynamicCast<WebCore::JS${name}*>(JSC::JSValue::decode(JSValue1)))
|
||||
if (auto* sink = JSC::jsDynamicCast<WebCore::JS${
|
||||
name}*>(JSC::JSValue::decode(JSValue1)))
|
||||
return sink->wrapped();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" JSC__JSValue ${
|
||||
name}__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, int32_t *bunNativeTag, void** bunNativePtr)
|
||||
{
|
||||
auto& vm = arg0->vm();
|
||||
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg0);
|
||||
JSC::JSValue prototype = globalObject->${controllerPrototypeName}();
|
||||
JSC::Structure* structure = WebCore::${
|
||||
controller}::createStructure(vm, globalObject, prototype);
|
||||
${controller} *controller = WebCore::${
|
||||
controller}::create(vm, globalObject, structure, sinkPtr);
|
||||
auto &clientData = WebCore:;getClientData(vm);
|
||||
JSC::JSObject *readableStream = JSC::JSValue::decode(stream).getObject();
|
||||
|
||||
if (readableStream->get(vm, clientData.builtinNames().bunNativeTag()).isUndefined()) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
JSC::JSObject *function = globalObject->getDirect(vm, clientData.builtinNames()->assignDirectStreamPrivateName()).getObject();
|
||||
auto callData = JSC::getCallData(function);
|
||||
MarkedArgumentBuffer arguments;
|
||||
args.append(JSC::JSValue::encode(stream));
|
||||
args.append(JSC::JSValue::encode(controller));
|
||||
|
||||
auto result = JSC::call(arg0, function, callData, jsUndefined(), arguments);
|
||||
return JSC::JSValue::encode(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
`;
|
||||
return templ;
|
||||
}
|
||||
}
|
||||
|
||||
await Bun.write(import.meta.dir + "/bindings/JSSink.h", header());
|
||||
await Bun.write(
|
||||
import.meta.dir + "/bindings/JSSink.cpp",
|
||||
await implementation()
|
||||
);
|
||||
await Bun.write(import.meta.dir + "/bindings/JSSink.cpp",
|
||||
await implementation());
|
||||
|
||||
@@ -204,12 +204,25 @@ pub const ReadableStream = struct {
|
||||
};
|
||||
};
|
||||
|
||||
pub const StreamStart = union(enum) {
|
||||
pub const StreamStart = union(Tag) {
|
||||
empty: void,
|
||||
err: JSC.Node.Syscall.Error,
|
||||
chunk_size: Blob.SizeType,
|
||||
ArrayBufferSink: struct {
|
||||
chunk_size: Blob.SizeType,
|
||||
as_uint8array: bool,
|
||||
stream: bool,
|
||||
},
|
||||
ready: void,
|
||||
|
||||
pub const Tag = enum {
|
||||
empty,
|
||||
err,
|
||||
chunk_size,
|
||||
ArrayBufferSink,
|
||||
ready,
|
||||
};
|
||||
|
||||
pub fn toJS(this: StreamStart, globalThis: *JSGlobalObject) JSC.JSValue {
|
||||
switch (this) {
|
||||
.empty, .ready => {
|
||||
@@ -222,6 +235,9 @@ pub const StreamStart = union(enum) {
|
||||
globalThis.vm().throwError(globalThis, err.toJSC(globalThis));
|
||||
return JSC.JSValue.jsUndefined();
|
||||
},
|
||||
else => {
|
||||
return JSC.JSValue.jsUndefined();
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,6 +252,53 @@ pub const StreamStart = union(enum) {
|
||||
|
||||
return .{ .empty = {} };
|
||||
}
|
||||
|
||||
pub fn fromJSWithTag(
|
||||
globalThis: *JSGlobalObject,
|
||||
value: JSValue,
|
||||
comptime tag: Tag,
|
||||
) StreamStart {
|
||||
if (value.isEmptyOrUndefinedOrNull() or !value.isObject()) {
|
||||
return .{ .empty = {} };
|
||||
}
|
||||
|
||||
switch (comptime tag) {
|
||||
.ArrayBufferSink => {
|
||||
var as_uint8array = false;
|
||||
var stream = false;
|
||||
var chunk_size: JSC.Blob.SizeType = 0;
|
||||
var empty = true;
|
||||
|
||||
if (value.get(globalThis, "asUint8Array")) |as_array| {
|
||||
as_uint8array = as_array.toBoolean();
|
||||
empty = false;
|
||||
}
|
||||
|
||||
if (value.get(globalThis, "stream")) |as_array| {
|
||||
stream = as_array.toBoolean();
|
||||
empty = false;
|
||||
}
|
||||
|
||||
if (value.get(globalThis, "chunkSize")) |chunkSize| {
|
||||
empty = false;
|
||||
chunk_size = @intCast(JSC.Blob.SizeType, @maximum(0, @truncate(i51, chunkSize.toInt64())));
|
||||
}
|
||||
|
||||
if (!empty) {
|
||||
return .{
|
||||
.ArrayBufferSink = .{
|
||||
.chunk_size = chunk_size,
|
||||
.as_uint8array = as_uint8array,
|
||||
.stream = stream,
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
else => @compileError("Unuspported tag"),
|
||||
}
|
||||
|
||||
return .{ .empty = {} };
|
||||
}
|
||||
};
|
||||
|
||||
pub const StreamResult = union(Tag) {
|
||||
@@ -272,15 +335,17 @@ pub const StreamResult = union(Tag) {
|
||||
}
|
||||
|
||||
pub const Writable = union(StreamResult.Tag) {
|
||||
pending: *Writable.Pending,
|
||||
|
||||
err: JSC.Node.Syscall.Error,
|
||||
done: void,
|
||||
|
||||
owned: Blob.SizeType,
|
||||
owned_and_done: Blob.SizeType,
|
||||
temporary_and_done: Blob.SizeType,
|
||||
temporary: Blob.SizeType,
|
||||
into_array: Blob.SizeType,
|
||||
into_array_and_done: Blob.SizeType,
|
||||
pending: *Writable.Pending,
|
||||
err: JSC.Node.Syscall.Error,
|
||||
done: void,
|
||||
|
||||
pub const Pending = struct {
|
||||
frame: anyframe,
|
||||
@@ -320,43 +385,27 @@ pub const StreamResult = union(Tag) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn toJS(this: *const Writable, globalThis: *JSGlobalObject) JSValue {
|
||||
switch (this.*) {
|
||||
.pending => |pending| {
|
||||
var promise = JSC.JSPromise.create(globalThis);
|
||||
Writable.toPromised(globalThis, promise, pending);
|
||||
return promise.asValue(globalThis);
|
||||
},
|
||||
pub fn toJS(this: Writable, globalThis: *JSGlobalObject) JSValue {
|
||||
return switch (this) {
|
||||
.err => |err| JSC.JSPromise.rejectedPromise(globalThis, JSValue.c(err.toJS(globalThis.ref()))).asValue(globalThis),
|
||||
|
||||
.err => |err| {
|
||||
return JSC.JSPromise.rejectedPromise(globalThis, JSValue.c(err.toJS(globalThis.ref()))).asValue(globalThis);
|
||||
},
|
||||
|
||||
.owned => |len| {
|
||||
return JSC.JSValue.jsNumber(len);
|
||||
},
|
||||
.owned_and_done => |len| {
|
||||
return JSC.JSValue.jsNumber(len);
|
||||
},
|
||||
.temporary_and_done => |len| {
|
||||
return JSC.JSValue.jsNumber(len);
|
||||
},
|
||||
.temporary => |len| {
|
||||
return JSC.JSValue.jsNumber(len);
|
||||
},
|
||||
.into_array => |len| {
|
||||
return JSC.JSValue.jsNumber(len);
|
||||
},
|
||||
.into_array_and_done => |len| {
|
||||
return JSC.JSValue.jsNumber(len);
|
||||
},
|
||||
.owned => |len| JSC.JSValue.jsNumber(len),
|
||||
.owned_and_done => |len| JSC.JSValue.jsNumber(len),
|
||||
.temporary_and_done => |len| JSC.JSValue.jsNumber(len),
|
||||
.temporary => |len| JSC.JSValue.jsNumber(len),
|
||||
.into_array => |len| JSC.JSValue.jsNumber(len),
|
||||
.into_array_and_done => |len| JSC.JSValue.jsNumber(len),
|
||||
|
||||
// false == controller.close()
|
||||
// undefined == noop, but we probably won't send it
|
||||
.done => {
|
||||
return JSC.JSValue.jsBoolean(true);
|
||||
.done => JSC.JSValue.jsBoolean(true),
|
||||
|
||||
.pending => |pending| brk: {
|
||||
var promise = JSC.JSPromise.create(globalThis);
|
||||
Writable.toPromised(globalThis, promise, pending);
|
||||
break :brk promise.asValue(globalThis);
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -740,22 +789,27 @@ pub const ArrayBufferSink = struct {
|
||||
done: bool = false,
|
||||
signal: Signal = .{},
|
||||
next: ?Sink = null,
|
||||
streaming: bool = false,
|
||||
as_uint8array: bool = false,
|
||||
|
||||
pub fn connect(this: *ArrayBufferSink, signal: Signal) void {
|
||||
std.debug.assert(this.reader == null);
|
||||
this.signal = signal;
|
||||
}
|
||||
|
||||
pub fn start(this: *ArrayBufferSink, config: StreamStart) JSC.Node.Maybe(void) {
|
||||
pub fn start(this: *ArrayBufferSink, stream_start: StreamStart) JSC.Node.Maybe(void) {
|
||||
var list = this.bytes.listManaged(this.allocator);
|
||||
list.clearAndFree();
|
||||
|
||||
switch (config) {
|
||||
.chunk_size => |chunk_size| {
|
||||
if (chunk_size > 0) {
|
||||
list.ensureTotalCapacityPrecise(chunk_size) catch return .{ .err = JSC.Node.Syscall.Error.oom };
|
||||
switch (stream_start) {
|
||||
.ArrayBufferSink => |config| {
|
||||
if (config.chunk_size > 0) {
|
||||
list.ensureTotalCapacityPrecise(config.chunk_size) catch return .{ .err = JSC.Node.Syscall.Error.oom };
|
||||
this.bytes.update(list);
|
||||
}
|
||||
|
||||
this.as_uint8array = config.as_uint8array;
|
||||
this.streaming = config.stream;
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
@@ -770,6 +824,19 @@ pub const ArrayBufferSink = struct {
|
||||
return .{ .result = {} };
|
||||
}
|
||||
|
||||
pub fn drainFromJS(this: *ArrayBufferSink, globalThis: *JSGlobalObject) JSC.Node.Maybe(JSValue) {
|
||||
if (this.streaming) {
|
||||
const value: JSValue = switch (this.as_uint8array) {
|
||||
true => JSC.ArrayBuffer.create(globalThis, this.bytes.slice(), .Uint8Array),
|
||||
false => JSC.ArrayBuffer.create(globalThis, this.bytes.slice(), .ArrayBuffer),
|
||||
};
|
||||
this.bytes.len = 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
return .{ .result = JSValue.jsUndefined() };
|
||||
}
|
||||
|
||||
pub fn finalize(this: *ArrayBufferSink) void {
|
||||
if (this.bytes.len > 0) {
|
||||
this.bytes.listManaged(this.allocator).deinit();
|
||||
@@ -788,7 +855,10 @@ pub const ArrayBufferSink = struct {
|
||||
return this;
|
||||
}
|
||||
|
||||
pub fn construct(this: *ArrayBufferSink, allocator: std.mem.Allocator) void {
|
||||
pub fn construct(
|
||||
this: *ArrayBufferSink,
|
||||
allocator: std.mem.Allocator,
|
||||
) void {
|
||||
this.* = ArrayBufferSink{
|
||||
.bytes = bun.ByteList.init(&.{}),
|
||||
.allocator = allocator,
|
||||
@@ -833,14 +903,29 @@ pub const ArrayBufferSink = struct {
|
||||
if (this.next) |*next| {
|
||||
return next.end(err);
|
||||
}
|
||||
this.signal.close(err);
|
||||
return .{ .result = {} };
|
||||
}
|
||||
|
||||
pub fn toJS(this: *ArrayBufferSink, err: ?JSC.Node.Syscall.Error) JSC.Node.Maybe(void) {
|
||||
if (this.next) |*next| {
|
||||
return next.end(err);
|
||||
pub fn toJS(this: *ArrayBufferSink, globalThis: *JSGlobalObject, as_uint8array: bool) JSValue {
|
||||
if (this.streaming) {
|
||||
const value: JSValue = switch (as_uint8array) {
|
||||
true => JSC.ArrayBuffer.create(globalThis, this.bytes.slice(), .Uint8Array),
|
||||
false => JSC.ArrayBuffer.create(globalThis, this.bytes.slice(), .ArrayBuffer),
|
||||
};
|
||||
this.bytes.len = 0;
|
||||
return value;
|
||||
}
|
||||
return .{ .result = {} };
|
||||
|
||||
var list = this.bytes.listManaged(this.allocator);
|
||||
this.bytes = bun.ByteList.init("");
|
||||
return ArrayBuffer.fromBytes(
|
||||
list.toOwnedSlice(),
|
||||
if (as_uint8array)
|
||||
.Uint8Array
|
||||
else
|
||||
.ArrayBuffer,
|
||||
).toJS(globalThis, null);
|
||||
}
|
||||
|
||||
pub fn endFromJS(this: *ArrayBufferSink, _: *JSGlobalObject) JSC.Node.Maybe(ArrayBuffer) {
|
||||
@@ -860,7 +945,7 @@ pub const ArrayBufferSink = struct {
|
||||
return Sink.init(this);
|
||||
}
|
||||
|
||||
pub const JSArrayBufferSink = NewJSSink(@This(), "ArrayBufferSink");
|
||||
pub const JSSink = NewJSSink(@This(), "ArrayBufferSink");
|
||||
};
|
||||
|
||||
pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type {
|
||||
@@ -1051,6 +1136,10 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type {
|
||||
}
|
||||
}
|
||||
|
||||
if (comptime @hasDecl(SinkType, "drainFromJS")) {
|
||||
return this.sink.drainFromJS(globalThis);
|
||||
}
|
||||
|
||||
return this.sink.drain().toJS(globalThis);
|
||||
}
|
||||
|
||||
@@ -1070,8 +1159,24 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type {
|
||||
}
|
||||
}
|
||||
|
||||
if (comptime @hasField(StreamStart, name_)) {
|
||||
return this.sink.start(
|
||||
if (callframe.argumentsCount() > 0)
|
||||
StreamStart.fromJSWithTag(
|
||||
globalThis,
|
||||
callframe.argument(0),
|
||||
comptime @field(StreamStart, name_),
|
||||
)
|
||||
else
|
||||
StreamStart{ .empty = {} },
|
||||
).toJS(globalThis);
|
||||
}
|
||||
|
||||
return this.sink.start(
|
||||
if (callframe.argumentsCount() > 0) StreamStart.fromJS(globalThis, callframe.argument(0)) else StreamStart{ .empty = {} },
|
||||
if (callframe.argumentsCount() > 0)
|
||||
StreamStart.fromJS(globalThis, callframe.argument(0))
|
||||
else
|
||||
StreamStart{ .empty = {} },
|
||||
).toJS(globalThis);
|
||||
}
|
||||
|
||||
@@ -1417,6 +1522,7 @@ pub fn ReadableStreamSource(
|
||||
globalThis.vm().throwError(globalThis, err.toJSC(globalThis));
|
||||
return JSC.JSValue.jsUndefined();
|
||||
},
|
||||
else => unreachable,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user