зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1656411
- Move typed array, ArrayBuffer, and dataview-related functions out of jsfriendapi.h to two new headers. r=mgaudet,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D85524
This commit is contained in:
Родитель
15d7edd1cc
Коммит
e8f3f74ef6
|
@ -5,6 +5,7 @@
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewType
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIRandomGenerator.h"
|
#include "nsIRandomGenerator.h"
|
||||||
#include "MainThreadUtils.h"
|
#include "MainThreadUtils.h"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetFloat32ArrayData
|
||||||
#include "mozilla/HoldDropJSObjects.h"
|
#include "mozilla/HoldDropJSObjects.h"
|
||||||
#include "mozilla/dom/TypedArray.h"
|
#include "mozilla/dom/TypedArray.h"
|
||||||
#include "mozilla/dom/Pose.h"
|
#include "mozilla/dom/Pose.h"
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
|
|
||||||
#include "js/ArrayBuffer.h"
|
#include "js/ArrayBuffer.h"
|
||||||
#include "js/ArrayBufferMaybeShared.h"
|
#include "js/ArrayBufferMaybeShared.h"
|
||||||
|
#include "js/experimental/TypedData.h" // js::Unwrap(Ui|I)nt(8|16|32)Array, js::Get(Ui|I)nt(8|16|32)ArrayLengthAndData, js::UnwrapUint8ClampedArray, js::GetUint8ClampedArrayLengthAndData, js::UnwrapFloat(32|64)Array, js::GetFloat(32|64)ArrayLengthAndData, JS_GetArrayBufferViewType
|
||||||
#include "js/GCAPI.h" // JS::AutoCheckCannotGC
|
#include "js/GCAPI.h" // JS::AutoCheckCannotGC
|
||||||
#include "js/RootingAPI.h" // JS::Rooted
|
#include "js/RootingAPI.h" // JS::Rooted
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/SharedArrayBuffer.h"
|
#include "js/SharedArrayBuffer.h"
|
||||||
#include "jsfriendapi.h" // js::Scalar
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/dom/BindingDeclarations.h"
|
#include "mozilla/dom/BindingDeclarations.h"
|
||||||
#include "mozilla/dom/SpiderMonkeyInterface.h"
|
#include "mozilla/dom/SpiderMonkeyInterface.h"
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "js/Array.h" // JS::GetArrayLength
|
#include "js/Array.h" // JS::GetArrayLength
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewUint8ClampedArray, JS_GetUint8ClampedArrayData
|
||||||
#include "js/HeapAPI.h"
|
#include "js/HeapAPI.h"
|
||||||
#include "js/Warnings.h" // JS::WarnASCII
|
#include "js/Warnings.h" // JS::WarnASCII
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "ClientWebGLExtensions.h"
|
#include "ClientWebGLExtensions.h"
|
||||||
#include "HostWebGLContext.h"
|
#include "HostWebGLContext.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "mozilla/dom/ToJSValue.h"
|
#include "mozilla/dom/ToJSValue.h"
|
||||||
#include "mozilla/dom/WebGLContextEvent.h"
|
#include "mozilla/dom/WebGLContextEvent.h"
|
||||||
#include "mozilla/dom/WorkerCommon.h"
|
#include "mozilla/dom/WorkerCommon.h"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "GLContextTypes.h"
|
#include "GLContextTypes.h"
|
||||||
#include "GLDefs.h"
|
#include "GLDefs.h"
|
||||||
#include "GLScreenBuffer.h"
|
#include "GLScreenBuffer.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/CheckedInt.h"
|
#include "mozilla/CheckedInt.h"
|
||||||
#include "mozilla/dom/BindingDeclarations.h"
|
#include "mozilla/dom/BindingDeclarations.h"
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "js/Array.h" // JS::NewArrayObject
|
#include "js/Array.h" // JS::NewArrayObject
|
||||||
#include "js/ArrayBuffer.h" // JS::{IsArrayBufferObject,NewArrayBuffer{,WithContents},GetArrayBufferLengthAndData}
|
#include "js/ArrayBuffer.h" // JS::{IsArrayBufferObject,NewArrayBuffer{,WithContents},GetArrayBufferLengthAndData}
|
||||||
#include "js/Date.h"
|
#include "js/Date.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_IsArrayBufferViewObject, JS_GetObjectAsArrayBufferView
|
||||||
#include "js/MemoryFunctions.h"
|
#include "js/MemoryFunctions.h"
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "mozilla/dom/AudioBufferBinding.h"
|
#include "mozilla/dom/AudioBufferBinding.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "js/ArrayBuffer.h" // JS::StealArrayBufferContents
|
#include "js/ArrayBuffer.h" // JS::StealArrayBufferContents
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewFloat32Array, JS_GetFloat32ArrayData, JS_GetTypedArrayLength, JS_GetArrayBufferViewBuffer
|
||||||
#include "mozilla/ErrorResult.h"
|
#include "mozilla/ErrorResult.h"
|
||||||
#include "AudioSegment.h"
|
#include "AudioSegment.h"
|
||||||
#include "AudioChannelFormat.h"
|
#include "AudioChannelFormat.h"
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "AudioParamMap.h"
|
#include "AudioParamMap.h"
|
||||||
#include "js/Array.h" // JS::{Get,Set}ArrayLength, JS::NewArrayLength
|
#include "js/Array.h" // JS::{Get,Set}ArrayLength, JS::NewArrayLength
|
||||||
#include "js/Exception.h"
|
#include "js/Exception.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewFloat32Array, JS_GetFloat32ArrayData, JS_GetTypedArrayLength, JS_GetArrayBufferViewBuffer
|
||||||
#include "mozilla/dom/AudioWorkletNodeBinding.h"
|
#include "mozilla/dom/AudioWorkletNodeBinding.h"
|
||||||
#include "mozilla/dom/AudioParamMapBinding.h"
|
#include "mozilla/dom/AudioParamMapBinding.h"
|
||||||
#include "mozilla/dom/RootedDictionary.h"
|
#include "mozilla/dom/RootedDictionary.h"
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "SDBConnection.h"
|
#include "SDBConnection.h"
|
||||||
|
|
||||||
#include "ActorsChild.h"
|
#include "ActorsChild.h"
|
||||||
#include "jsfriendapi.h" // JS_GetObjectAsArrayBufferView
|
|
||||||
#include "js/ArrayBuffer.h" // JS::{GetObjectAsArrayBuffer,IsArrayBufferObject}
|
#include "js/ArrayBuffer.h" // JS::{GetObjectAsArrayBuffer,IsArrayBufferObject}
|
||||||
|
#include "js/experimental/TypedData.h" // JS_IsArrayBufferViewObject, JS_GetObjectAsArrayBufferView
|
||||||
#include "js/RootingAPI.h" // JS::{Handle,Rooted}
|
#include "js/RootingAPI.h" // JS::{Handle,Rooted}
|
||||||
#include "js/Value.h" // JS::Value
|
#include "js/Value.h" // JS::Value
|
||||||
#include "mozilla/ipc/BackgroundChild.h"
|
#include "mozilla/ipc/BackgroundChild.h"
|
||||||
|
|
|
@ -0,0 +1,133 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
|
* vim: set ts=8 sts=2 et sw=2 tw=80:
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
/* An enumeration of all possible element types in typed data. */
|
||||||
|
|
||||||
|
#ifndef js_ScalarType_h
|
||||||
|
#define js_ScalarType_h
|
||||||
|
|
||||||
|
#include "mozilla/Assertions.h" // MOZ_CRASH
|
||||||
|
|
||||||
|
#include <stddef.h> // size_t
|
||||||
|
|
||||||
|
namespace js {
|
||||||
|
|
||||||
|
namespace Scalar {
|
||||||
|
|
||||||
|
// Scalar types that can appear in typed arrays and typed objects.
|
||||||
|
// The enum values must be kept in sync with:
|
||||||
|
// * the JS_SCALARTYPEREPR constants
|
||||||
|
// * the TYPEDARRAY_KIND constants
|
||||||
|
// * the SCTAG_TYPED_ARRAY constants
|
||||||
|
// * JS_FOR_EACH_TYPEDARRAY
|
||||||
|
// * JS_FOR_PROTOTYPES_
|
||||||
|
// * JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE
|
||||||
|
// * JIT compilation
|
||||||
|
enum Type {
|
||||||
|
Int8 = 0,
|
||||||
|
Uint8,
|
||||||
|
Int16,
|
||||||
|
Uint16,
|
||||||
|
Int32,
|
||||||
|
Uint32,
|
||||||
|
Float32,
|
||||||
|
Float64,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special type that is a uint8_t, but assignments are clamped to [0, 256).
|
||||||
|
* Treat the raw data type as a uint8_t.
|
||||||
|
*/
|
||||||
|
Uint8Clamped,
|
||||||
|
|
||||||
|
BigInt64,
|
||||||
|
BigUint64,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types that don't have their own TypedArray equivalent, for now.
|
||||||
|
*/
|
||||||
|
MaxTypedArrayViewType,
|
||||||
|
|
||||||
|
Int64,
|
||||||
|
Simd128,
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline size_t byteSize(Type atype) {
|
||||||
|
switch (atype) {
|
||||||
|
case Int8:
|
||||||
|
case Uint8:
|
||||||
|
case Uint8Clamped:
|
||||||
|
return 1;
|
||||||
|
case Int16:
|
||||||
|
case Uint16:
|
||||||
|
return 2;
|
||||||
|
case Int32:
|
||||||
|
case Uint32:
|
||||||
|
case Float32:
|
||||||
|
return 4;
|
||||||
|
case Int64:
|
||||||
|
case Float64:
|
||||||
|
case BigInt64:
|
||||||
|
case BigUint64:
|
||||||
|
return 8;
|
||||||
|
case Simd128:
|
||||||
|
return 16;
|
||||||
|
case MaxTypedArrayViewType:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MOZ_CRASH("invalid scalar type");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool isSignedIntType(Type atype) {
|
||||||
|
switch (atype) {
|
||||||
|
case Int8:
|
||||||
|
case Int16:
|
||||||
|
case Int32:
|
||||||
|
case Int64:
|
||||||
|
case BigInt64:
|
||||||
|
return true;
|
||||||
|
case Uint8:
|
||||||
|
case Uint8Clamped:
|
||||||
|
case Uint16:
|
||||||
|
case Uint32:
|
||||||
|
case Float32:
|
||||||
|
case Float64:
|
||||||
|
case BigUint64:
|
||||||
|
case Simd128:
|
||||||
|
return false;
|
||||||
|
case MaxTypedArrayViewType:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MOZ_CRASH("invalid scalar type");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool isBigIntType(Type atype) {
|
||||||
|
switch (atype) {
|
||||||
|
case BigInt64:
|
||||||
|
case BigUint64:
|
||||||
|
return true;
|
||||||
|
case Int8:
|
||||||
|
case Int16:
|
||||||
|
case Int32:
|
||||||
|
case Int64:
|
||||||
|
case Uint8:
|
||||||
|
case Uint8Clamped:
|
||||||
|
case Uint16:
|
||||||
|
case Uint32:
|
||||||
|
case Float32:
|
||||||
|
case Float64:
|
||||||
|
case Simd128:
|
||||||
|
return false;
|
||||||
|
case MaxTypedArrayViewType:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MOZ_CRASH("invalid scalar type");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Scalar
|
||||||
|
|
||||||
|
} // namespace js
|
||||||
|
|
||||||
|
#endif // js_ScalarType_h
|
|
@ -0,0 +1,400 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
|
* vim: set ts=8 sts=2 et sw=2 tw=80:
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Typed array, ArrayBuffer, and DataView creation, predicate, and accessor
|
||||||
|
* functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef js_experimental_TypedData_h
|
||||||
|
#define js_experimental_TypedData_h
|
||||||
|
|
||||||
|
#include "mozilla/Assertions.h" // MOZ_ASSERT, MOZ_CRASH
|
||||||
|
#include "mozilla/Casting.h" // mozilla::AssertedCast
|
||||||
|
|
||||||
|
#include <stddef.h> // size_t
|
||||||
|
#include <stdint.h> // {,u}int8_t, {,u}int16_t, {,u}int32_t
|
||||||
|
|
||||||
|
#include "jsfriendapi.h" // js::GetObject{Class,Private}, js::GetReservedSlot
|
||||||
|
#include "jstypes.h" // JS_FRIEND_API
|
||||||
|
|
||||||
|
#include "js/RootingAPI.h" // JS::Handle
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
|
struct JSClass;
|
||||||
|
class JS_PUBLIC_API JSObject;
|
||||||
|
|
||||||
|
namespace JS {
|
||||||
|
|
||||||
|
class JS_PUBLIC_API AutoRequireNoGC;
|
||||||
|
|
||||||
|
} // namespace JS
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new typed array with nelements elements.
|
||||||
|
*
|
||||||
|
* These functions (except the WithBuffer variants) fill in the array with
|
||||||
|
* zeros.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt8Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint8Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint8ClampedArray(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt16Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint16Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt32Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint32Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewFloat32Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewFloat64Array(JSContext* cx,
|
||||||
|
uint32_t nelements);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new typed array and copy in values from the given object. The
|
||||||
|
* object is used as if it were an array; that is, the new array (if
|
||||||
|
* successfully created) will have length given by array.length, and its
|
||||||
|
* elements will be those specified by array[0], array[1], and so on, after
|
||||||
|
* conversion to the typed array element type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt8ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint8ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint8ClampedArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt16ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint16ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt32ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint32ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewFloat32ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewFloat64ArrayFromArray(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> array);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new typed array using the given ArrayBuffer or
|
||||||
|
* SharedArrayBuffer for storage. The length value is optional; if -1
|
||||||
|
* is passed, enough elements to use up the remainder of the byte
|
||||||
|
* array is used as the default value.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt8ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint8ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint8ClampedArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt16ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint16ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewInt32ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewUint32ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewBigInt64ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewBigUint64ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewFloat32ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_NewFloat64ArrayWithBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> arrayBuffer, uint32_t byteOffset,
|
||||||
|
int32_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether obj supports JS_GetTypedArray* APIs. Note that this may return
|
||||||
|
* false if a security wrapper is encountered that denies the unwrapping. If
|
||||||
|
* this test or one of the JS_Is*Array tests succeeds, then it is safe to call
|
||||||
|
* the various accessor JSAPI calls defined below.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API bool JS_IsTypedArrayObject(JSObject* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether obj supports JS_GetArrayBufferView* APIs. Note that this may
|
||||||
|
* return false if a security wrapper is encountered that denies the
|
||||||
|
* unwrapping. If this test or one of the more specific tests succeeds, then it
|
||||||
|
* is safe to call the various ArrayBufferView accessor JSAPI calls defined
|
||||||
|
* below.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API bool JS_IsArrayBufferViewObject(JSObject* obj);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test for specific typed array types (ArrayBufferView subtypes)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern JS_FRIEND_API bool JS_IsInt8Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsUint8Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsUint8ClampedArray(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsInt16Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsUint16Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsInt32Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsUint32Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsFloat32Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API bool JS_IsFloat64Array(JSObject* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the isShared flag of a typed array, which denotes whether
|
||||||
|
* the underlying buffer is a SharedArrayBuffer.
|
||||||
|
*
|
||||||
|
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
||||||
|
* be known that it would pass such a test: it is a typed array or a wrapper of
|
||||||
|
* a typed array, and the unwrapping will succeed.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API bool JS_GetTypedArraySharedness(JSObject* obj);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test for specific typed array types (ArrayBufferView subtypes) and return
|
||||||
|
* the unwrapped object if so, else nullptr. Never throws.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace js {
|
||||||
|
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapInt8Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapUint8Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapUint8ClampedArray(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapInt16Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapUint16Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapInt32Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapUint32Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapBigInt64Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapBigUint64Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapFloat32Array(JSObject* obj);
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapFloat64Array(JSObject* obj);
|
||||||
|
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapArrayBufferView(JSObject* obj);
|
||||||
|
|
||||||
|
extern JS_FRIEND_API JSObject* UnwrapReadableStream(JSObject* obj);
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Int8ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Uint8ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Uint8ClampedArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Int16ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Uint16ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Int32ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Uint32ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const BigInt64ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const BigUint64ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Float32ArrayClassPtr;
|
||||||
|
extern JS_FRIEND_DATA const JSClass* const Float64ArrayClassPtr;
|
||||||
|
|
||||||
|
const size_t TypedArrayLengthSlot = 1;
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
#define JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Type, type) \
|
||||||
|
inline void Get##Type##ArrayLengthAndData( \
|
||||||
|
JSObject* obj, uint32_t* length, bool* isSharedMemory, type** data) { \
|
||||||
|
MOZ_ASSERT(GetObjectClass(obj) == detail::Type##ArrayClassPtr); \
|
||||||
|
const JS::Value& lenSlot = \
|
||||||
|
GetReservedSlot(obj, detail::TypedArrayLengthSlot); \
|
||||||
|
*length = mozilla::AssertedCast<uint32_t>(lenSlot.toInt32()); \
|
||||||
|
*isSharedMemory = JS_GetTypedArraySharedness(obj); \
|
||||||
|
*data = static_cast<type*>(GetObjectPrivate(obj)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Int8, int8_t)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint8, uint8_t)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint8Clamped, uint8_t)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Int16, int16_t)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint16, uint16_t)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Int32, int32_t)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint32, uint32_t)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Float32, float)
|
||||||
|
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Float64, double)
|
||||||
|
|
||||||
|
#undef JS_DEFINE_DATA_AND_LENGTH_ACCESSOR
|
||||||
|
|
||||||
|
// This one isn't inlined because it's rather tricky (by dint of having to deal
|
||||||
|
// with a dozen-plus classes and varying slot layouts.
|
||||||
|
extern JS_FRIEND_API void GetArrayBufferViewLengthAndData(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
uint8_t** data);
|
||||||
|
|
||||||
|
} // namespace js
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Unwrap Typed arrays all at once. Return nullptr without throwing if the
|
||||||
|
* object cannot be viewed as the correct typed array, or the typed array
|
||||||
|
* object on success, filling both outparameters.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsInt8Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
int8_t** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint8Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
uint8_t** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint8ClampedArray(
|
||||||
|
JSObject* obj, uint32_t* length, bool* isSharedMemory, uint8_t** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsInt16Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
int16_t** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint16Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
uint16_t** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsInt32Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
int32_t** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint32Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
uint32_t** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsFloat32Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
float** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsFloat64Array(JSObject* obj,
|
||||||
|
uint32_t* length,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
double** data);
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetObjectAsArrayBufferView(
|
||||||
|
JSObject* obj, uint32_t* length, bool* isSharedMemory, uint8_t** data);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the type of elements in a typed array, or MaxTypedArrayViewType if a
|
||||||
|
* DataView.
|
||||||
|
*
|
||||||
|
* |obj| must have passed a JS_IsArrayBufferView/JS_Is*Array test, or somehow
|
||||||
|
* be known that it would pass such a test: it is an ArrayBufferView or a
|
||||||
|
* wrapper of an ArrayBufferView, and the unwrapping will succeed.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API js::Scalar::Type JS_GetArrayBufferViewType(JSObject* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of elements in a typed array.
|
||||||
|
*
|
||||||
|
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
||||||
|
* be known that it would pass such a test: it is a typed array or a wrapper of
|
||||||
|
* a typed array, and the unwrapping will succeed.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API uint32_t JS_GetTypedArrayLength(JSObject* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the byte offset from the start of an ArrayBuffer to the start of a
|
||||||
|
* typed array view.
|
||||||
|
*
|
||||||
|
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
||||||
|
* be known that it would pass such a test: it is a typed array or a wrapper of
|
||||||
|
* a typed array, and the unwrapping will succeed.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API uint32_t JS_GetTypedArrayByteOffset(JSObject* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the byte length of a typed array.
|
||||||
|
*
|
||||||
|
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
||||||
|
* be known that it would pass such a test: it is a typed array or a wrapper of
|
||||||
|
* a typed array, and the unwrapping will succeed.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API uint32_t JS_GetTypedArrayByteLength(JSObject* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* More generic name for JS_GetTypedArrayByteLength to cover DataViews as well
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API uint32_t JS_GetArrayBufferViewByteLength(JSObject* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* More generic name for JS_GetTypedArrayByteOffset to cover DataViews as well
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API uint32_t JS_GetArrayBufferViewByteOffset(JSObject* obj);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return a pointer to the start of the data referenced by a typed array. The
|
||||||
|
* data is still owned by the typed array, and should not be modified on
|
||||||
|
* another thread. Furthermore, the pointer can become invalid on GC (if the
|
||||||
|
* data is small and fits inside the array's GC header), so callers must take
|
||||||
|
* care not to hold on across anything that could GC.
|
||||||
|
*
|
||||||
|
* |obj| must have passed a JS_Is*Array test, or somehow be known that it would
|
||||||
|
* pass such a test: it is a typed array or a wrapper of a typed array, and the
|
||||||
|
* unwrapping will succeed.
|
||||||
|
*
|
||||||
|
* |*isSharedMemory| will be set to true if the typed array maps a
|
||||||
|
* SharedArrayBuffer, otherwise to false.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern JS_FRIEND_API int8_t* JS_GetInt8ArrayData(JSObject* obj,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API uint8_t* JS_GetUint8ArrayData(JSObject* obj,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API uint8_t* JS_GetUint8ClampedArrayData(
|
||||||
|
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API int16_t* JS_GetInt16ArrayData(JSObject* obj,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API uint16_t* JS_GetUint16ArrayData(
|
||||||
|
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API int32_t* JS_GetInt32ArrayData(JSObject* obj,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API uint32_t* JS_GetUint32ArrayData(
|
||||||
|
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API float* JS_GetFloat32ArrayData(JSObject* obj,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
const JS::AutoRequireNoGC&);
|
||||||
|
extern JS_FRIEND_API double* JS_GetFloat64ArrayData(JSObject* obj,
|
||||||
|
bool* isSharedMemory,
|
||||||
|
const JS::AutoRequireNoGC&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as above, but for any kind of ArrayBufferView. Prefer the type-specific
|
||||||
|
* versions when possible.
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API void* JS_GetArrayBufferViewData(
|
||||||
|
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ArrayBuffer or SharedArrayBuffer underlying an ArrayBufferView.
|
||||||
|
* This may return a detached buffer. |obj| must be an object that would
|
||||||
|
* return true for JS_IsArrayBufferViewObject().
|
||||||
|
*/
|
||||||
|
extern JS_FRIEND_API JSObject* JS_GetArrayBufferViewBuffer(
|
||||||
|
JSContext* cx, JS::Handle<JSObject*> obj, bool* isSharedMemory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new DataView using the given buffer for storage. The given buffer
|
||||||
|
* must be an ArrayBuffer or SharedArrayBuffer (or a cross-compartment wrapper
|
||||||
|
* of either type), and the offset and length must fit within the bounds of the
|
||||||
|
* buffer. Currently, nullptr will be returned and an exception will be thrown
|
||||||
|
* if these conditions do not hold, but do not depend on that behavior.
|
||||||
|
*/
|
||||||
|
JS_FRIEND_API JSObject* JS_NewDataView(JSContext* cx,
|
||||||
|
JS::Handle<JSObject*> buffer,
|
||||||
|
uint32_t byteOffset, int32_t byteLength);
|
||||||
|
|
||||||
|
#endif // js_experimental_TypedData_h
|
|
@ -20,6 +20,7 @@ typedef uint32_t HashNumber;
|
||||||
#include "js/ContextOptions.h"
|
#include "js/ContextOptions.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
#include "js/Date.h"
|
#include "js/Date.h"
|
||||||
|
#include "js/experimental/TypedData.h"
|
||||||
#include "js/ForOfIterator.h"
|
#include "js/ForOfIterator.h"
|
||||||
#include "js/friend/WindowProxy.h"
|
#include "js/friend/WindowProxy.h"
|
||||||
#include "js/Initialization.h"
|
#include "js/Initialization.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "jit/AtomicOperations.h"
|
#include "jit/AtomicOperations.h"
|
||||||
#include "jit/InlinableNatives.h"
|
#include "jit/InlinableNatives.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewDataView
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
#include "js/Wrapper.h"
|
#include "js/Wrapper.h"
|
||||||
#include "util/Windows.h"
|
#include "util/Windows.h"
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "builtin/streams/ReadableStreamInternals.h" // js::ReadableStream{AddReadOrReadIntoRequest,CloseInternal,CreateReadResult,ErrorInternal,FulfillReadOrReadIntoRequest,GetNumReadRequests,HasDefaultReader}
|
#include "builtin/streams/ReadableStreamInternals.h" // js::ReadableStream{AddReadOrReadIntoRequest,CloseInternal,CreateReadResult,ErrorInternal,FulfillReadOrReadIntoRequest,GetNumReadRequests,HasDefaultReader}
|
||||||
#include "builtin/streams/ReadableStreamReader.h" // js::ReadableStream{,Default}Reader, js::CreateReadableStreamDefaultReader, js::ReadableStreamReaderGeneric{Cancel,Initialize,Release}, js::ReadableStreamDefaultReaderRead
|
#include "builtin/streams/ReadableStreamReader.h" // js::ReadableStream{,Default}Reader, js::CreateReadableStreamDefaultReader, js::ReadableStreamReaderGeneric{Cancel,Initialize,Release}, js::ReadableStreamDefaultReaderRead
|
||||||
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
|
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewData, JS_NewUint8Array{,WithBuffer}
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
#include "vm/Interpreter.h"
|
#include "vm/Interpreter.h"
|
||||||
#include "vm/JSContext.h"
|
#include "vm/JSContext.h"
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "js/CompileOptions.h"
|
#include "js/CompileOptions.h"
|
||||||
#include "js/Date.h"
|
#include "js/Date.h"
|
||||||
#include "js/Debug.h"
|
#include "js/Debug.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetObjectAsUint8Array
|
||||||
#include "js/friend/DumpFunctions.h" // js::Dump{Backtrace,Heap,Object}, JS::FormatStackDump, js::IgnoreNurseryObjects
|
#include "js/friend/DumpFunctions.h" // js::Dump{Backtrace,Heap,Object}, JS::FormatStackDump, js::IgnoreNurseryObjects
|
||||||
#include "js/friend/WindowProxy.h" // js::ToWindowProxyIfWindow
|
#include "js/friend/WindowProxy.h" // js::ToWindowProxyIfWindow
|
||||||
#include "js/HashTable.h"
|
#include "js/HashTable.h"
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "gc/Marking.h"
|
#include "gc/Marking.h"
|
||||||
#include "js/CharacterEncoding.h"
|
#include "js/CharacterEncoding.h"
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/Vector.h"
|
#include "js/Vector.h"
|
||||||
#include "util/StringBuffer.h"
|
#include "util/StringBuffer.h"
|
||||||
#include "vm/GlobalObject.h"
|
#include "vm/GlobalObject.h"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "gc/Allocator.h"
|
#include "gc/Allocator.h"
|
||||||
#include "gc/WeakMap.h"
|
#include "gc/WeakMap.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/ArrayBufferObject.h"
|
#include "vm/ArrayBufferObject.h"
|
||||||
#include "vm/JSObject.h"
|
#include "vm/JSObject.h"
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <stdint.h> // uint32_t, uintptr_t
|
#include <stdint.h> // uint32_t, uintptr_t
|
||||||
|
|
||||||
#include "jsapi.h" // js::AssertHeapIsIdle, JS_ReportErrorNumberASCII
|
#include "jsapi.h" // js::AssertHeapIsIdle, JS_ReportErrorNumberASCII
|
||||||
#include "jsfriendapi.h" // JS_GetArrayBufferViewData, js::IsObjectInContextCompartment, js::GetErrorMessage, JSMSG_*
|
#include "jsfriendapi.h" // js::GetErrorMessage, js::IsObjectInContextCompartment, JSMSG_*
|
||||||
#include "jstypes.h" // JS_{FRIEND,PUBLIC}_API
|
#include "jstypes.h" // JS_{FRIEND,PUBLIC}_API
|
||||||
|
|
||||||
#include "builtin/Stream.h" // js::ReadableByteStreamController{,Close}, js::ReadableStreamDefaultController{,Close}, js::StreamController
|
#include "builtin/Stream.h" // js::ReadableByteStreamController{,Close}, js::ReadableStreamDefaultController{,Close}, js::StreamController
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
#include "builtin/streams/ReadableStreamReader.h" // js::ReadableStream{,Default}Reader, js::ForAuthorCodeBool
|
#include "builtin/streams/ReadableStreamReader.h" // js::ReadableStream{,Default}Reader, js::ForAuthorCodeBool
|
||||||
#include "builtin/streams/StreamController.h" // js::StreamController
|
#include "builtin/streams/StreamController.h" // js::StreamController
|
||||||
#include "gc/Zone.h" // JS::Zone
|
#include "gc/Zone.h" // JS::Zone
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewData, JS_NewUint8Array
|
||||||
#include "js/GCAPI.h" // JS::AutoCheckCannotGC, JS::AutoSuppressGCAnalysis
|
#include "js/GCAPI.h" // JS::AutoCheckCannotGC, JS::AutoSuppressGCAnalysis
|
||||||
#include "js/RootingAPI.h" // JS::{,Mutable}Handle, JS::Rooted
|
#include "js/RootingAPI.h" // JS::{,Mutable}Handle, JS::Rooted
|
||||||
#include "js/Stream.h" // JS::ReadableStreamUnderlyingSource
|
#include "js/Stream.h" // JS::ReadableStreamUnderlyingSource
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject, JS::NewArrayObject
|
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject, JS::NewArrayObject
|
||||||
#include "js/ArrayBuffer.h" // JS::{IsArrayBufferObject,GetArrayBufferData,GetArrayBuffer{ByteLength,Data}}
|
#include "js/ArrayBuffer.h" // JS::{IsArrayBufferObject,GetArrayBufferData,GetArrayBuffer{ByteLength,Data}}
|
||||||
#include "js/CharacterEncoding.h"
|
#include "js/CharacterEncoding.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferView{Type,Data}, JS_GetTypedArrayByteLength, JS_IsArrayBufferViewObject, JS_IsTypedArrayObject
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
#include "js/SharedArrayBuffer.h" // JS::{GetSharedArrayBuffer{ByteLength,Data},IsSharedArrayBufferObject}
|
#include "js/SharedArrayBuffer.h" // JS::{GetSharedArrayBuffer{ByteLength,Data},IsSharedArrayBufferObject}
|
||||||
#include "js/StableStringChars.h"
|
#include "js/StableStringChars.h"
|
||||||
|
|
|
@ -15,12 +15,13 @@
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
|
|
||||||
#include "jsapi.h" // for JS_ReportErrorNumberASCII, JS_CopyStringCharsZ
|
#include "jsapi.h" // for JS_ReportErrorNumberASCII, JS_CopyStringCharsZ
|
||||||
#include "jsfriendapi.h" // for GetErrorMessage, JS_NewUint8Array
|
|
||||||
|
|
||||||
#include "debugger/Debugger.h" // for DebuggerSourceReferent, Debugger
|
#include "debugger/Debugger.h" // for DebuggerSourceReferent, Debugger
|
||||||
#include "debugger/Script.h" // for DebuggerScript
|
#include "debugger/Script.h" // for DebuggerScript
|
||||||
#include "gc/Tracer.h" // for TraceManuallyBarrieredCrossCompartmentEdge
|
#include "gc/Tracer.h" // for TraceManuallyBarrieredCrossCompartmentEdge
|
||||||
#include "js/CompilationAndEvaluation.h" // for Compile
|
#include "js/CompilationAndEvaluation.h" // for Compile
|
||||||
|
#include "js/experimental/TypedData.h" // for JS_NewUint8Array
|
||||||
|
#include "js/friend/ErrorMessages.h" // for GetErrorMessage, JSMSG_*
|
||||||
#include "vm/BytecodeUtil.h" // for JSDVG_SEARCH_STACK
|
#include "vm/BytecodeUtil.h" // for JSDVG_SEARCH_STACK
|
||||||
#include "vm/JSContext.h" // for JSContext (ptr only)
|
#include "vm/JSContext.h" // for JSContext (ptr only)
|
||||||
#include "vm/JSObject.h" // for JSObject, RequireObject
|
#include "vm/JSObject.h" // for JSObject, RequireObject
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "jit/InlinableNatives.h"
|
#include "jit/InlinableNatives.h"
|
||||||
#include "jit/Ion.h" // IsIonEnabled
|
#include "jit/Ion.h" // IsIonEnabled
|
||||||
#include "js/friend/WindowProxy.h" // js::IsWindow, js::IsWindowProxy, js::ToWindowIfWindowProxy
|
#include "js/friend/WindowProxy.h" // js::IsWindow, js::IsWindowProxy, js::ToWindowIfWindowProxy
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/Unicode.h"
|
#include "util/Unicode.h"
|
||||||
#include "vm/PlainObject.h" // js::PlainObject
|
#include "vm/PlainObject.h" // js::PlainObject
|
||||||
#include "vm/SelfHosting.h"
|
#include "vm/SelfHosting.h"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "jit/ICState.h"
|
#include "jit/ICState.h"
|
||||||
#include "jit/MacroAssembler.h"
|
#include "jit/MacroAssembler.h"
|
||||||
#include "jit/Simulator.h"
|
#include "jit/Simulator.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/Iteration.h"
|
#include "vm/Iteration.h"
|
||||||
#include "vm/Shape.h"
|
#include "vm/Shape.h"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "jit/IonIC.h"
|
#include "jit/IonIC.h"
|
||||||
#include "jit/SharedICHelpers.h"
|
#include "jit/SharedICHelpers.h"
|
||||||
#include "jit/SharedICRegisters.h"
|
#include "jit/SharedICRegisters.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "proxy/Proxy.h"
|
#include "proxy/Proxy.h"
|
||||||
#include "vm/ArrayBufferObject.h"
|
#include "vm/ArrayBufferObject.h"
|
||||||
#include "vm/ArrayBufferViewObject.h"
|
#include "vm/ArrayBufferViewObject.h"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "jit/CacheIR.h"
|
#include "jit/CacheIR.h"
|
||||||
#include "jit/JitOptions.h"
|
#include "jit/JitOptions.h"
|
||||||
#include "jit/SharedICRegisters.h"
|
#include "jit/SharedICRegisters.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
namespace jit {
|
namespace jit {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
# include "jsmath.h"
|
# include "jsmath.h"
|
||||||
|
|
||||||
|
# include "js/ScalarType.h" // js::Scalar::Type
|
||||||
# include "util/Text.h"
|
# include "util/Text.h"
|
||||||
# include "vm/JSFunction.h"
|
# include "vm/JSFunction.h"
|
||||||
# include "vm/JSObject.h"
|
# include "vm/JSObject.h"
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "jit/VMFunctions.h"
|
#include "jit/VMFunctions.h"
|
||||||
#include "jit/WarpSnapshot.h"
|
#include "jit/WarpSnapshot.h"
|
||||||
#include "js/RegExpFlags.h" // JS::RegExpFlag
|
#include "js/RegExpFlags.h" // JS::RegExpFlag
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/CheckedArithmetic.h"
|
#include "util/CheckedArithmetic.h"
|
||||||
#include "util/Unicode.h"
|
#include "util/Unicode.h"
|
||||||
#include "vm/ArrayBufferViewObject.h"
|
#include "vm/ArrayBufferViewObject.h"
|
||||||
|
|
|
@ -7,12 +7,11 @@
|
||||||
#ifndef jit_CodeGenerator_h
|
#ifndef jit_CodeGenerator_h
|
||||||
#define jit_CodeGenerator_h
|
#define jit_CodeGenerator_h
|
||||||
|
|
||||||
#include "jsfriendapi.h"
|
|
||||||
|
|
||||||
#include "jit/CacheIR.h"
|
#include "jit/CacheIR.h"
|
||||||
#if defined(JS_ION_PERF)
|
#if defined(JS_ION_PERF)
|
||||||
# include "jit/PerfSpewer.h"
|
# include "jit/PerfSpewer.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
#if defined(JS_CODEGEN_X86)
|
#if defined(JS_CODEGEN_X86)
|
||||||
# include "jit/x86/CodeGenerator-x86.h"
|
# include "jit/x86/CodeGenerator-x86.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "jit/JitSpewer.h"
|
#include "jit/JitSpewer.h"
|
||||||
#include "jit/Lowering.h"
|
#include "jit/Lowering.h"
|
||||||
#include "jit/MIRGraph.h"
|
#include "jit/MIRGraph.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/CheckedArithmetic.h"
|
#include "util/CheckedArithmetic.h"
|
||||||
#include "vm/ArgumentsObject.h"
|
#include "vm/ArgumentsObject.h"
|
||||||
#include "vm/BytecodeIterator.h"
|
#include "vm/BytecodeIterator.h"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "jit/MIRGenerator.h"
|
#include "jit/MIRGenerator.h"
|
||||||
#include "jit/MIRGraph.h"
|
#include "jit/MIRGraph.h"
|
||||||
#include "jit/TIOracle.h"
|
#include "jit/TIOracle.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/SharedStencil.h" // GCThingIndex
|
#include "vm/SharedStencil.h" // GCThingIndex
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "jsfriendapi.h"
|
|
||||||
#include "jstypes.h"
|
#include "jstypes.h"
|
||||||
|
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
#include "vm/StringType.h"
|
#include "vm/StringType.h"
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "jit/MIR.h"
|
#include "jit/MIR.h"
|
||||||
#include "jit/MIRGraph.h"
|
#include "jit/MIRGraph.h"
|
||||||
#include "js/RegExpFlags.h" // JS::RegExpFlag, JS::RegExpFlags
|
#include "js/RegExpFlags.h" // JS::RegExpFlag, JS::RegExpFlags
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/ArgumentsObject.h"
|
#include "vm/ArgumentsObject.h"
|
||||||
#include "vm/ArrayBufferObject.h"
|
#include "vm/ArrayBufferObject.h"
|
||||||
#include "vm/JSObject.h"
|
#include "vm/JSObject.h"
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "jit/MIRGraph.h"
|
#include "jit/MIRGraph.h"
|
||||||
#include "jit/RangeAnalysis.h"
|
#include "jit/RangeAnalysis.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/Text.h"
|
#include "util/Text.h"
|
||||||
#include "util/Unicode.h"
|
#include "util/Unicode.h"
|
||||||
#include "vm/PlainObject.h" // js::PlainObject
|
#include "vm/PlainObject.h" // js::PlainObject
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "jit/TIOracle.h"
|
#include "jit/TIOracle.h"
|
||||||
#include "jit/TypePolicy.h"
|
#include "jit/TypePolicy.h"
|
||||||
#include "js/HeapAPI.h"
|
#include "js/HeapAPI.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/ArrayObject.h"
|
#include "vm/ArrayObject.h"
|
||||||
#include "vm/EnvironmentObject.h"
|
#include "vm/EnvironmentObject.h"
|
||||||
#include "vm/FunctionFlags.h" // js::FunctionFlags
|
#include "vm/FunctionFlags.h" // js::FunctionFlags
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "jit/Simulator.h"
|
#include "jit/Simulator.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
#include "js/Printf.h"
|
#include "js/Printf.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/ArrayBufferViewObject.h"
|
#include "vm/ArrayBufferViewObject.h"
|
||||||
#include "vm/FunctionFlags.h" // js::FunctionFlags
|
#include "vm/FunctionFlags.h" // js::FunctionFlags
|
||||||
#include "vm/TraceLogging.h"
|
#include "vm/TraceLogging.h"
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "jit/JitRealm.h"
|
#include "jit/JitRealm.h"
|
||||||
#include "jit/TemplateObject.h"
|
#include "jit/TemplateObject.h"
|
||||||
#include "jit/VMFunctions.h"
|
#include "jit/VMFunctions.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/Memory.h"
|
#include "util/Memory.h"
|
||||||
#include "vm/ProxyObject.h"
|
#include "vm/ProxyObject.h"
|
||||||
#include "vm/Shape.h"
|
#include "vm/Shape.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "jit/MIRGenerator.h"
|
#include "jit/MIRGenerator.h"
|
||||||
#include "jit/MIRGraph.h"
|
#include "jit/MIRGraph.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/CheckedArithmetic.h"
|
#include "util/CheckedArithmetic.h"
|
||||||
#include "vm/ArgumentsObject.h"
|
#include "vm/ArgumentsObject.h"
|
||||||
#include "vm/TypedArrayObject.h"
|
#include "vm/TypedArrayObject.h"
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "jit/Lowering.h"
|
#include "jit/Lowering.h"
|
||||||
#include "jit/MIR.h"
|
#include "jit/MIR.h"
|
||||||
#include "jit/MIRGraph.h"
|
#include "jit/MIRGraph.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
#include "jit/shared/Lowering-shared-inl.h"
|
#include "jit/shared/Lowering-shared-inl.h"
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "jit/IonTypes.h"
|
#include "jit/IonTypes.h"
|
||||||
#include "jit/JitAllocPolicy.h"
|
#include "jit/JitAllocPolicy.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
namespace jit {
|
namespace jit {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "jit/WarpBuilder.h"
|
#include "jit/WarpBuilder.h"
|
||||||
#include "jit/WarpBuilderShared.h"
|
#include "jit/WarpBuilderShared.h"
|
||||||
#include "jit/WarpSnapshot.h"
|
#include "jit/WarpSnapshot.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
using namespace js;
|
using namespace js;
|
||||||
using namespace js::jit;
|
using namespace js::jit;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "jit/MIR.h"
|
#include "jit/MIR.h"
|
||||||
#include "jit/MIRGraph.h"
|
#include "jit/MIRGraph.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/JSContext.h"
|
#include "vm/JSContext.h"
|
||||||
#include "vm/Realm.h"
|
#include "vm/Realm.h"
|
||||||
#include "vm/Shape.h"
|
#include "vm/Shape.h"
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "jit/arm/Assembler-arm.h"
|
#include "jit/arm/Assembler-arm.h"
|
||||||
#include "jit/shared/CodeGenerator-shared.h"
|
#include "jit/shared/CodeGenerator-shared.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
namespace jit {
|
namespace jit {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "jit/JitFrames.h"
|
#include "jit/JitFrames.h"
|
||||||
#include "jit/MacroAssembler.h"
|
#include "jit/MacroAssembler.h"
|
||||||
#include "jit/MoveEmitter.h"
|
#include "jit/MoveEmitter.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/Memory.h"
|
#include "util/Memory.h"
|
||||||
#include "vm/JitActivation.h" // js::jit::JitActivation
|
#include "vm/JitActivation.h" // js::jit::JitActivation
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "jit/Label.h"
|
#include "jit/Label.h"
|
||||||
#include "jit/Registers.h"
|
#include "jit/Registers.h"
|
||||||
#include "jit/RegisterSets.h"
|
#include "jit/RegisterSets.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/HelperThreads.h"
|
#include "vm/HelperThreads.h"
|
||||||
#include "wasm/WasmTypes.h"
|
#include "wasm/WasmTypes.h"
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "jit/IonTypes.h"
|
#include "jit/IonTypes.h"
|
||||||
#include "jit/MacroAssembler.h"
|
#include "jit/MacroAssembler.h"
|
||||||
#include "jit/RegisterSets.h"
|
#include "jit/RegisterSets.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/Poison.h"
|
#include "util/Poison.h"
|
||||||
|
|
||||||
#include "jit/MacroAssembler-inl.h"
|
#include "jit/MacroAssembler-inl.h"
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "jit/CodeGenerator.h"
|
#include "jit/CodeGenerator.h"
|
||||||
#include "jit/MIR.h"
|
#include "jit/MIR.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
#include "jit/MacroAssembler-inl.h"
|
#include "jit/MacroAssembler-inl.h"
|
||||||
#include "jit/shared/CodeGenerator-shared-inl.h"
|
#include "jit/shared/CodeGenerator-shared-inl.h"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "jit/JitRealm.h"
|
#include "jit/JitRealm.h"
|
||||||
#include "jit/Linker.h"
|
#include "jit/Linker.h"
|
||||||
#include "jit/RangeAnalysis.h"
|
#include "jit/RangeAnalysis.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/TraceLogging.h"
|
#include "vm/TraceLogging.h"
|
||||||
|
|
||||||
#include "jit/MacroAssembler-inl.h"
|
#include "jit/MacroAssembler-inl.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#define jit_x86_shared_CodeGenerator_x86_shared_h
|
#define jit_x86_shared_CodeGenerator_x86_shared_h
|
||||||
|
|
||||||
#include "jit/shared/CodeGenerator-shared.h"
|
#include "jit/shared/CodeGenerator-shared.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
namespace jit {
|
namespace jit {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "jit/JitFrames.h"
|
#include "jit/JitFrames.h"
|
||||||
#include "jit/MacroAssembler.h"
|
#include "jit/MacroAssembler.h"
|
||||||
#include "jit/MoveEmitter.h"
|
#include "jit/MoveEmitter.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
|
|
||||||
#include "jit/MacroAssembler-inl.h"
|
#include "jit/MacroAssembler-inl.h"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "js/Array.h" // JS::NewArrayObject
|
#include "js/Array.h" // JS::NewArrayObject
|
||||||
#include "js/ArrayBuffer.h" // JS::{GetArrayBuffer{ByteLength,Data},IsArrayBufferObject,NewArrayBuffer{,WithContents},StealArrayBufferContents}
|
#include "js/ArrayBuffer.h" // JS::{GetArrayBuffer{ByteLength,Data},IsArrayBufferObject,NewArrayBuffer{,WithContents},StealArrayBufferContents}
|
||||||
#include "js/Exception.h"
|
#include "js/Exception.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_New{Int32,Uint8}ArrayWithBuffer
|
||||||
#include "js/MemoryFunctions.h"
|
#include "js/MemoryFunctions.h"
|
||||||
#include "jsapi-tests/tests.h"
|
#include "jsapi-tests/tests.h"
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
|
||||||
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
|
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferView{Type,ByteLength,Data}, JS_GetObjectAsArrayBufferView, JS_GetObjectAs{{Ui,I}nt{8,16,32},Float{32,64}}Array, JS_IsArrayBufferViewObject, JS_NewDataView, JS_New{{Ui,I}nt{8,16,32},Float{32,64},Uint8Clamped}Array
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "jsapi-tests/tests.h"
|
#include "jsapi-tests/tests.h"
|
||||||
#include "vm/ProxyObject.h"
|
#include "vm/ProxyObject.h"
|
||||||
#include "vm/Realm.h"
|
#include "vm/Realm.h"
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewData, JS_IsUint8Array
|
||||||
#include "js/Stream.h"
|
#include "js/Stream.h"
|
||||||
#include "jsapi-tests/tests.h"
|
#include "jsapi-tests/tests.h"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
|
||||||
#include "js/ArrayBuffer.h" // JS::{NewArrayBuffer,IsArrayBufferObject,GetArrayBuffer{ByteLength,Data}}
|
#include "js/ArrayBuffer.h" // JS::{NewArrayBuffer,IsArrayBufferObject,GetArrayBuffer{ByteLength,Data}}
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewBuffer, JS_GetTypedArray{Length,ByteOffset,ByteLength}, JS_Get{{Ui,I}nt{8,16,32},Float{32,64},Uint8Clamped}ArrayData, JS_IsTypedArrayObject, JS_New{{Ui,I}nt{8,16,32},Float{32,64},Uint8Clamped}Array{,FromArray,WithBuffer}
|
||||||
#include "js/SharedArrayBuffer.h" // JS::{NewSharedArrayBuffer,GetSharedArrayBufferData}
|
#include "js/SharedArrayBuffer.h" // JS::{NewSharedArrayBuffer,GetSharedArrayBufferData}
|
||||||
#include "jsapi-tests/tests.h"
|
#include "jsapi-tests/tests.h"
|
||||||
#include "vm/Realm.h"
|
#include "vm/Realm.h"
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
#include "js/ErrorReport.h" // JS::PrintError
|
#include "js/ErrorReport.h" // JS::PrintError
|
||||||
#include "js/Exception.h" // JS::ExceptionStack
|
#include "js/Exception.h" // JS::ExceptionStack
|
||||||
|
#include "js/experimental/TypedData.h" // JS_IsArrayBufferViewObject
|
||||||
#include "js/SavedFrameAPI.h"
|
#include "js/SavedFrameAPI.h"
|
||||||
#include "js/UniquePtr.h"
|
#include "js/UniquePtr.h"
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
|
|
|
@ -1030,489 +1030,12 @@ namespace js {
|
||||||
/* Implemented in vm/StructuredClone.cpp. */
|
/* Implemented in vm/StructuredClone.cpp. */
|
||||||
extern JS_FRIEND_API uint64_t GetSCOffset(JSStructuredCloneWriter* writer);
|
extern JS_FRIEND_API uint64_t GetSCOffset(JSStructuredCloneWriter* writer);
|
||||||
|
|
||||||
namespace Scalar {
|
|
||||||
|
|
||||||
// Scalar types that can appear in typed arrays and typed objects.
|
|
||||||
// The enum values must be kept in sync with:
|
|
||||||
// * the JS_SCALARTYPEREPR constants
|
|
||||||
// * the TYPEDARRAY_KIND constants
|
|
||||||
// * the SCTAG_TYPED_ARRAY constants
|
|
||||||
// * JS_FOR_EACH_TYPEDARRAY
|
|
||||||
// * JS_FOR_PROTOTYPES_
|
|
||||||
// * JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE
|
|
||||||
// * JIT compilation
|
|
||||||
enum Type {
|
|
||||||
Int8 = 0,
|
|
||||||
Uint8,
|
|
||||||
Int16,
|
|
||||||
Uint16,
|
|
||||||
Int32,
|
|
||||||
Uint32,
|
|
||||||
Float32,
|
|
||||||
Float64,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Special type that is a uint8_t, but assignments are clamped to [0, 256).
|
|
||||||
* Treat the raw data type as a uint8_t.
|
|
||||||
*/
|
|
||||||
Uint8Clamped,
|
|
||||||
|
|
||||||
BigInt64,
|
|
||||||
BigUint64,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Types that don't have their own TypedArray equivalent, for now.
|
|
||||||
*/
|
|
||||||
MaxTypedArrayViewType,
|
|
||||||
|
|
||||||
Int64,
|
|
||||||
Simd128,
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline size_t byteSize(Type atype) {
|
|
||||||
switch (atype) {
|
|
||||||
case Int8:
|
|
||||||
case Uint8:
|
|
||||||
case Uint8Clamped:
|
|
||||||
return 1;
|
|
||||||
case Int16:
|
|
||||||
case Uint16:
|
|
||||||
return 2;
|
|
||||||
case Int32:
|
|
||||||
case Uint32:
|
|
||||||
case Float32:
|
|
||||||
return 4;
|
|
||||||
case Int64:
|
|
||||||
case Float64:
|
|
||||||
case BigInt64:
|
|
||||||
case BigUint64:
|
|
||||||
return 8;
|
|
||||||
case Simd128:
|
|
||||||
return 16;
|
|
||||||
case MaxTypedArrayViewType:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MOZ_CRASH("invalid scalar type");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool isSignedIntType(Type atype) {
|
|
||||||
switch (atype) {
|
|
||||||
case Int8:
|
|
||||||
case Int16:
|
|
||||||
case Int32:
|
|
||||||
case Int64:
|
|
||||||
case BigInt64:
|
|
||||||
return true;
|
|
||||||
case Uint8:
|
|
||||||
case Uint8Clamped:
|
|
||||||
case Uint16:
|
|
||||||
case Uint32:
|
|
||||||
case Float32:
|
|
||||||
case Float64:
|
|
||||||
case BigUint64:
|
|
||||||
case Simd128:
|
|
||||||
return false;
|
|
||||||
case MaxTypedArrayViewType:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MOZ_CRASH("invalid scalar type");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool isBigIntType(Type atype) {
|
|
||||||
switch (atype) {
|
|
||||||
case BigInt64:
|
|
||||||
case BigUint64:
|
|
||||||
return true;
|
|
||||||
case Int8:
|
|
||||||
case Int16:
|
|
||||||
case Int32:
|
|
||||||
case Int64:
|
|
||||||
case Uint8:
|
|
||||||
case Uint8Clamped:
|
|
||||||
case Uint16:
|
|
||||||
case Uint32:
|
|
||||||
case Float32:
|
|
||||||
case Float64:
|
|
||||||
case Simd128:
|
|
||||||
return false;
|
|
||||||
case MaxTypedArrayViewType:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MOZ_CRASH("invalid scalar type");
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace Scalar */
|
|
||||||
} /* namespace js */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create a new typed array with nelements elements.
|
|
||||||
*
|
|
||||||
* These functions (except the WithBuffer variants) fill in the array with
|
|
||||||
* zeros.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt8Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint8Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint8ClampedArray(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt16Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint16Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt32Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint32Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewFloat32Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewFloat64Array(JSContext* cx,
|
|
||||||
uint32_t nelements);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create a new typed array and copy in values from the given object. The
|
|
||||||
* object is used as if it were an array; that is, the new array (if
|
|
||||||
* successfully created) will have length given by array.length, and its
|
|
||||||
* elements will be those specified by array[0], array[1], and so on, after
|
|
||||||
* conversion to the typed array element type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt8ArrayFromArray(JSContext* cx,
|
|
||||||
JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint8ArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint8ClampedArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt16ArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint16ArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt32ArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint32ArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewFloat32ArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewFloat64ArrayFromArray(
|
|
||||||
JSContext* cx, JS::HandleObject array);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create a new typed array using the given ArrayBuffer or
|
|
||||||
* SharedArrayBuffer for storage. The length value is optional; if -1
|
|
||||||
* is passed, enough elements to use up the remainder of the byte
|
|
||||||
* array is used as the default value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt8ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint8ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint8ClampedArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt16ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint16ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewInt32ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewUint32ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewBigInt64ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewBigUint64ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewFloat32ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_NewFloat64ArrayWithBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject arrayBuffer, uint32_t byteOffset,
|
|
||||||
int32_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether obj supports JS_GetTypedArray* APIs. Note that this may return
|
|
||||||
* false if a security wrapper is encountered that denies the unwrapping. If
|
|
||||||
* this test or one of the JS_Is*Array tests succeeds, then it is safe to call
|
|
||||||
* the various accessor JSAPI calls defined below.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API bool JS_IsTypedArrayObject(JSObject* obj);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether obj supports JS_GetArrayBufferView* APIs. Note that this may
|
|
||||||
* return false if a security wrapper is encountered that denies the
|
|
||||||
* unwrapping. If this test or one of the more specific tests succeeds, then it
|
|
||||||
* is safe to call the various ArrayBufferView accessor JSAPI calls defined
|
|
||||||
* below.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API bool JS_IsArrayBufferViewObject(JSObject* obj);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test for specific typed array types (ArrayBufferView subtypes)
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern JS_FRIEND_API bool JS_IsInt8Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsUint8Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsUint8ClampedArray(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsInt16Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsUint16Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsInt32Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsUint32Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsFloat32Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API bool JS_IsFloat64Array(JSObject* obj);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the isShared flag of a typed array, which denotes whether
|
|
||||||
* the underlying buffer is a SharedArrayBuffer.
|
|
||||||
*
|
|
||||||
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
|
||||||
* be known that it would pass such a test: it is a typed array or a wrapper of
|
|
||||||
* a typed array, and the unwrapping will succeed.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API bool JS_GetTypedArraySharedness(JSObject* obj);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test for specific typed array types (ArrayBufferView subtypes) and return
|
|
||||||
* the unwrapped object if so, else nullptr. Never throws.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace js {
|
|
||||||
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapInt8Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapUint8Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapUint8ClampedArray(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapInt16Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapUint16Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapInt32Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapUint32Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapBigInt64Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapBigUint64Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapFloat32Array(JSObject* obj);
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapFloat64Array(JSObject* obj);
|
|
||||||
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapArrayBufferView(JSObject* obj);
|
|
||||||
|
|
||||||
extern JS_FRIEND_API JSObject* UnwrapReadableStream(JSObject* obj);
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Int8ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Uint8ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Uint8ClampedArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Int16ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Uint16ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Int32ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Uint32ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const BigInt64ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const BigUint64ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Float32ArrayClassPtr;
|
|
||||||
extern JS_FRIEND_DATA const JSClass* const Float64ArrayClassPtr;
|
|
||||||
|
|
||||||
const size_t TypedArrayLengthSlot = 1;
|
|
||||||
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
#define JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Type, type) \
|
|
||||||
inline void Get##Type##ArrayLengthAndData( \
|
|
||||||
JSObject* obj, uint32_t* length, bool* isSharedMemory, type** data) { \
|
|
||||||
MOZ_ASSERT(GetObjectClass(obj) == detail::Type##ArrayClassPtr); \
|
|
||||||
const JS::Value& lenSlot = \
|
|
||||||
GetReservedSlot(obj, detail::TypedArrayLengthSlot); \
|
|
||||||
*length = mozilla::AssertedCast<uint32_t>(lenSlot.toInt32()); \
|
|
||||||
*isSharedMemory = JS_GetTypedArraySharedness(obj); \
|
|
||||||
*data = static_cast<type*>(GetObjectPrivate(obj)); \
|
|
||||||
}
|
|
||||||
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Int8, int8_t)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint8, uint8_t)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint8Clamped, uint8_t)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Int16, int16_t)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint16, uint16_t)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Int32, int32_t)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Uint32, uint32_t)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Float32, float)
|
|
||||||
JS_DEFINE_DATA_AND_LENGTH_ACCESSOR(Float64, double)
|
|
||||||
|
|
||||||
#undef JS_DEFINE_DATA_AND_LENGTH_ACCESSOR
|
|
||||||
|
|
||||||
// This one isn't inlined because it's rather tricky (by dint of having to deal
|
|
||||||
// with a dozen-plus classes and varying slot layouts.
|
|
||||||
extern JS_FRIEND_API void GetArrayBufferViewLengthAndData(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
uint8_t** data);
|
|
||||||
|
|
||||||
} // namespace js
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unwrap Typed arrays all at once. Return nullptr without throwing if the
|
|
||||||
* object cannot be viewed as the correct typed array, or the typed array
|
|
||||||
* object on success, filling both outparameters.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsInt8Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
int8_t** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint8Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
uint8_t** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint8ClampedArray(
|
|
||||||
JSObject* obj, uint32_t* length, bool* isSharedMemory, uint8_t** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsInt16Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
int16_t** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint16Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
uint16_t** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsInt32Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
int32_t** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsUint32Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
uint32_t** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsFloat32Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
float** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsFloat64Array(JSObject* obj,
|
|
||||||
uint32_t* length,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
double** data);
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetObjectAsArrayBufferView(
|
|
||||||
JSObject* obj, uint32_t* length, bool* isSharedMemory, uint8_t** data);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the type of elements in a typed array, or MaxTypedArrayViewType if a
|
|
||||||
* DataView.
|
|
||||||
*
|
|
||||||
* |obj| must have passed a JS_IsArrayBufferView/JS_Is*Array test, or somehow
|
|
||||||
* be known that it would pass such a test: it is an ArrayBufferView or a
|
|
||||||
* wrapper of an ArrayBufferView, and the unwrapping will succeed.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API js::Scalar::Type JS_GetArrayBufferViewType(JSObject* obj);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the number of elements in a typed array.
|
|
||||||
*
|
|
||||||
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
|
||||||
* be known that it would pass such a test: it is a typed array or a wrapper of
|
|
||||||
* a typed array, and the unwrapping will succeed.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API uint32_t JS_GetTypedArrayLength(JSObject* obj);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the byte offset from the start of an ArrayBuffer to the start of a
|
|
||||||
* typed array view.
|
|
||||||
*
|
|
||||||
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
|
||||||
* be known that it would pass such a test: it is a typed array or a wrapper of
|
|
||||||
* a typed array, and the unwrapping will succeed.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API uint32_t JS_GetTypedArrayByteOffset(JSObject* obj);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the byte length of a typed array.
|
|
||||||
*
|
|
||||||
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
|
|
||||||
* be known that it would pass such a test: it is a typed array or a wrapper of
|
|
||||||
* a typed array, and the unwrapping will succeed.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API uint32_t JS_GetTypedArrayByteLength(JSObject* obj);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* More generic name for JS_GetTypedArrayByteLength to cover DataViews as well
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API uint32_t JS_GetArrayBufferViewByteLength(JSObject* obj);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* More generic name for JS_GetTypedArrayByteOffset to cover DataViews as well
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API uint32_t JS_GetArrayBufferViewByteOffset(JSObject* obj);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return a pointer to the start of the data referenced by a typed array. The
|
|
||||||
* data is still owned by the typed array, and should not be modified on
|
|
||||||
* another thread. Furthermore, the pointer can become invalid on GC (if the
|
|
||||||
* data is small and fits inside the array's GC header), so callers must take
|
|
||||||
* care not to hold on across anything that could GC.
|
|
||||||
*
|
|
||||||
* |obj| must have passed a JS_Is*Array test, or somehow be known that it would
|
|
||||||
* pass such a test: it is a typed array or a wrapper of a typed array, and the
|
|
||||||
* unwrapping will succeed.
|
|
||||||
*
|
|
||||||
* |*isSharedMemory| will be set to true if the typed array maps a
|
|
||||||
* SharedArrayBuffer, otherwise to false.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern JS_FRIEND_API int8_t* JS_GetInt8ArrayData(JSObject* obj,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API uint8_t* JS_GetUint8ArrayData(JSObject* obj,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API uint8_t* JS_GetUint8ClampedArrayData(
|
|
||||||
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API int16_t* JS_GetInt16ArrayData(JSObject* obj,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API uint16_t* JS_GetUint16ArrayData(
|
|
||||||
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API int32_t* JS_GetInt32ArrayData(JSObject* obj,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API uint32_t* JS_GetUint32ArrayData(
|
|
||||||
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API float* JS_GetFloat32ArrayData(JSObject* obj,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
const JS::AutoRequireNoGC&);
|
|
||||||
extern JS_FRIEND_API double* JS_GetFloat64ArrayData(JSObject* obj,
|
|
||||||
bool* isSharedMemory,
|
|
||||||
const JS::AutoRequireNoGC&);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as above, but for any kind of ArrayBufferView. Prefer the type-specific
|
|
||||||
* versions when possible.
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API void* JS_GetArrayBufferViewData(
|
|
||||||
JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the ArrayBuffer or SharedArrayBuffer underlying an ArrayBufferView.
|
|
||||||
* This may return a detached buffer. |obj| must be an object that would
|
|
||||||
* return true for JS_IsArrayBufferViewObject().
|
|
||||||
*/
|
|
||||||
extern JS_FRIEND_API JSObject* JS_GetArrayBufferViewBuffer(
|
|
||||||
JSContext* cx, JS::HandleObject obj, bool* isSharedMemory);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new DataView using the given buffer for storage. The given buffer
|
|
||||||
* must be an ArrayBuffer or SharedArrayBuffer (or a cross-compartment wrapper
|
|
||||||
* of either type), and the offset and length must fit within the bounds of the
|
|
||||||
* buffer. Currently, nullptr will be returned and an exception will be thrown
|
|
||||||
* if these conditions do not hold, but do not depend on that behavior.
|
|
||||||
*/
|
|
||||||
JS_FRIEND_API JSObject* JS_NewDataView(JSContext* cx, JS::HandleObject buffer,
|
|
||||||
uint32_t byteOffset, int32_t byteLength);
|
|
||||||
|
|
||||||
namespace js {
|
|
||||||
namespace jit {
|
namespace jit {
|
||||||
|
|
||||||
enum class InlinableNative : uint16_t;
|
enum class InlinableNative : uint16_t;
|
||||||
|
|
||||||
} // namespace jit
|
} // namespace jit
|
||||||
|
|
||||||
} // namespace js
|
} // namespace js
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -178,6 +178,7 @@ EXPORTS.js += [
|
||||||
'../public/Result.h',
|
'../public/Result.h',
|
||||||
'../public/RootingAPI.h',
|
'../public/RootingAPI.h',
|
||||||
'../public/SavedFrameAPI.h',
|
'../public/SavedFrameAPI.h',
|
||||||
|
'../public/ScalarType.h',
|
||||||
'../public/SharedArrayBuffer.h',
|
'../public/SharedArrayBuffer.h',
|
||||||
'../public/SliceBudget.h',
|
'../public/SliceBudget.h',
|
||||||
'../public/SourceText.h',
|
'../public/SourceText.h',
|
||||||
|
@ -220,6 +221,7 @@ EXPORTS.js += [
|
||||||
# We expose them as-is, buyer beware.
|
# We expose them as-is, buyer beware.
|
||||||
EXPORTS.js.experimental += [
|
EXPORTS.js.experimental += [
|
||||||
'../public/experimental/SourceHook.h',
|
'../public/experimental/SourceHook.h',
|
||||||
|
'../public/experimental/TypedData.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Friend APIs are APIs that either basically SpiderMonkey-internal, or their
|
# Friend APIs are APIs that either basically SpiderMonkey-internal, or their
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "gc/FreeOp.h"
|
#include "gc/FreeOp.h"
|
||||||
#include "js/CharacterEncoding.h"
|
#include "js/CharacterEncoding.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewUint8Array
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
#include "js/Wrapper.h"
|
#include "js/Wrapper.h"
|
||||||
#include "shell/jsshell.h"
|
#include "shell/jsshell.h"
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
#include "js/ErrorReport.h" // JS::PrintError
|
#include "js/ErrorReport.h" // JS::PrintError
|
||||||
#include "js/Exception.h" // JS::StealPendingExceptionStack
|
#include "js/Exception.h" // JS::StealPendingExceptionStack
|
||||||
#include "js/experimental/SourceHook.h" // js::{Set,Forget,}SourceHook
|
#include "js/experimental/SourceHook.h" // js::{Set,Forget,}SourceHook
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewUint8Array
|
||||||
#include "js/friend/DumpFunctions.h" // JS::FormatStackDump
|
#include "js/friend/DumpFunctions.h" // JS::FormatStackDump
|
||||||
#include "js/friend/StackLimits.h" // js::CheckRecursionLimitConservative
|
#include "js/friend/StackLimits.h" // js::CheckRecursionLimitConservative
|
||||||
#include "js/friend/WindowProxy.h" // js::IsWindowProxy, js::SetWindowProxyClass, js::ToWindowProxyIfWindow, js::ToWindowIfWindowProxy
|
#include "js/friend/WindowProxy.h" // js::IsWindowProxy, js::SetWindowProxyClass, js::ToWindowProxyIfWindow, js::ToWindowIfWindowProxy
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "js/CompileOptions.h" // JS::CompileOptions
|
#include "js/CompileOptions.h" // JS::CompileOptions
|
||||||
#include "js/ErrorReport.h" // JS::PrintError
|
#include "js/ErrorReport.h" // JS::PrintError
|
||||||
#include "js/Exception.h" // JS::StealPendingExceptionStack
|
#include "js/Exception.h" // JS::StealPendingExceptionStack
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetUint8ClampedArrayData, JS_NewUint8ClampedArray
|
||||||
#include "js/RootingAPI.h" // JS::Rooted
|
#include "js/RootingAPI.h" // JS::Rooted
|
||||||
#include "js/SourceText.h" // JS::Source{Ownership,Text}
|
#include "js/SourceText.h" // JS::Source{Ownership,Text}
|
||||||
#include "js/Value.h" // JS::Value
|
#include "js/Value.h" // JS::Value
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "gc/Memory.h"
|
#include "gc/Memory.h"
|
||||||
#include "js/ArrayBuffer.h"
|
#include "js/ArrayBuffer.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_IsArrayBufferViewObject
|
||||||
#include "js/MemoryMetrics.h"
|
#include "js/MemoryMetrics.h"
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
#include "js/SharedArrayBuffer.h"
|
#include "js/SharedArrayBuffer.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "builtin/DataViewObject.h"
|
#include "builtin/DataViewObject.h"
|
||||||
#include "gc/Nursery.h"
|
#include "gc/Nursery.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferView{Data,Buffer,Length,ByteOffset}, JS_GetObjectAsArrayBufferView, JS_IsArrayBufferViewObject
|
||||||
#include "js/SharedArrayBuffer.h"
|
#include "js/SharedArrayBuffer.h"
|
||||||
#include "vm/JSContext.h"
|
#include "vm/JSContext.h"
|
||||||
#include "vm/TypedArrayObject.h"
|
#include "vm/TypedArrayObject.h"
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "js/ErrorReport.h"
|
#include "js/ErrorReport.h"
|
||||||
#include "js/PropertyDescriptor.h"
|
#include "js/PropertyDescriptor.h"
|
||||||
#include "js/RootingAPI.h"
|
#include "js/RootingAPI.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/TypeDecls.h"
|
#include "js/TypeDecls.h"
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
#include "vm/JSContext.h"
|
#include "vm/JSContext.h"
|
||||||
|
|
|
@ -51,8 +51,10 @@
|
||||||
#include "js/Date.h"
|
#include "js/Date.h"
|
||||||
#include "js/ErrorReport.h" // JS::PrintError
|
#include "js/ErrorReport.h" // JS::PrintError
|
||||||
#include "js/Exception.h"
|
#include "js/Exception.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewType
|
||||||
#include "js/Modules.h" // JS::GetModulePrivate
|
#include "js/Modules.h" // JS::GetModulePrivate
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/SourceText.h" // JS::SourceText
|
#include "js/SourceText.h" // JS::SourceText
|
||||||
#include "js/StableStringChars.h"
|
#include "js/StableStringChars.h"
|
||||||
#include "js/Warnings.h" // JS::{,Set}WarningReporter
|
#include "js/Warnings.h" // JS::{,Set}WarningReporter
|
||||||
|
|
|
@ -47,8 +47,10 @@
|
||||||
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject
|
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject
|
||||||
#include "js/ArrayBuffer.h" // JS::{ArrayBufferHasData,DetachArrayBuffer,IsArrayBufferObject,New{,Mapped}ArrayBufferWithContents,ReleaseMappedArrayBufferContents}
|
#include "js/ArrayBuffer.h" // JS::{ArrayBufferHasData,DetachArrayBuffer,IsArrayBufferObject,New{,Mapped}ArrayBufferWithContents,ReleaseMappedArrayBufferContents}
|
||||||
#include "js/Date.h"
|
#include "js/Date.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewDataView, JS_New{{Ui,I}nt{8,16,32},Float{32,64},Uint8Clamped,Big{Ui,I}nt64}ArrayWithBuffer
|
||||||
#include "js/GCHashTable.h"
|
#include "js/GCHashTable.h"
|
||||||
#include "js/RegExpFlags.h" // JS::RegExpFlag, JS::RegExpFlags
|
#include "js/RegExpFlags.h" // JS::RegExpFlag, JS::RegExpFlags
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/SharedArrayBuffer.h" // JS::IsSharedArrayBufferObject
|
#include "js/SharedArrayBuffer.h" // JS::IsSharedArrayBufferObject
|
||||||
#include "js/Wrapper.h"
|
#include "js/Wrapper.h"
|
||||||
#include "vm/BigIntType.h"
|
#include "vm/BigIntType.h"
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "jit/IonAnalysis.h"
|
#include "jit/IonAnalysis.h"
|
||||||
#include "jit/JitRealm.h"
|
#include "jit/JitRealm.h"
|
||||||
#include "js/MemoryMetrics.h"
|
#include "js/MemoryMetrics.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/UniquePtr.h"
|
#include "js/UniquePtr.h"
|
||||||
#include "util/DiagnosticAssertions.h"
|
#include "util/DiagnosticAssertions.h"
|
||||||
#include "util/Poison.h"
|
#include "util/Poison.h"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "jit/JitOptions.h"
|
#include "jit/JitOptions.h"
|
||||||
#include "js/GCAnnotations.h" // JS_HAZ_GC_POINTER
|
#include "js/GCAnnotations.h" // JS_HAZ_GC_POINTER
|
||||||
#include "js/Id.h"
|
#include "js/Id.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/TracingAPI.h" // JSTracer
|
#include "js/TracingAPI.h" // JSTracer
|
||||||
#include "js/TypeDecls.h" // IF_BIGINT
|
#include "js/TypeDecls.h" // IF_BIGINT
|
||||||
#include "js/Utility.h" // UniqueChars
|
#include "js/Utility.h" // UniqueChars
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "builtin/Array.h"
|
#include "builtin/Array.h"
|
||||||
#include "jit/AtomicOperations.h"
|
#include "jit/AtomicOperations.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
#include "util/Memory.h"
|
#include "util/Memory.h"
|
||||||
#include "vm/BigIntType.h"
|
#include "vm/BigIntType.h"
|
||||||
|
|
|
@ -31,7 +31,9 @@
|
||||||
#include "gc/MaybeRooted.h"
|
#include "gc/MaybeRooted.h"
|
||||||
#include "jit/InlinableNatives.h"
|
#include "jit/InlinableNatives.h"
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewType, JS_GetTypedArray{Length,ByteOffset,ByteLength}, JS_IsTypedArrayObject
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/UniquePtr.h"
|
#include "js/UniquePtr.h"
|
||||||
#include "js/Wrapper.h"
|
#include "js/Wrapper.h"
|
||||||
#include "util/Text.h"
|
#include "util/Text.h"
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
#include "gc/Barrier.h"
|
#include "gc/Barrier.h"
|
||||||
#include "gc/MaybeRooted.h"
|
#include "gc/MaybeRooted.h"
|
||||||
#include "js/Class.h"
|
#include "js/Class.h"
|
||||||
|
#include "js/experimental/TypedData.h" // js::detail::TypedArrayLengthSlot
|
||||||
#include "js/Result.h"
|
#include "js/Result.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "vm/ArrayBufferObject.h"
|
#include "vm/ArrayBufferObject.h"
|
||||||
#include "vm/ArrayBufferViewObject.h"
|
#include "vm/ArrayBufferViewObject.h"
|
||||||
#include "vm/JSObject.h"
|
#include "vm/JSObject.h"
|
||||||
|
@ -46,7 +48,7 @@ namespace js {
|
||||||
class TypedArrayObject : public ArrayBufferViewObject {
|
class TypedArrayObject : public ArrayBufferViewObject {
|
||||||
public:
|
public:
|
||||||
static_assert(js::detail::TypedArrayLengthSlot == LENGTH_SLOT,
|
static_assert(js::detail::TypedArrayLengthSlot == LENGTH_SLOT,
|
||||||
"bad inlined constant in jsfriendapi.h");
|
"bad inlined constant in TypedData.h");
|
||||||
|
|
||||||
static bool sameBuffer(Handle<TypedArrayObject*> a,
|
static bool sameBuffer(Handle<TypedArrayObject*> a,
|
||||||
Handle<TypedArrayObject*> b) {
|
Handle<TypedArrayObject*> b) {
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "js/BuildId.h" // JS::BuildIdCharVector
|
#include "js/BuildId.h" // JS::BuildIdCharVector
|
||||||
#include "js/MemoryMetrics.h"
|
#include "js/MemoryMetrics.h"
|
||||||
#include "js/Printf.h"
|
#include "js/Printf.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "js/SourceText.h"
|
#include "js/SourceText.h"
|
||||||
#include "js/StableStringChars.h"
|
#include "js/StableStringChars.h"
|
||||||
#include "js/Wrapper.h"
|
#include "js/Wrapper.h"
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
# include "jit/mips-shared/Assembler-mips-shared.h"
|
# include "jit/mips-shared/Assembler-mips-shared.h"
|
||||||
# include "jit/mips64/Assembler-mips64.h"
|
# include "jit/mips64/Assembler-mips64.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "util/Memory.h"
|
#include "util/Memory.h"
|
||||||
#include "wasm/WasmGC.h"
|
#include "wasm/WasmGC.h"
|
||||||
#include "wasm/WasmGenerator.h"
|
#include "wasm/WasmGenerator.h"
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "jit/CodeGenerator.h"
|
#include "jit/CodeGenerator.h"
|
||||||
|
#include "js/ScalarType.h" // js::Scalar::Type
|
||||||
#include "wasm/WasmBaselineCompile.h"
|
#include "wasm/WasmBaselineCompile.h"
|
||||||
#include "wasm/WasmBuiltins.h"
|
#include "wasm/WasmBuiltins.h"
|
||||||
#include "wasm/WasmGC.h"
|
#include "wasm/WasmGC.h"
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "builtin/TypedObject.h"
|
#include "builtin/TypedObject.h"
|
||||||
#include "jit/JitOptions.h"
|
#include "jit/JitOptions.h"
|
||||||
#include "js/BuildId.h" // JS::BuildIdCharVector
|
#include "js/BuildId.h" // JS::BuildIdCharVector
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewUint8Array
|
||||||
#include "threading/LockGuard.h"
|
#include "threading/LockGuard.h"
|
||||||
#include "vm/PlainObject.h" // js::PlainObject
|
#include "vm/PlainObject.h" // js::PlainObject
|
||||||
#include "wasm/WasmBaselineCompile.h"
|
#include "wasm/WasmBaselineCompile.h"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject, JS::NewArrayObject
|
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject, JS::NewArrayObject
|
||||||
#include "js/CharacterEncoding.h"
|
#include "js/CharacterEncoding.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetArrayBufferViewType, JS_GetArrayBufferViewData, JS_GetTypedArrayLength, JS_IsTypedArrayObject
|
||||||
#include "js/MemoryFunctions.h"
|
#include "js/MemoryFunctions.h"
|
||||||
|
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "nsWrapperCacheInlines.h"
|
#include "nsWrapperCacheInlines.h"
|
||||||
#include "XPCLog.h"
|
#include "XPCLog.h"
|
||||||
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject
|
#include "js/Array.h" // JS::GetArrayLength, JS::IsArrayObject
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetTypedArrayLength, JS_IsTypedArrayObject
|
||||||
#include "js/MemoryFunctions.h"
|
#include "js/MemoryFunctions.h"
|
||||||
#include "js/Printf.h"
|
#include "js/Printf.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_GetTypedArrayLength
|
||||||
#include "js/friend/WindowProxy.h" // js::IsWindowProxy
|
#include "js/friend/WindowProxy.h" // js::IsWindowProxy
|
||||||
#include "js/PropertySpec.h"
|
#include "js/PropertySpec.h"
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "js/ArrayBuffer.h" // JS::GetArrayBufferByteLength,IsArrayBufferObject,NewArrayBufferWithContents,StealArrayBufferContents
|
#include "js/ArrayBuffer.h" // JS::GetArrayBufferByteLength,IsArrayBufferObject,NewArrayBufferWithContents,StealArrayBufferContents
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
|
#include "js/experimental/TypedData.h" // JS_NewUint8ArrayWithBuffer
|
||||||
#include "js/MemoryFunctions.h"
|
#include "js/MemoryFunctions.h"
|
||||||
#include "js/UniquePtr.h"
|
#include "js/UniquePtr.h"
|
||||||
#include "js/Utility.h"
|
#include "js/Utility.h"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче