mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Add ArrayBuffer.isView and rework Array.isArray (#431)
This commit is contained in:
parent
1867416236
commit
4829f3a3e4
@ -113,7 +113,6 @@ export function compileCall(
|
||||
let type = evaluateConstantType(compiler, typeArguments, operands, reportNode);
|
||||
compiler.currentType = Type.bool;
|
||||
if (!type) return module.createUnreachable();
|
||||
compiler.currentType = Type.bool;
|
||||
return type.is(TypeFlags.REFERENCE)
|
||||
? module.createI32(1)
|
||||
: module.createI32(0);
|
||||
@ -134,9 +133,9 @@ export function compileCall(
|
||||
compiler.currentType = Type.bool;
|
||||
if (!type) return module.createUnreachable();
|
||||
let classType = type.classReference;
|
||||
return classType !== null && classType.lookupOverload(OperatorKind.INDEXED_GET) !== null
|
||||
? module.createI32(1)
|
||||
: module.createI32(0);
|
||||
return (
|
||||
classType !== null && classType.prototype.extends(compiler.program.arrayPrototype)
|
||||
) ? module.createI32(1) : module.createI32(0);
|
||||
}
|
||||
case "isDefined": { // isDefined(expression) -> bool
|
||||
compiler.currentType = Type.bool;
|
||||
|
@ -2856,6 +2856,14 @@ export class ClassPrototype extends Element {
|
||||
this.decoratorFlags = decoratorFlags;
|
||||
}
|
||||
|
||||
extends(basePtototype: ClassPrototype | null): bool {
|
||||
var current: ClassPrototype | null = this;
|
||||
do {
|
||||
if (current === basePtototype) return true;
|
||||
} while (current = current.basePrototype);
|
||||
return false;
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return this.simpleName;
|
||||
}
|
||||
@ -2969,6 +2977,16 @@ export class Class extends Element {
|
||||
return null;
|
||||
}
|
||||
|
||||
lookupField(name: string, shouldReadonly: boolean = false): Element | null {
|
||||
if (this.members == null) return null;
|
||||
var member = this.members.get(name);
|
||||
if (
|
||||
member == null || member.kind != ElementKind.FIELD ||
|
||||
(shouldReadonly && !member.is(CommonFlags.READONLY))
|
||||
) return null;
|
||||
return member;
|
||||
}
|
||||
|
||||
offsetof(fieldName: string): u32 {
|
||||
var members = assert(this.members);
|
||||
assert(members.has(fieldName));
|
||||
|
@ -4,13 +4,44 @@ import {
|
||||
allocateUnsafe
|
||||
} from "./internal/arraybuffer";
|
||||
|
||||
import {
|
||||
Uint8ClampedArray,
|
||||
Uint8Array,
|
||||
Int8Array,
|
||||
Uint16Array,
|
||||
Int16Array,
|
||||
Uint32Array,
|
||||
Int32Array,
|
||||
Uint64Array,
|
||||
Int64Array
|
||||
} from "./typedarray";
|
||||
|
||||
import {
|
||||
DataView
|
||||
} from "./dataview";
|
||||
|
||||
@sealed
|
||||
export class ArrayBuffer {
|
||||
|
||||
readonly byteLength: i32; // capped to [0, MAX_LENGTH]
|
||||
|
||||
@inline static isView<T>(value: T): bool {
|
||||
if (value === null) return false;
|
||||
if (value instanceof Uint8ClampedArray) return true;
|
||||
if (value instanceof Uint8Array) return true;
|
||||
if (value instanceof Int8Array) return true;
|
||||
if (value instanceof Uint16Array) return true;
|
||||
if (value instanceof Int16Array) return true;
|
||||
if (value instanceof Uint32Array) return true;
|
||||
if (value instanceof Int32Array) return true;
|
||||
if (value instanceof Uint64Array) return true;
|
||||
if (value instanceof Int64Array) return true;
|
||||
if (value instanceof DataView) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// @unsafe
|
||||
get data(): usize { return changetype<usize>(this) + HEADER_SIZE; }
|
||||
@inline get data(): usize { return changetype<usize>(this) + HEADER_SIZE; }
|
||||
|
||||
constructor(length: i32, unsafe: bool = false) {
|
||||
if (<u32>length > <u32>MAX_BLENGTH) throw new RangeError("Invalid array buffer length");
|
||||
|
4
std/assembly/index.d.ts
vendored
4
std/assembly/index.d.ts
vendored
@ -493,10 +493,14 @@ declare class ArrayBuffer {
|
||||
readonly byteLength: i32;
|
||||
/** Unsafe pointer to the start of the data in memory. */
|
||||
readonly data: usize;
|
||||
/** Returns true if value is one of the ArrayBuffer views, such as typed array or a DataView **/
|
||||
static isView<T>(value: T): bool;
|
||||
/** Constructs a new array buffer of the given length in bytes. */
|
||||
constructor(length: i32, unsafe?: bool);
|
||||
/** Returns a copy of this array buffer's bytes from begin, inclusive, up to end, exclusive. */
|
||||
slice(begin?: i32, end?: i32): ArrayBuffer;
|
||||
/** Returns a string representation of ArrayBuffer. */
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/** The `DataView` view provides a low-level interface for reading and writing multiple number types in a binary `ArrayBuffer`, without having to care about the platform's endianness. */
|
||||
|
29
std/portable/index.d.ts
vendored
29
std/portable/index.d.ts
vendored
@ -16,6 +16,7 @@
|
||||
|
||||
// Types
|
||||
|
||||
declare type bool = boolean;
|
||||
declare type i8 = number;
|
||||
declare type i16 = number;
|
||||
declare type i32 = number;
|
||||
@ -23,7 +24,6 @@ declare type isize = number;
|
||||
declare type u8 = number;
|
||||
declare type u16 = number;
|
||||
declare type u32 = number;
|
||||
declare type bool = boolean;
|
||||
declare type usize = number;
|
||||
declare type f32 = number;
|
||||
declare type f64 = number;
|
||||
@ -32,6 +32,20 @@ declare type f64 = number;
|
||||
|
||||
/** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */
|
||||
declare const ASC_TARGET: i32;
|
||||
/** Provided noTreeshaking option. */
|
||||
declare const ASC_NO_TREESHAKING: bool;
|
||||
/** Provided noAssert option. */
|
||||
declare const ASC_NO_ASSERT: bool;
|
||||
/** Provided memoryBase option. */
|
||||
declare const ASC_MEMORY_BASE: i32;
|
||||
/** Provided optimizeLevel option. */
|
||||
declare const ASC_OPTIMIZE_LEVEL: i32;
|
||||
/** Provided shrinkLevel option. */
|
||||
declare const ASC_SHRINK_LEVEL: i32;
|
||||
/** Whether the mutable global feature is enabled. */
|
||||
declare const ASC_FEATURE_MUTABLE_GLOBAL: bool;
|
||||
/** Whether the sign extension feature is enabled. */
|
||||
declare const ASC_FEATURE_SIGN_EXTENSION: bool;
|
||||
|
||||
// Builtins
|
||||
|
||||
@ -299,6 +313,8 @@ declare namespace memory {
|
||||
declare class ArrayBuffer {
|
||||
/** The size, in bytes, of the array. */
|
||||
readonly byteLength: i32;
|
||||
/** Returns true if value is one of the ArrayBuffer views, such as typed array or a DataView **/
|
||||
static isView<T>(value: T): bool;
|
||||
/** Constructs a new array buffer of the given length in bytes. */
|
||||
constructor(length: i32);
|
||||
/** Returns a copy of this array buffer's bytes from begin, inclusive, up to end, exclusive. */
|
||||
@ -397,6 +413,17 @@ declare class Int32Array extends Array<i32> {}
|
||||
declare class Float32Array extends Array<f32> {}
|
||||
declare class Float64Array extends Array<f64> {}
|
||||
|
||||
/** Interface for a typed view on an array buffer. */
|
||||
interface ArrayBufferView<T> {
|
||||
[key: number]: T;
|
||||
/** The {@link ArrayBuffer} referenced by this view. */
|
||||
readonly buffer: ArrayBuffer;
|
||||
/** The offset in bytes from the start of the referenced {@link ArrayBuffer}. */
|
||||
readonly byteOffset: i32;
|
||||
/** The length in bytes from the start of the referenced {@link ArrayBuffer}. */
|
||||
readonly byteLength: i32;
|
||||
}
|
||||
|
||||
declare class String {
|
||||
|
||||
static fromCharCode(ls: i32, hs?: i32): string;
|
||||
|
@ -2,7 +2,14 @@
|
||||
|
||||
var globalScope = typeof window !== "undefined" && window || typeof global !== "undefined" && global || self;
|
||||
|
||||
globalScope.ASC_TARGET = 0;
|
||||
globalScope.ASC_TARGET = 0; // JS
|
||||
globalScope.ASC_NO_TREESHAKING = false;
|
||||
globalScope.ASC_NO_ASSERT = false;
|
||||
globalScope.ASC_MEMORY_BASE = 0;
|
||||
globalScope.ASC_OPTIMIZE_LEVEL = 3;
|
||||
globalScope.ASC_SHRINK_LEVEL = 0;
|
||||
globalScope.ASC_FEATURE_MUTABLE_GLOBAL = false;
|
||||
globalScope.ASC_FEATURE_SIGN_EXTENSION = false;
|
||||
|
||||
var F64 = new Float64Array(1);
|
||||
var U64 = new Uint32Array(F64.buffer);
|
||||
@ -197,7 +204,7 @@ globalScope["isFloat"] = function isFloat(arg) {
|
||||
return typeof arg === "number";
|
||||
};
|
||||
|
||||
globalScope["isReference"] = function isClass(arg) {
|
||||
globalScope["isReference"] = function isReference(arg) {
|
||||
return typeof arg === "object" || typeof arg === "string";
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,11 +33,13 @@ var arr = new Array<i32>();
|
||||
class P {}
|
||||
var num = 1;
|
||||
var Null: i32[] | null = null;
|
||||
var str = "abc";
|
||||
assert(Array.isArray(Null) == false);
|
||||
assert(Array.isArray(arr) == true);
|
||||
assert(Array.isArray(new P()) == false);
|
||||
// assert(Array.isArray(new Uint8Array(1)) == false); fail
|
||||
assert(Array.isArray(new Uint8Array(1)) == false);
|
||||
assert(Array.isArray(num) == false);
|
||||
assert(Array.isArray(str) == false);
|
||||
|
||||
// Array#fill //////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,14 +3,21 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiii (func (param i32 i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(type $FUNCSIG$vii (func (param i32 i32)))
|
||||
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
|
||||
(type $FUNCSIG$ii (func (param i32) (result i32)))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
|
||||
(data (i32.const 56) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
|
||||
(data (i32.const 120) "\12\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
|
||||
(data (i32.const 160) "\1b\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s")
|
||||
(data (i32.const 224) "\08\00\00\00\00\00\00\00\01\00\00\00\02")
|
||||
(data (i32.const 240) "\e0\00\00\00\02")
|
||||
(data (i32.const 248) "\10\00\00\00~\00l\00i\00b\00/\00d\00a\00t\00a\00v\00i\00e\00w\00.\00t\00s")
|
||||
(table $0 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
@ -18,6 +25,7 @@
|
||||
(global $std/arraybuffer/buffer (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
|
||||
(global $std/arraybuffer/arr8 (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
@ -1517,9 +1525,192 @@
|
||||
get_local $2
|
||||
call $~lib/arraybuffer/ArrayBuffer#slice
|
||||
)
|
||||
(func $start (; 8 ;) (type $v)
|
||||
(func $~lib/internal/typedarray/TypedArray<u8>#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
get_local $1
|
||||
i32.const 1073741816
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 160
|
||||
i32.const 23
|
||||
i32.const 34
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $1
|
||||
call $~lib/internal/arraybuffer/allocateUnsafe
|
||||
tee_local $2
|
||||
i32.const 8
|
||||
i32.add
|
||||
get_local $1
|
||||
call $~lib/internal/memory/memset
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
get_local $2
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
get_local $1
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
)
|
||||
(func $~lib/internal/typedarray/TypedArray<i32>#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
get_local $1
|
||||
i32.const 268435454
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 160
|
||||
i32.const 23
|
||||
i32.const 34
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
tee_local $1
|
||||
call $~lib/internal/arraybuffer/allocateUnsafe
|
||||
tee_local $2
|
||||
i32.const 8
|
||||
i32.add
|
||||
get_local $1
|
||||
call $~lib/internal/memory/memset
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
get_local $2
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
get_local $1
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
)
|
||||
(func $~lib/dataview/DataView#constructor (; 10 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
|
||||
get_local $3
|
||||
i32.const -2147483648
|
||||
i32.eq
|
||||
if
|
||||
get_local $1
|
||||
i32.load
|
||||
get_local $2
|
||||
i32.sub
|
||||
set_local $3
|
||||
end
|
||||
get_local $2
|
||||
i32.const 1073741816
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 248
|
||||
i32.const 14
|
||||
i32.const 44
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $3
|
||||
i32.const 1073741816
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 248
|
||||
i32.const 15
|
||||
i32.const 44
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $2
|
||||
get_local $3
|
||||
i32.add
|
||||
get_local $1
|
||||
i32.load
|
||||
i32.gt_s
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 248
|
||||
i32.const 16
|
||||
i32.const 53
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
get_local $1
|
||||
i32.store
|
||||
get_local $0
|
||||
get_local $2
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
get_local $3
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
)
|
||||
(func $~lib/dataview/DataView#constructor|trampoline (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
block $2of2
|
||||
block $1of2
|
||||
block $outOfRange
|
||||
get_global $~argc
|
||||
i32.const 1
|
||||
i32.sub
|
||||
br_table $1of2 $1of2 $2of2 $outOfRange
|
||||
end
|
||||
unreachable
|
||||
end
|
||||
i32.const -2147483648
|
||||
set_local $1
|
||||
end
|
||||
i32.const 0
|
||||
get_local $0
|
||||
i32.const 0
|
||||
get_local $1
|
||||
call $~lib/dataview/DataView#constructor
|
||||
)
|
||||
(func $start (; 12 ;) (type $v)
|
||||
(local $0 i32)
|
||||
i32.const 160
|
||||
i32.const 288
|
||||
set_global $~lib/allocator/arena/startOffset
|
||||
get_global $~lib/allocator/arena/startOffset
|
||||
set_global $~lib/allocator/arena/offset
|
||||
@ -1564,8 +1755,6 @@
|
||||
end
|
||||
get_global $std/arraybuffer/sliced
|
||||
get_global $std/arraybuffer/buffer
|
||||
i32.const 0
|
||||
i32.add
|
||||
i32.eq
|
||||
if
|
||||
i32.const 0
|
||||
@ -1716,8 +1905,67 @@
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 12
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
i32.const 1
|
||||
call $~lib/internal/typedarray/TypedArray<u8>#constructor
|
||||
set_global $std/arraybuffer/arr8
|
||||
i32.const 1
|
||||
i32.const 0
|
||||
get_global $std/arraybuffer/arr8
|
||||
select
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 50
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
block $__inlined_func$~lib/arraybuffer/ArrayBuffer.isView<Uint8Array>5 (result i32)
|
||||
i32.const 0
|
||||
i32.const 12
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
i32.const 1
|
||||
call $~lib/internal/typedarray/TypedArray<i32>#constructor
|
||||
i32.eqz
|
||||
br_if $__inlined_func$~lib/arraybuffer/ArrayBuffer.isView<Uint8Array>5
|
||||
drop
|
||||
i32.const 1
|
||||
end
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 51
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 1
|
||||
set_global $~argc
|
||||
block $__inlined_func$~lib/arraybuffer/ArrayBuffer.isView<Uint8Array>6 (result i32)
|
||||
i32.const 0
|
||||
get_global $std/arraybuffer/arr8
|
||||
i32.load
|
||||
call $~lib/dataview/DataView#constructor|trampoline
|
||||
i32.eqz
|
||||
br_if $__inlined_func$~lib/arraybuffer/ArrayBuffer.isView<Uint8Array>6
|
||||
drop
|
||||
i32.const 1
|
||||
end
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 52
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $null (; 9 ;) (type $v)
|
||||
(func $null (; 13 ;) (type $v)
|
||||
nop
|
||||
)
|
||||
)
|
||||
|
@ -38,3 +38,15 @@ sliced = buffer.slice(42);
|
||||
|
||||
assert(sliced.byteLength == 0);
|
||||
assert(sliced != null);
|
||||
|
||||
assert(!ArrayBuffer.isView(changetype<i32[]>(null)));
|
||||
assert(!ArrayBuffer.isView(changetype<usize>(null)));
|
||||
assert(!ArrayBuffer.isView(changetype<Uint8Array>(null)));
|
||||
assert(!ArrayBuffer.isView(changetype<Int32Array>(null)));
|
||||
assert(!ArrayBuffer.isView(changetype<DataView>(null)));
|
||||
|
||||
var arr8 = new Uint8Array(1);
|
||||
assert(!ArrayBuffer.isView(<i32[]>[1, 2]));
|
||||
assert(ArrayBuffer.isView(arr8));
|
||||
assert(ArrayBuffer.isView(new Int32Array(1)));
|
||||
assert(ArrayBuffer.isView(new DataView(arr8.buffer)));
|
||||
|
@ -3,12 +3,18 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiii (func (param i32 i32 i32 i32) (result i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 56) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 120) "\12\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 160) "\1b\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s\00")
|
||||
(data (i32.const 224) "\08\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00")
|
||||
(data (i32.const 240) "\e0\00\00\00\02\00\00\00")
|
||||
(data (i32.const 248) "\10\00\00\00~\00l\00i\00b\00/\00d\00a\00t\00a\00v\00i\00e\00w\00.\00t\00s\00")
|
||||
(table $0 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
|
||||
@ -22,7 +28,9 @@
|
||||
(global $std/arraybuffer/buffer (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 160))
|
||||
(global $std/arraybuffer/arr8 (mut i32) (i32.const 0))
|
||||
(global $~lib/builtins/i32.MIN_VALUE i32 (i32.const -2147483648))
|
||||
(global $HEAP_BASE i32 (i32.const 284))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
@ -410,7 +418,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.const 47
|
||||
i32.const 40
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1976,12 +1984,307 @@
|
||||
get_local $2
|
||||
call $~lib/arraybuffer/ArrayBuffer#slice
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer#get:data (; 10 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/arraybuffer/ArrayBuffer.isView<Array<i32>> (; 10 ;) (type $ii) (param $0 i32) (result i32)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if
|
||||
i32.const 0
|
||||
return
|
||||
end
|
||||
i32.const 0
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer.isView<usize> (; 11 ;) (type $ii) (param $0 i32) (result i32)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if
|
||||
i32.const 0
|
||||
return
|
||||
end
|
||||
i32.const 0
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer.isView<Uint8Array> (; 12 ;) (type $ii) (param $0 i32) (result i32)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if
|
||||
i32.const 0
|
||||
return
|
||||
end
|
||||
i32.const 1
|
||||
return
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer.isView<Int32Array> (; 13 ;) (type $ii) (param $0 i32) (result i32)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if
|
||||
i32.const 0
|
||||
return
|
||||
end
|
||||
i32.const 1
|
||||
return
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer.isView<DataView> (; 14 ;) (type $ii) (param $0 i32) (result i32)
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if
|
||||
i32.const 0
|
||||
return
|
||||
end
|
||||
i32.const 1
|
||||
return
|
||||
)
|
||||
(func $~lib/memory/memory.allocate (; 15 ;) (type $ii) (param $0 i32) (result i32)
|
||||
get_local $0
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
return
|
||||
)
|
||||
(func $~lib/internal/typedarray/TypedArray<u8>#constructor (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
get_local $1
|
||||
i32.const 1073741816
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 160
|
||||
i32.const 23
|
||||
i32.const 34
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $1
|
||||
i32.const 0
|
||||
i32.shl
|
||||
set_local $2
|
||||
get_local $2
|
||||
call $~lib/internal/arraybuffer/allocateUnsafe
|
||||
set_local $3
|
||||
get_local $3
|
||||
get_global $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.add
|
||||
set_local $4
|
||||
i32.const 0
|
||||
set_local $5
|
||||
get_local $4
|
||||
get_local $5
|
||||
get_local $2
|
||||
call $~lib/internal/memory/memset
|
||||
block (result i32)
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/memory/memory.allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
end
|
||||
get_local $3
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
get_local $2
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
)
|
||||
(func $start (; 11 ;) (type $v)
|
||||
(func $~lib/typedarray/Uint8Array#constructor (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/memory/memory.allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
get_local $1
|
||||
call $~lib/internal/typedarray/TypedArray<u8>#constructor
|
||||
set_local $0
|
||||
get_local $0
|
||||
)
|
||||
(func $~lib/internal/typedarray/TypedArray<i32>#constructor (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
get_local $1
|
||||
i32.const 268435454
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 160
|
||||
i32.const 23
|
||||
i32.const 34
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
set_local $2
|
||||
get_local $2
|
||||
call $~lib/internal/arraybuffer/allocateUnsafe
|
||||
set_local $3
|
||||
get_local $3
|
||||
get_global $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.add
|
||||
set_local $4
|
||||
i32.const 0
|
||||
set_local $5
|
||||
get_local $4
|
||||
get_local $5
|
||||
get_local $2
|
||||
call $~lib/internal/memory/memset
|
||||
block (result i32)
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/memory/memory.allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
end
|
||||
get_local $3
|
||||
i32.store
|
||||
get_local $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
get_local $2
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
)
|
||||
(func $~lib/typedarray/Int32Array#constructor (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/memory/memory.allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
get_local $1
|
||||
call $~lib/internal/typedarray/TypedArray<i32>#constructor
|
||||
set_local $0
|
||||
get_local $0
|
||||
)
|
||||
(func $~lib/dataview/DataView#constructor (; 20 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
|
||||
get_local $3
|
||||
get_global $~lib/builtins/i32.MIN_VALUE
|
||||
i32.eq
|
||||
if
|
||||
get_local $1
|
||||
i32.load
|
||||
get_local $2
|
||||
i32.sub
|
||||
set_local $3
|
||||
end
|
||||
get_local $2
|
||||
get_global $~lib/internal/arraybuffer/MAX_BLENGTH
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 248
|
||||
i32.const 14
|
||||
i32.const 44
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $3
|
||||
get_global $~lib/internal/arraybuffer/MAX_BLENGTH
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 248
|
||||
i32.const 15
|
||||
i32.const 44
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $2
|
||||
get_local $3
|
||||
i32.add
|
||||
get_local $1
|
||||
i32.load
|
||||
i32.gt_s
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 248
|
||||
i32.const 16
|
||||
i32.const 53
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_local $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/memory/memory.allocate
|
||||
set_local $0
|
||||
end
|
||||
get_local $0
|
||||
get_local $1
|
||||
i32.store
|
||||
get_local $0
|
||||
get_local $2
|
||||
i32.store offset=4
|
||||
get_local $0
|
||||
get_local $3
|
||||
i32.store offset=8
|
||||
get_local $0
|
||||
)
|
||||
(func $~lib/dataview/DataView#constructor|trampoline (; 21 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
|
||||
block $2of2
|
||||
block $1of2
|
||||
block $0of2
|
||||
block $outOfRange
|
||||
get_global $~argc
|
||||
i32.const 1
|
||||
i32.sub
|
||||
br_table $0of2 $1of2 $2of2 $outOfRange
|
||||
end
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
set_local $2
|
||||
end
|
||||
get_global $~lib/builtins/i32.MIN_VALUE
|
||||
set_local $3
|
||||
end
|
||||
get_local $0
|
||||
get_local $1
|
||||
get_local $2
|
||||
get_local $3
|
||||
call $~lib/dataview/DataView#constructor
|
||||
)
|
||||
(func $start (; 22 ;) (type $v)
|
||||
(local $0 i32)
|
||||
get_global $HEAP_BASE
|
||||
get_global $~lib/internal/allocator/AL_MASK
|
||||
i32.add
|
||||
@ -2032,10 +2335,20 @@
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $std/arraybuffer/sliced
|
||||
call $~lib/arraybuffer/ArrayBuffer#get:data
|
||||
get_global $std/arraybuffer/buffer
|
||||
call $~lib/arraybuffer/ArrayBuffer#get:data
|
||||
block $~lib/arraybuffer/ArrayBuffer#get:data|inlined.0 (result i32)
|
||||
get_global $std/arraybuffer/sliced
|
||||
set_local $0
|
||||
get_local $0
|
||||
get_global $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.add
|
||||
end
|
||||
block $~lib/arraybuffer/ArrayBuffer#get:data|inlined.1 (result i32)
|
||||
get_global $std/arraybuffer/buffer
|
||||
set_local $0
|
||||
get_local $0
|
||||
get_global $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.add
|
||||
end
|
||||
i32.ne
|
||||
i32.eqz
|
||||
if
|
||||
@ -2208,7 +2521,127 @@
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<Array<i32>>
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 42
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<usize>
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 43
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<Uint8Array>
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 44
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<Int32Array>
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 45
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<DataView>
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 46
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
i32.const 1
|
||||
call $~lib/typedarray/Uint8Array#constructor
|
||||
set_global $std/arraybuffer/arr8
|
||||
i32.const 240
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<Array<i32>>
|
||||
i32.eqz
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 49
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $std/arraybuffer/arr8
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<Uint8Array>
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 50
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
i32.const 1
|
||||
call $~lib/typedarray/Int32Array#constructor
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<Int32Array>
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 51
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
block (result i32)
|
||||
i32.const 1
|
||||
set_global $~argc
|
||||
i32.const 0
|
||||
get_global $std/arraybuffer/arr8
|
||||
i32.load
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
call $~lib/dataview/DataView#constructor|trampoline
|
||||
end
|
||||
call $~lib/arraybuffer/ArrayBuffer.isView<DataView>
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 120
|
||||
i32.const 52
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $null (; 12 ;) (type $v)
|
||||
(func $null (; 23 ;) (type $v)
|
||||
)
|
||||
)
|
||||
|
@ -348,7 +348,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.const 47
|
||||
i32.const 40
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
@ -432,7 +432,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.const 47
|
||||
i32.const 40
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
@ -349,7 +349,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.const 47
|
||||
i32.const 40
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
@ -434,7 +434,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.const 47
|
||||
i32.const 40
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
@ -374,7 +374,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 56
|
||||
i32.const 16
|
||||
i32.const 47
|
||||
i32.const 40
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
@ -482,7 +482,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 56
|
||||
i32.const 16
|
||||
i32.const 47
|
||||
i32.const 40
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
Loading…
x
Reference in New Issue
Block a user