зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1447442 - Part 7: More clean-up for typed arrays and array buffer views. r=jorendorff
--HG-- extra : rebase_source : ff2f577bc1ecca45df3afed524cf3e0b92f9852a
This commit is contained in:
Родитель
c58317ae7c
Коммит
3943196403
|
@ -6087,7 +6087,7 @@ CodeGenerator::visitNewTypedArray(LNewTypedArray* lir)
|
|||
ool->entry(), /*initContents*/true, /*convertDoubleElements*/false);
|
||||
|
||||
masm.initTypedArraySlots(objReg, tempReg, lengthReg, liveRegs, ool->entry(),
|
||||
ttemplate, TypedArrayLength::Fixed);
|
||||
ttemplate, MacroAssembler::TypedArrayLength::Fixed);
|
||||
|
||||
masm.bind(ool->rejoin());
|
||||
}
|
||||
|
@ -6113,7 +6113,7 @@ CodeGenerator::visitNewTypedArrayDynamicLength(LNewTypedArrayDynamicLength* lir)
|
|||
ool->entry(), /*initContents*/true, /*convertDoubleElements*/false);
|
||||
|
||||
masm.initTypedArraySlots(objReg, tempReg, lengthReg, liveRegs, ool->entry(),
|
||||
ttemplate, TypedArrayLength::Dynamic);
|
||||
ttemplate, MacroAssembler::TypedArrayLength::Dynamic);
|
||||
|
||||
masm.bind(ool->rejoin());
|
||||
}
|
||||
|
|
|
@ -6267,7 +6267,7 @@ PropertyReadNeedsTypeBarrier(CompilerConstraintList* constraints,
|
|||
}
|
||||
|
||||
if (!name && IsTypedArrayClass(key->clasp())) {
|
||||
Scalar::Type arrayType = Scalar::Type(key->clasp() - &TypedArrayObject::classes[0]);
|
||||
Scalar::Type arrayType = GetTypedArrayClassType(key->clasp());
|
||||
MIRType type = MIRTypeForTypedArrayRead(arrayType, true);
|
||||
if (observed->mightBeMIRType(type))
|
||||
return BarrierKind::NoBarrier;
|
||||
|
|
|
@ -2255,6 +2255,9 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
|
||||
void initGCThing(Register obj, Register temp, JSObject* templateObj,
|
||||
bool initContents = true, bool convertDoubleElements = false);
|
||||
|
||||
enum class TypedArrayLength { Fixed, Dynamic };
|
||||
|
||||
void initTypedArraySlots(Register obj, Register temp, Register lengthReg,
|
||||
LiveRegisterSet liveRegs, Label* fail,
|
||||
TypedArrayObject* templateObj, TypedArrayLength lengthKind);
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include "vm/SharedMem.h"
|
||||
#include "wasm/WasmTypes.h"
|
||||
|
||||
typedef struct JSProperty JSProperty;
|
||||
|
||||
namespace js {
|
||||
|
||||
class ArrayBufferViewObject;
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include "vm/ArrayBufferObject.h"
|
||||
#include "vm/JSObject.h"
|
||||
|
||||
typedef struct JSProperty JSProperty;
|
||||
|
||||
namespace js {
|
||||
|
||||
class FutexWaiter;
|
||||
|
|
|
@ -2340,7 +2340,7 @@ TemporaryTypeSet::getTypedArrayType(CompilerConstraintList* constraints,
|
|||
if (clasp && IsTypedArrayClass(clasp)) {
|
||||
if (sharedness)
|
||||
getTypedArraySharedness(constraints, sharedness);
|
||||
return (Scalar::Type) (clasp - &TypedArrayObject::classes[0]);
|
||||
return GetTypedArrayClassType(clasp);
|
||||
}
|
||||
return Scalar::MaxTypedArrayViewType;
|
||||
}
|
||||
|
|
|
@ -1405,37 +1405,12 @@ JS_FOR_EACH_TYPED_ARRAY(CHECK_TYPED_ARRAY_CONSTRUCTOR)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* These next 3 functions are brought to you by the buggy GCC we use to build
|
||||
* B2G ICS. Older GCC versions have a bug in which they fail to compile
|
||||
* reinterpret_casts of templated functions with the message: "insufficient
|
||||
* contextual information to determine type". JS_PSG needs to
|
||||
* reinterpret_cast<JSGetterOp>, so this causes problems for us here.
|
||||
*
|
||||
* We could restructure all this code to make this nicer, but since ICS isn't
|
||||
* going to be around forever (and since this bug is fixed with the newer GCC
|
||||
* versions we use on JB and KK), the workaround here is designed for ease of
|
||||
* removal. When you stop seeing ICS Emulator builds on TBPL, remove these 3
|
||||
* JSNatives and insert the templated callee directly into the JS_PSG below.
|
||||
*/
|
||||
static bool
|
||||
TypedArray_lengthGetter(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return TypedArrayObject::Getter<TypedArrayObject::lengthValue>(cx, argc, vp);
|
||||
}
|
||||
|
||||
static bool
|
||||
TypedArray_byteLengthGetter(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return TypedArrayObject::Getter<TypedArrayObject::byteLengthValue>(cx, argc, vp);
|
||||
}
|
||||
|
||||
static bool
|
||||
TypedArray_byteOffsetGetter(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return TypedArrayObject::Getter<TypedArrayObject::byteOffsetValue>(cx, argc, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
BufferGetterImpl(JSContext* cx, const CallArgs& args)
|
||||
{
|
||||
|
@ -1458,8 +1433,8 @@ js::TypedArray_bufferGetter(JSContext* cx, unsigned argc, Value* vp)
|
|||
TypedArrayObject::protoAccessors[] = {
|
||||
JS_PSG("length", TypedArray_lengthGetter, 0),
|
||||
JS_PSG("buffer", TypedArray_bufferGetter, 0),
|
||||
JS_PSG("byteLength", TypedArray_byteLengthGetter, 0),
|
||||
JS_PSG("byteOffset", TypedArray_byteOffsetGetter, 0),
|
||||
JS_PSG("byteLength", TypedArrayObject::Getter<TypedArrayObject::byteLengthValue>, 0),
|
||||
JS_PSG("byteOffset", TypedArrayObject::Getter<TypedArrayObject::byteOffsetValue>, 0),
|
||||
JS_SELF_HOSTED_SYM_GET(toStringTag, "TypedArrayToStringTag", 0),
|
||||
JS_PS_END
|
||||
};
|
||||
|
|
|
@ -26,12 +26,8 @@
|
|||
macro(double, Float64) \
|
||||
macro(uint8_clamped, Uint8Clamped)
|
||||
|
||||
typedef struct JSProperty JSProperty;
|
||||
|
||||
namespace js {
|
||||
|
||||
enum class TypedArrayLength { Fixed, Dynamic };
|
||||
|
||||
/*
|
||||
* TypedArrayObject
|
||||
*
|
||||
|
@ -314,6 +310,13 @@ IsTypedArrayClass(const Class* clasp)
|
|||
clasp < &TypedArrayObject::classes[Scalar::MaxTypedArrayViewType];
|
||||
}
|
||||
|
||||
inline Scalar::Type
|
||||
GetTypedArrayClassType(const Class* clasp)
|
||||
{
|
||||
MOZ_ASSERT(IsTypedArrayClass(clasp));
|
||||
return static_cast<Scalar::Type>(clasp - &TypedArrayObject::classes[0]);
|
||||
}
|
||||
|
||||
bool
|
||||
IsTypedArrayConstructor(HandleValue v, uint32_t type);
|
||||
|
||||
|
@ -325,8 +328,7 @@ IsBufferSource(JSObject* object, SharedMem<uint8_t*>* dataPointer, size_t* byteL
|
|||
inline Scalar::Type
|
||||
TypedArrayObject::type() const
|
||||
{
|
||||
MOZ_ASSERT(IsTypedArrayClass(getClass()));
|
||||
return static_cast<Scalar::Type>(getClass() - &classes[0]);
|
||||
return GetTypedArrayClassType(getClass());
|
||||
}
|
||||
|
||||
inline size_t
|
||||
|
|
Загрузка…
Ссылка в новой задаче