};
enum ExternalArrayType {
- kExternalByteArray = 1,
- kExternalUnsignedByteArray,
- kExternalShortArray,
- kExternalUnsignedShortArray,
- kExternalIntArray,
- kExternalUnsignedIntArray,
- kExternalFloatArray,
- kExternalDoubleArray,
- kExternalPixelArray
+ kExternalInt8Array = 1,
+ kExternalUint8Array,
+ kExternalInt16Array,
+ kExternalUint16Array,
+ kExternalInt32Array,
+ kExternalUint32Array,
+ kExternalFloat32Array,
+ kExternalFloat64Array,
+ kExternalUint8ClampedArray,
+
+ // Legacy constant names
+ kExternalByteArray = kExternalInt8Array,
+ kExternalUnsignedByteArray = kExternalUint8Array,
+ kExternalShortArray = kExternalInt16Array,
+ kExternalUnsignedShortArray = kExternalUint16Array,
+ kExternalIntArray = kExternalInt32Array,
+ kExternalUnsignedIntArray = kExternalUint32Array,
+ kExternalFloatArray = kExternalFloat32Array,
+ kExternalDoubleArray = kExternalFloat64Array,
+ kExternalPixelArray = kExternalUint8ClampedArray
};
/**
}
-#define TYPED_ARRAY_LIST(F) \
- F(Uint8Array, kExternalUnsignedByteArray) \
- F(Int8Array, kExternalByteArray) \
- F(Uint16Array, kExternalUnsignedShortArray) \
- F(Int16Array, kExternalShortArray) \
- F(Uint32Array, kExternalUnsignedIntArray) \
- F(Int32Array, kExternalIntArray) \
- F(Float32Array, kExternalFloatArray) \
- F(Float64Array, kExternalDoubleArray) \
- F(Uint8ClampedArray, kExternalPixelArray)
-
-
-#define VALUE_IS_TYPED_ARRAY(TypedArray, type_const) \
- bool Value::Is##TypedArray() const { \
- i::Handle<i::Object> obj = Utils::OpenHandle(this); \
- if (!obj->IsJSTypedArray()) return false; \
- return i::JSTypedArray::cast(*obj)->type() == type_const; \
+#define VALUE_IS_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \
+ bool Value::Is##Type##Array() const { \
+ i::Handle<i::Object> obj = Utils::OpenHandle(this); \
+ return obj->IsJSTypedArray() && \
+ i::JSTypedArray::cast(*obj)->type() == kExternal##Type##Array; \
}
-TYPED_ARRAY_LIST(VALUE_IS_TYPED_ARRAY)
+TYPED_ARRAYS(VALUE_IS_TYPED_ARRAY)
#undef VALUE_IS_TYPED_ARRAY
}
-#define CHECK_TYPED_ARRAY_CAST(ApiClass, typeConst) \
- void v8::ApiClass::CheckCast(Value* that) { \
- i::Handle<i::Object> obj = Utils::OpenHandle(that); \
- Utils::ApiCheck(obj->IsJSTypedArray() && \
- i::JSTypedArray::cast(*obj)->type() == typeConst, \
- "v8::" #ApiClass "::Cast()", \
- "Could not convert to " #ApiClass); \
+#define CHECK_TYPED_ARRAY_CAST(Type, typeName, TYPE, ctype, size) \
+ void v8::Type##Array::CheckCast(Value* that) { \
+ i::Handle<i::Object> obj = Utils::OpenHandle(that); \
+ Utils::ApiCheck(obj->IsJSTypedArray() && \
+ i::JSTypedArray::cast(*obj)->type() == \
+ kExternal##Type##Array, \
+ "v8::" #Type "Array::Cast()", \
+ "Could not convert to " #Type "Array"); \
}
-TYPED_ARRAY_LIST(CHECK_TYPED_ARRAY_CAST)
+TYPED_ARRAYS(CHECK_TYPED_ARRAY_CAST)
#undef CHECK_TYPED_ARRAY_CAST
static i::ElementsKind GetElementsKindFromExternalArrayType(
ExternalArrayType array_type) {
switch (array_type) {
- case kExternalByteArray:
- return i::EXTERNAL_BYTE_ELEMENTS;
- break;
- case kExternalUnsignedByteArray:
- return i::EXTERNAL_UNSIGNED_BYTE_ELEMENTS;
- break;
- case kExternalShortArray:
- return i::EXTERNAL_SHORT_ELEMENTS;
- break;
- case kExternalUnsignedShortArray:
- return i::EXTERNAL_UNSIGNED_SHORT_ELEMENTS;
- break;
- case kExternalIntArray:
- return i::EXTERNAL_INT_ELEMENTS;
- break;
- case kExternalUnsignedIntArray:
- return i::EXTERNAL_UNSIGNED_INT_ELEMENTS;
- break;
- case kExternalFloatArray:
- return i::EXTERNAL_FLOAT_ELEMENTS;
- break;
- case kExternalDoubleArray:
- return i::EXTERNAL_DOUBLE_ELEMENTS;
- break;
- case kExternalPixelArray:
- return i::EXTERNAL_PIXEL_ELEMENTS;
- break;
+#define ARRAY_TYPE_TO_ELEMENTS_KIND(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return i::EXTERNAL_##TYPE##_ELEMENTS;
+
+ TYPED_ARRAYS(ARRAY_TYPE_TO_ELEMENTS_KIND)
+#undef ARRAY_TYPE_TO_ELEMENTS_KIND
}
UNREACHABLE();
return i::DICTIONARY_ELEMENTS;
ENTER_V8(isolate);
i::HandleScope scope(isolate);
if (!Utils::ApiCheck(length >= 0 &&
- length <= i::ExternalPixelArray::kMaxLength,
+ length <= i::ExternalUint8ClampedArray::kMaxLength,
"v8::Object::SetIndexedPropertiesToPixelData()",
"length exceeds max acceptable value")) {
return;
"JSArray is not supported")) {
return;
}
- PrepareExternalArrayElements(self, data, kExternalPixelArray, length);
+ PrepareExternalArrayElements(self, data, kExternalUint8ClampedArray, length);
}
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
ON_BAILOUT(self->GetIsolate(), "v8::HasIndexedPropertiesInPixelData()",
return false);
- return self->HasExternalPixelElements();
+ return self->HasExternalUint8ClampedElements();
}
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
ON_BAILOUT(self->GetIsolate(), "v8::GetIndexedPropertiesPixelData()",
return NULL);
- if (self->HasExternalPixelElements()) {
- return i::ExternalPixelArray::cast(self->elements())->
- external_pixel_pointer();
+ if (self->HasExternalUint8ClampedElements()) {
+ return i::ExternalUint8ClampedArray::cast(self->elements())->
+ external_uint8_clamped_pointer();
} else {
return NULL;
}
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
ON_BAILOUT(self->GetIsolate(), "v8::GetIndexedPropertiesPixelDataLength()",
return -1);
- if (self->HasExternalPixelElements()) {
- return i::ExternalPixelArray::cast(self->elements())->length();
+ if (self->HasExternalUint8ClampedElements()) {
+ return i::ExternalUint8ClampedArray::cast(self->elements())->length();
} else {
return -1;
}
"v8::GetIndexedPropertiesExternalArrayDataType()",
return static_cast<ExternalArrayType>(-1));
switch (self->elements()->map()->instance_type()) {
- case i::EXTERNAL_BYTE_ARRAY_TYPE:
- return kExternalByteArray;
- case i::EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- return kExternalUnsignedByteArray;
- case i::EXTERNAL_SHORT_ARRAY_TYPE:
- return kExternalShortArray;
- case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- return kExternalUnsignedShortArray;
- case i::EXTERNAL_INT_ARRAY_TYPE:
- return kExternalIntArray;
- case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- return kExternalUnsignedIntArray;
- case i::EXTERNAL_FLOAT_ARRAY_TYPE:
- return kExternalFloatArray;
- case i::EXTERNAL_DOUBLE_ARRAY_TYPE:
- return kExternalDoubleArray;
- case i::EXTERNAL_PIXEL_ARRAY_TYPE:
- return kExternalPixelArray;
+#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
+ case i::EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ return kExternal##Type##Array;
+ TYPED_ARRAYS(INSTANCE_TYPE_TO_ARRAY_TYPE)
+#undef INSTANCE_TYPE_TO_ARRAY_TYPE
default:
return static_cast<ExternalArrayType>(-1);
}
}
-#define TYPED_ARRAY_NEW(TypedArray, element_type, array_type, elements_kind) \
- Local<TypedArray> TypedArray::New(Handle<ArrayBuffer> array_buffer, \
+#define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \
+ Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \
size_t byte_offset, size_t length) { \
i::Isolate* isolate = i::Isolate::Current(); \
EnsureInitializedForIsolate(isolate, \
- "v8::" #TypedArray "::New(Handle<ArrayBuffer>, size_t, size_t)"); \
+ "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \
LOG_API(isolate, \
- "v8::" #TypedArray "::New(Handle<ArrayBuffer>, size_t, size_t)"); \
+ "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \
ENTER_V8(isolate); \
i::Handle<i::JSTypedArray> obj = \
- NewTypedArray<element_type, array_type, elements_kind>( \
+ NewTypedArray<ctype, v8::kExternal##Type##Array, \
+ i::EXTERNAL_##TYPE##_ELEMENTS>( \
isolate, array_buffer, byte_offset, length); \
- return Utils::ToLocal##TypedArray(obj); \
- }
-
-
-TYPED_ARRAY_NEW(Uint8Array, uint8_t, kExternalUnsignedByteArray,
- i::EXTERNAL_UNSIGNED_BYTE_ELEMENTS)
-TYPED_ARRAY_NEW(Uint8ClampedArray, uint8_t, kExternalPixelArray,
- i::EXTERNAL_PIXEL_ELEMENTS)
-TYPED_ARRAY_NEW(Int8Array, int8_t, kExternalByteArray,
- i::EXTERNAL_BYTE_ELEMENTS)
-TYPED_ARRAY_NEW(Uint16Array, uint16_t, kExternalUnsignedShortArray,
- i::EXTERNAL_UNSIGNED_SHORT_ELEMENTS)
-TYPED_ARRAY_NEW(Int16Array, int16_t, kExternalShortArray,
- i::EXTERNAL_SHORT_ELEMENTS)
-TYPED_ARRAY_NEW(Uint32Array, uint32_t, kExternalUnsignedIntArray,
- i::EXTERNAL_UNSIGNED_INT_ELEMENTS)
-TYPED_ARRAY_NEW(Int32Array, int32_t, kExternalIntArray,
- i::EXTERNAL_INT_ELEMENTS)
-TYPED_ARRAY_NEW(Float32Array, float, kExternalFloatArray,
- i::EXTERNAL_FLOAT_ELEMENTS)
-TYPED_ARRAY_NEW(Float64Array, double, kExternalDoubleArray,
- i::EXTERNAL_DOUBLE_ELEMENTS)
+ return Utils::ToLocal##Type##Array(obj); \
+ }
+
+TYPED_ARRAYS(TYPED_ARRAY_NEW)
#undef TYPED_ARRAY_NEW
Local<DataView> DataView::New(Handle<ArrayBuffer> array_buffer,
}
-#define MAKE_TO_LOCAL_TYPED_ARRAY(TypedArray, typeConst) \
- Local<v8::TypedArray> Utils::ToLocal##TypedArray( \
+#define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \
+ Local<v8::Type##Array> Utils::ToLocal##Type##Array( \
v8::internal::Handle<v8::internal::JSTypedArray> obj) { \
- ASSERT(obj->type() == typeConst); \
- return Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \
+ ASSERT(obj->type() == kExternal##Type##Array); \
+ return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj); \
}
MAKE_TO_LOCAL(ToLocal, JSDataView, DataView)
MAKE_TO_LOCAL(ToLocal, JSTypedArray, TypedArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Uint8Array, kExternalUnsignedByteArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Uint8ClampedArray, kExternalPixelArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Int8Array, kExternalByteArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Uint16Array, kExternalUnsignedShortArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Int16Array, kExternalShortArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Uint32Array, kExternalUnsignedIntArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Int32Array, kExternalIntArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Float32Array, kExternalFloatArray)
-MAKE_TO_LOCAL_TYPED_ARRAY(Float64Array, kExternalDoubleArray)
+TYPED_ARRAYS(MAKE_TO_LOCAL_TYPED_ARRAY)
MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate)
MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate)
// An unsigned int array load might overflow and cause a deopt, make sure it
// has an environment.
bool can_deoptimize = instr->RequiresHoleCheck() ||
- elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS ||
+ elements_kind == EXTERNAL_UINT32_ELEMENTS ||
elements_kind == UINT32_ELEMENTS;
return can_deoptimize ? AssignEnvironment(result) : result;
}
: 0;
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS ||
- elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
int base_offset =
(instr->additional_index() << element_size_shift) + additional_offset;
? Operand(constant_key << element_size_shift)
: Operand(key, LSL, shift_size);
__ add(scratch0(), external_pointer, operand);
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
__ vldr(double_scratch0().low(), scratch0(), base_offset);
__ vcvt_f64_f32(result, double_scratch0().low());
element_size_shift, shift_size,
instr->additional_index(), additional_offset);
switch (elements_kind) {
- case EXTERNAL_BYTE_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
case INT8_ELEMENTS:
__ ldrsb(result, mem_operand);
break;
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
__ ldrb(result, mem_operand);
break;
- case EXTERNAL_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
case INT16_ELEMENTS:
__ ldrsh(result, mem_operand);
break;
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
__ ldrh(result, mem_operand);
break;
- case EXTERNAL_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
case INT32_ELEMENTS:
__ ldr(result, mem_operand);
break;
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case UINT32_ELEMENTS:
__ ldr(result, mem_operand);
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
break;
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
case FAST_HOLEY_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS:
? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
: 0;
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS ||
- elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
int base_offset =
(instr->additional_index() << element_size_shift) + additional_offset;
} else {
__ add(address, external_pointer, Operand(key, LSL, shift_size));
}
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
__ vcvt_f32_f64(double_scratch0().low(), value);
__ vstr(double_scratch0().low(), address, base_offset);
element_size_shift, shift_size,
instr->additional_index(), additional_offset);
switch (elements_kind) {
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
case INT8_ELEMENTS:
__ strb(value, mem_operand);
break;
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case INT16_ELEMENTS:
case UINT16_ELEMENTS:
__ strh(value, mem_operand);
break;
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case INT32_ELEMENTS:
case UINT32_ELEMENTS:
__ str(value, mem_operand);
break;
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_ELEMENTS:
case FAST_SMI_ELEMENTS:
}
{ // -- T y p e d A r r a y s
- Handle<JSFunction> int8_fun = InstallTypedArray("Int8Array",
- EXTERNAL_BYTE_ELEMENTS);
- native_context()->set_int8_array_fun(*int8_fun);
- Handle<JSFunction> uint8_fun = InstallTypedArray("Uint8Array",
- EXTERNAL_UNSIGNED_BYTE_ELEMENTS);
- native_context()->set_uint8_array_fun(*uint8_fun);
- Handle<JSFunction> int16_fun = InstallTypedArray("Int16Array",
- EXTERNAL_SHORT_ELEMENTS);
- native_context()->set_int16_array_fun(*int16_fun);
- Handle<JSFunction> uint16_fun = InstallTypedArray("Uint16Array",
- EXTERNAL_UNSIGNED_SHORT_ELEMENTS);
- native_context()->set_uint16_array_fun(*uint16_fun);
- Handle<JSFunction> int32_fun = InstallTypedArray("Int32Array",
- EXTERNAL_INT_ELEMENTS);
- native_context()->set_int32_array_fun(*int32_fun);
- Handle<JSFunction> uint32_fun = InstallTypedArray("Uint32Array",
- EXTERNAL_UNSIGNED_INT_ELEMENTS);
- native_context()->set_uint32_array_fun(*uint32_fun);
- Handle<JSFunction> float_fun = InstallTypedArray("Float32Array",
- EXTERNAL_FLOAT_ELEMENTS);
- native_context()->set_float_array_fun(*float_fun);
- Handle<JSFunction> double_fun = InstallTypedArray("Float64Array",
- EXTERNAL_DOUBLE_ELEMENTS);
- native_context()->set_double_array_fun(*double_fun);
- Handle<JSFunction> uint8c_fun = InstallTypedArray("Uint8ClampedArray",
- EXTERNAL_PIXEL_ELEMENTS);
- native_context()->set_uint8c_array_fun(*uint8c_fun);
+#define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
+ { \
+ Handle<JSFunction> fun = InstallTypedArray(#Type "Array", \
+ EXTERNAL_##TYPE##_ELEMENTS); \
+ native_context()->set_##type##_array_fun(*fun); \
+ }
+ TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
+#undef INSTALL_TYPED_ARRAY
Handle<JSFunction> data_view_fun =
InstallFunction(
case FAST_HOLEY_SMI_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS:
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
UNREACHABLE();
break;
case DICTIONARY_ELEMENTS:
V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun) \
V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \
V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun) \
- V(FLOAT_ARRAY_FUN_INDEX, JSFunction, float_array_fun) \
- V(DOUBLE_ARRAY_FUN_INDEX, JSFunction, double_array_fun) \
- V(UINT8C_ARRAY_FUN_INDEX, JSFunction, uint8c_array_fun) \
+ V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \
+ V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \
+ V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \
V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \
V(FUNCTION_MAP_INDEX, Map, function_map) \
V(STRICT_MODE_FUNCTION_MAP_INDEX, Map, strict_mode_function_map) \
INT16_ARRAY_FUN_INDEX,
UINT32_ARRAY_FUN_INDEX,
INT32_ARRAY_FUN_INDEX,
- FLOAT_ARRAY_FUN_INDEX,
- DOUBLE_ARRAY_FUN_INDEX,
- UINT8C_ARRAY_FUN_INDEX,
+ FLOAT32_ARRAY_FUN_INDEX,
+ FLOAT64_ARRAY_FUN_INDEX,
+ UINT8_CLAMPED_ARRAY_FUN_INDEX,
DATA_VIEW_FUN_INDEX,
MESSAGE_LISTENERS_INDEX,
MAKE_MESSAGE_FUN_INDEX,
int ElementsKindToShiftSize(ElementsKind elements_kind) {
switch (elements_kind) {
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case INT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
return 0;
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
case INT16_ELEMENTS:
return 1;
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
case UINT32_ELEMENTS:
case INT32_ELEMENTS:
case FLOAT32_ELEMENTS:
return 2;
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
case FLOAT64_ELEMENTS:
DICTIONARY_ELEMENTS,
NON_STRICT_ARGUMENTS_ELEMENTS,
// The "fast" kind for external arrays
- EXTERNAL_BYTE_ELEMENTS,
- EXTERNAL_UNSIGNED_BYTE_ELEMENTS,
- EXTERNAL_SHORT_ELEMENTS,
- EXTERNAL_UNSIGNED_SHORT_ELEMENTS,
- EXTERNAL_INT_ELEMENTS,
- EXTERNAL_UNSIGNED_INT_ELEMENTS,
- EXTERNAL_FLOAT_ELEMENTS,
- EXTERNAL_DOUBLE_ELEMENTS,
- EXTERNAL_PIXEL_ELEMENTS,
+ EXTERNAL_INT8_ELEMENTS,
+ EXTERNAL_UINT8_ELEMENTS,
+ EXTERNAL_INT16_ELEMENTS,
+ EXTERNAL_UINT16_ELEMENTS,
+ EXTERNAL_INT32_ELEMENTS,
+ EXTERNAL_UINT32_ELEMENTS,
+ EXTERNAL_FLOAT32_ELEMENTS,
+ EXTERNAL_FLOAT64_ELEMENTS,
+ EXTERNAL_UINT8_CLAMPED_ELEMENTS,
// Fixed typed arrays
UINT8_ELEMENTS,
LAST_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
FIRST_FAST_ELEMENTS_KIND = FAST_SMI_ELEMENTS,
LAST_FAST_ELEMENTS_KIND = FAST_HOLEY_DOUBLE_ELEMENTS,
- FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_BYTE_ELEMENTS,
- LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS,
+ FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_INT8_ELEMENTS,
+ LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_UINT8_CLAMPED_ELEMENTS,
FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_ELEMENTS,
LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
TERMINAL_FAST_ELEMENTS_KIND = FAST_HOLEY_ELEMENTS
inline bool IsExternalFloatOrDoubleElementsKind(ElementsKind kind) {
- return kind == EXTERNAL_DOUBLE_ELEMENTS ||
- kind == EXTERNAL_FLOAT_ELEMENTS;
+ return kind == EXTERNAL_FLOAT64_ELEMENTS ||
+ kind == EXTERNAL_FLOAT32_ELEMENTS;
}
// - FastDoubleElementsAccessor
// - FastPackedDoubleElementsAccessor
// - FastHoleyDoubleElementsAccessor
-// - TypedElementsAccessor (abstract)
-// - ExternalByteElementsAccessor
-// - ExternalUnsignedByteElementsAccessor
-// - ExternalShortElementsAccessor
-// - ExternalUnsignedShortElementsAccessor
-// - ExternalIntElementsAccessor
-// - ExternalUnsignedIntElementsAccessor
-// - ExternalFloatElementsAccessor
-// - ExternalDoubleElementsAccessor
-// - PixelElementsAccessor
-// - FixedUint8ArrayAccessor
-// - FixedInt8ArrayAccessor
-// - FixedUint16ArrayAccessor
-// - FixedInt16ArrayAccessor
-// - FixedUint32ArrayAccessor
-// - FixedInt32ArrayAccessor
-// - FixedFloat32ArrayAccessor
-// - FixedFloat64ArrayAccessor
-// - FixedUint8ClampedArrayAccessor
+// - TypedElementsAccessor: template, with instantiations:
+// - ExternalInt8ElementsAccessor
+// - ExternalUint8ElementsAccessor
+// - ExternalInt16ElementsAccessor
+// - ExternalUint16ElementsAccessor
+// - ExternalInt32ElementsAccessor
+// - ExternalUint32ElementsAccessor
+// - ExternalFloat32ElementsAccessor
+// - ExternalFloat64ElementsAccessor
+// - ExternalUint8ClampedElementsAccessor
+// - FixedUint8ElementsAccessor
+// - FixedInt8ElementsAccessor
+// - FixedUint16ElementsAccessor
+// - FixedInt16ElementsAccessor
+// - FixedUint32ElementsAccessor
+// - FixedInt32ElementsAccessor
+// - FixedFloat32ElementsAccessor
+// - FixedFloat64ElementsAccessor
+// - FixedUint8ClampedElementsAccessor
// - DictionaryElementsAccessor
// - NonStrictArgumentsElementsAccessor
SeededNumberDictionary) \
V(NonStrictArgumentsElementsAccessor, NON_STRICT_ARGUMENTS_ELEMENTS, \
FixedArray) \
- V(ExternalByteElementsAccessor, EXTERNAL_BYTE_ELEMENTS, \
- ExternalByteArray) \
- V(ExternalUnsignedByteElementsAccessor, \
- EXTERNAL_UNSIGNED_BYTE_ELEMENTS, ExternalUnsignedByteArray) \
- V(ExternalShortElementsAccessor, EXTERNAL_SHORT_ELEMENTS, \
- ExternalShortArray) \
- V(ExternalUnsignedShortElementsAccessor, \
- EXTERNAL_UNSIGNED_SHORT_ELEMENTS, ExternalUnsignedShortArray) \
- V(ExternalIntElementsAccessor, EXTERNAL_INT_ELEMENTS, \
- ExternalIntArray) \
- V(ExternalUnsignedIntElementsAccessor, \
- EXTERNAL_UNSIGNED_INT_ELEMENTS, ExternalUnsignedIntArray) \
- V(ExternalFloatElementsAccessor, \
- EXTERNAL_FLOAT_ELEMENTS, ExternalFloatArray) \
- V(ExternalDoubleElementsAccessor, \
- EXTERNAL_DOUBLE_ELEMENTS, ExternalDoubleArray) \
- V(PixelElementsAccessor, EXTERNAL_PIXEL_ELEMENTS, ExternalPixelArray) \
- V(FixedUint8ArrayAccessor, UINT8_ELEMENTS, FixedUint8Array) \
- V(FixedInt8ArrayAccessor, INT8_ELEMENTS, FixedInt8Array) \
- V(FixedUint16ArrayAccessor, UINT16_ELEMENTS, FixedUint16Array) \
- V(FixedInt16ArrayAccessor, INT16_ELEMENTS, FixedInt16Array) \
- V(FixedUint32ArrayAccessor, UINT32_ELEMENTS, FixedUint32Array) \
- V(FixedInt32ArrayAccessor, INT32_ELEMENTS, FixedInt32Array) \
- V(FixedFloat32ArrayAccessor, FLOAT32_ELEMENTS, FixedFloat32Array) \
- V(FixedFloat64ArrayAccessor, FLOAT64_ELEMENTS, FixedFloat64Array) \
- V(FixedUint8ClampedArrayAccessor, UINT8_CLAMPED_ELEMENTS, \
+ V(ExternalInt8ElementsAccessor, EXTERNAL_INT8_ELEMENTS, \
+ ExternalInt8Array) \
+ V(ExternalUint8ElementsAccessor, \
+ EXTERNAL_UINT8_ELEMENTS, ExternalUint8Array) \
+ V(ExternalInt16ElementsAccessor, EXTERNAL_INT16_ELEMENTS, \
+ ExternalInt16Array) \
+ V(ExternalUint16ElementsAccessor, \
+ EXTERNAL_UINT16_ELEMENTS, ExternalUint16Array) \
+ V(ExternalInt32ElementsAccessor, EXTERNAL_INT32_ELEMENTS, \
+ ExternalInt32Array) \
+ V(ExternalUint32ElementsAccessor, \
+ EXTERNAL_UINT32_ELEMENTS, ExternalUint32Array) \
+ V(ExternalFloat32ElementsAccessor, \
+ EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array) \
+ V(ExternalFloat64ElementsAccessor, \
+ EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array) \
+ V(ExternalUint8ClampedElementsAccessor, \
+ EXTERNAL_UINT8_CLAMPED_ELEMENTS, \
+ ExternalUint8ClampedArray) \
+ V(FixedUint8ElementsAccessor, UINT8_ELEMENTS, FixedUint8Array) \
+ V(FixedInt8ElementsAccessor, INT8_ELEMENTS, FixedInt8Array) \
+ V(FixedUint16ElementsAccessor, UINT16_ELEMENTS, FixedUint16Array) \
+ V(FixedInt16ElementsAccessor, INT16_ELEMENTS, FixedInt16Array) \
+ V(FixedUint32ElementsAccessor, UINT32_ELEMENTS, FixedUint32Array) \
+ V(FixedInt32ElementsAccessor, INT32_ELEMENTS, FixedInt32Array) \
+ V(FixedFloat32ElementsAccessor, FLOAT32_ELEMENTS, FixedFloat32Array) \
+ V(FixedFloat64ElementsAccessor, FLOAT64_ELEMENTS, FixedFloat64Array) \
+ V(FixedUint8ClampedElementsAccessor, UINT8_CLAMPED_ELEMENTS, \
FixedUint8ClampedArray)
}
case FIXED_DOUBLE_ARRAY_TYPE:
return FAST_HOLEY_DOUBLE_ELEMENTS;
- case EXTERNAL_BYTE_ARRAY_TYPE:
- return EXTERNAL_BYTE_ELEMENTS;
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- return EXTERNAL_UNSIGNED_BYTE_ELEMENTS;
- case EXTERNAL_SHORT_ARRAY_TYPE:
- return EXTERNAL_SHORT_ELEMENTS;
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- return EXTERNAL_UNSIGNED_SHORT_ELEMENTS;
- case EXTERNAL_INT_ARRAY_TYPE:
- return EXTERNAL_INT_ELEMENTS;
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- return EXTERNAL_UNSIGNED_INT_ELEMENTS;
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- return EXTERNAL_FLOAT_ELEMENTS;
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
- return EXTERNAL_DOUBLE_ELEMENTS;
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- return EXTERNAL_PIXEL_ELEMENTS;
-
- case FIXED_UINT8_ARRAY_TYPE:
- return UINT8_ELEMENTS;
- case FIXED_INT8_ARRAY_TYPE:
- return INT8_ELEMENTS;
- case FIXED_UINT16_ARRAY_TYPE:
- return UINT16_ELEMENTS;
- case FIXED_INT16_ARRAY_TYPE:
- return INT16_ELEMENTS;
- case FIXED_UINT32_ARRAY_TYPE:
- return UINT32_ELEMENTS;
- case FIXED_INT32_ARRAY_TYPE:
- return INT32_ELEMENTS;
- case FIXED_FLOAT32_ARRAY_TYPE:
- return FLOAT32_ELEMENTS;
- case FIXED_FLOAT64_ARRAY_TYPE:
- return FLOAT64_ELEMENTS;
- case FIXED_UINT8_CLAMPED_ARRAY_TYPE:
- return UINT8_CLAMPED_ELEMENTS;
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ return EXTERNAL_##TYPE##_ELEMENTS; \
+ case FIXED_##TYPE##_ARRAY_TYPE: \
+ return TYPE##_ELEMENTS;
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
default:
UNREACHABLE();
return CopyElementsImpl(arguments, from_start, to, from_kind,
to_start, packed_size, copy_size);
}
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
UNREACHABLE();
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
}
return NULL;
}
from, from_start, to, to_start, copy_size);
break;
case NON_STRICT_ARGUMENTS_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
UNREACHABLE();
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+ UNREACHABLE();
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
}
return to->GetHeap()->undefined_value();
}
// Super class for all external element arrays.
-template<typename AccessorSubclass,
- ElementsKind Kind>
+template<ElementsKind Kind>
class TypedElementsAccessor
- : public ElementsAccessorBase<AccessorSubclass,
+ : public ElementsAccessorBase<TypedElementsAccessor<Kind>,
ElementsKindTraits<Kind> > {
public:
explicit TypedElementsAccessor(const char* name)
- : ElementsAccessorBase<AccessorSubclass,
+ : ElementsAccessorBase<AccessorClass,
ElementsKindTraits<Kind> >(name) {}
protected:
typedef typename ElementsKindTraits<Kind>::BackingStore BackingStore;
+ typedef TypedElementsAccessor<Kind> AccessorClass;
- friend class ElementsAccessorBase<AccessorSubclass,
+ friend class ElementsAccessorBase<AccessorClass,
ElementsKindTraits<Kind> >;
MUST_USE_RESULT static MaybeObject* GetImpl(Object* receiver,
uint32_t key,
FixedArrayBase* backing_store) {
return
- key < AccessorSubclass::GetCapacityImpl(backing_store)
+ key < AccessorClass::GetCapacityImpl(backing_store)
? BackingStore::cast(backing_store)->get(key)
: backing_store->GetHeap()->undefined_value();
}
uint32_t key,
FixedArrayBase* backing_store) {
return
- key < AccessorSubclass::GetCapacityImpl(backing_store)
+ key < AccessorClass::GetCapacityImpl(backing_store)
? NONE : ABSENT;
}
uint32_t key,
FixedArrayBase* backing_store) {
return
- key < AccessorSubclass::GetCapacityImpl(backing_store)
+ key < AccessorClass::GetCapacityImpl(backing_store)
? FIELD : NONEXISTENT;
}
uint32_t key,
FixedArrayBase* backing_store) {
uint32_t capacity =
- AccessorSubclass::GetCapacityImpl(backing_store);
+ AccessorClass::GetCapacityImpl(backing_store);
return key < capacity;
}
};
-class ExternalByteElementsAccessor
- : public TypedElementsAccessor<ExternalByteElementsAccessor,
- EXTERNAL_BYTE_ELEMENTS> {
- public:
- explicit ExternalByteElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalByteElementsAccessor,
- EXTERNAL_BYTE_ELEMENTS>(name) {}
-};
-
-
-class ExternalUnsignedByteElementsAccessor
- : public TypedElementsAccessor<ExternalUnsignedByteElementsAccessor,
- EXTERNAL_UNSIGNED_BYTE_ELEMENTS> {
- public:
- explicit ExternalUnsignedByteElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalUnsignedByteElementsAccessor,
- EXTERNAL_UNSIGNED_BYTE_ELEMENTS>(name) {}
-};
+#define EXTERNAL_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
+ typedef TypedElementsAccessor<EXTERNAL_##TYPE##_ELEMENTS> \
+ External##Type##ElementsAccessor;
-class ExternalShortElementsAccessor
- : public TypedElementsAccessor<ExternalShortElementsAccessor,
- EXTERNAL_SHORT_ELEMENTS> {
- public:
- explicit ExternalShortElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalShortElementsAccessor,
- EXTERNAL_SHORT_ELEMENTS>(name) {}
-};
+TYPED_ARRAYS(EXTERNAL_ELEMENTS_ACCESSOR)
+#undef EXTERNAL_ELEMENTS_ACCESSOR
+#define FIXED_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
+ typedef TypedElementsAccessor<TYPE##_ELEMENTS > \
+ Fixed##Type##ElementsAccessor;
-class ExternalUnsignedShortElementsAccessor
- : public TypedElementsAccessor<ExternalUnsignedShortElementsAccessor,
- EXTERNAL_UNSIGNED_SHORT_ELEMENTS> {
- public:
- explicit ExternalUnsignedShortElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalUnsignedShortElementsAccessor,
- EXTERNAL_UNSIGNED_SHORT_ELEMENTS>(name) {}
-};
+TYPED_ARRAYS(FIXED_ELEMENTS_ACCESSOR)
+#undef FIXED_ELEMENTS_ACCESSOR
-class ExternalIntElementsAccessor
- : public TypedElementsAccessor<ExternalIntElementsAccessor,
- EXTERNAL_INT_ELEMENTS> {
- public:
- explicit ExternalIntElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalIntElementsAccessor,
- EXTERNAL_INT_ELEMENTS>(name) {}
-};
-
-
-class ExternalUnsignedIntElementsAccessor
- : public TypedElementsAccessor<ExternalUnsignedIntElementsAccessor,
- EXTERNAL_UNSIGNED_INT_ELEMENTS> {
- public:
- explicit ExternalUnsignedIntElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalUnsignedIntElementsAccessor,
- EXTERNAL_UNSIGNED_INT_ELEMENTS>(name) {}
-};
-
-
-class ExternalFloatElementsAccessor
- : public TypedElementsAccessor<ExternalFloatElementsAccessor,
- EXTERNAL_FLOAT_ELEMENTS> {
- public:
- explicit ExternalFloatElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalFloatElementsAccessor,
- EXTERNAL_FLOAT_ELEMENTS>(name) {}
-};
-
-
-class ExternalDoubleElementsAccessor
- : public TypedElementsAccessor<ExternalDoubleElementsAccessor,
- EXTERNAL_DOUBLE_ELEMENTS> {
- public:
- explicit ExternalDoubleElementsAccessor(const char* name)
- : TypedElementsAccessor<ExternalDoubleElementsAccessor,
- EXTERNAL_DOUBLE_ELEMENTS>(name) {}
-};
-
-
-class PixelElementsAccessor
- : public TypedElementsAccessor<PixelElementsAccessor,
- EXTERNAL_PIXEL_ELEMENTS> {
- public:
- explicit PixelElementsAccessor(const char* name)
- : TypedElementsAccessor<PixelElementsAccessor,
- EXTERNAL_PIXEL_ELEMENTS>(name) {}
-};
-
-
-class FixedUint8ArrayAccessor
- : public TypedElementsAccessor<FixedUint8ArrayAccessor,
- UINT8_ELEMENTS> {
- public:
- explicit FixedUint8ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedUint8ArrayAccessor,
- UINT8_ELEMENTS>(name) {}
-};
-class FixedUint8ClampedArrayAccessor
- : public TypedElementsAccessor<FixedUint8ClampedArrayAccessor,
- UINT8_CLAMPED_ELEMENTS> {
- public:
- explicit FixedUint8ClampedArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedUint8ClampedArrayAccessor,
- UINT8_CLAMPED_ELEMENTS>(name) {}
-};
-class FixedInt8ArrayAccessor
- : public TypedElementsAccessor<FixedInt8ArrayAccessor,
- INT8_ELEMENTS> {
- public:
- explicit FixedInt8ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedInt8ArrayAccessor,
- INT8_ELEMENTS>(name) {}
-};
-class FixedUint16ArrayAccessor
- : public TypedElementsAccessor<FixedUint16ArrayAccessor,
- UINT16_ELEMENTS> {
- public:
- explicit FixedUint16ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedUint16ArrayAccessor,
- UINT16_ELEMENTS>(name) {}
-};
-class FixedInt16ArrayAccessor
- : public TypedElementsAccessor<FixedInt16ArrayAccessor,
- INT16_ELEMENTS> {
- public:
- explicit FixedInt16ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedInt16ArrayAccessor,
- INT16_ELEMENTS>(name) {}
-};
-class FixedUint32ArrayAccessor
- : public TypedElementsAccessor<FixedUint32ArrayAccessor,
- UINT32_ELEMENTS> {
- public:
- explicit FixedUint32ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedUint32ArrayAccessor,
- UINT32_ELEMENTS>(name) {}
-};
-class FixedInt32ArrayAccessor
- : public TypedElementsAccessor<FixedInt32ArrayAccessor,
- INT32_ELEMENTS> {
- public:
- explicit FixedInt32ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedInt32ArrayAccessor,
- INT32_ELEMENTS>(name) {}
-};
-
-class FixedFloat32ArrayAccessor
- : public TypedElementsAccessor<FixedFloat32ArrayAccessor,
- FLOAT32_ELEMENTS> {
- public:
- explicit FixedFloat32ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedFloat32ArrayAccessor,
- FLOAT32_ELEMENTS>(name) {}
-};
-class FixedFloat64ArrayAccessor
- : public TypedElementsAccessor<FixedFloat64ArrayAccessor,
- FLOAT64_ELEMENTS> {
- public:
- explicit FixedFloat64ArrayAccessor(const char* name)
- : TypedElementsAccessor<FixedFloat64ArrayAccessor,
- FLOAT64_ELEMENTS>(name) {}
-};
class DictionaryElementsAccessor
: public ElementsAccessorBase<DictionaryElementsAccessor,
Isolate* isolate) {
Context* native_context = isolate->context()->native_context();
switch (type) {
- case kExternalUnsignedByteArray:
- return native_context->uint8_array_fun();
+#define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return native_context->type##_array_fun();
- case kExternalByteArray:
- return native_context->int8_array_fun();
-
- case kExternalUnsignedShortArray:
- return native_context->uint16_array_fun();
-
- case kExternalShortArray:
- return native_context->int16_array_fun();
-
- case kExternalUnsignedIntArray:
- return native_context->uint32_array_fun();
-
- case kExternalIntArray:
- return native_context->int32_array_fun();
-
- case kExternalFloatArray:
- return native_context->float_array_fun();
-
- case kExternalDoubleArray:
- return native_context->double_array_fun();
-
- case kExternalPixelArray:
- return native_context->uint8c_array_fun();
+ TYPED_ARRAYS(TYPED_ARRAY_FUN)
+#undef TYPED_ARRAY_FUN
default:
UNREACHABLE();
ALLOCATE_VARSIZE_MAP(BYTE_ARRAY_TYPE, byte_array)
ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space)
-#define ALLOCATE_EXTERNAL_ARRAY_MAP(TYPE, type) \
+#define ALLOCATE_EXTERNAL_ARRAY_MAP(Type, type, TYPE, ctype, size) \
ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kAlignedSize, \
external_##type##_array)
- ALLOCATE_EXTERNAL_ARRAY_MAP(PIXEL, pixel)
- ALLOCATE_EXTERNAL_ARRAY_MAP(BYTE, byte)
- ALLOCATE_EXTERNAL_ARRAY_MAP(UNSIGNED_BYTE, unsigned_byte)
- ALLOCATE_EXTERNAL_ARRAY_MAP(SHORT, short) // NOLINT
- ALLOCATE_EXTERNAL_ARRAY_MAP(UNSIGNED_SHORT, unsigned_short)
- ALLOCATE_EXTERNAL_ARRAY_MAP(INT, int)
- ALLOCATE_EXTERNAL_ARRAY_MAP(UNSIGNED_INT, unsigned_int)
- ALLOCATE_EXTERNAL_ARRAY_MAP(FLOAT, float)
- ALLOCATE_EXTERNAL_ARRAY_MAP(DOUBLE, double)
+ TYPED_ARRAYS(ALLOCATE_EXTERNAL_ARRAY_MAP)
#undef ALLOCATE_EXTERNAL_ARRAY_MAP
- ALLOCATE_VARSIZE_MAP(FIXED_UINT8_ARRAY_TYPE, fixed_uint8_array)
- ALLOCATE_VARSIZE_MAP(FIXED_UINT8_CLAMPED_ARRAY_TYPE,
- fixed_uint8_clamped_array)
- ALLOCATE_VARSIZE_MAP(FIXED_INT8_ARRAY_TYPE, fixed_int8_array)
- ALLOCATE_VARSIZE_MAP(FIXED_UINT16_ARRAY_TYPE, fixed_uint16_array)
- ALLOCATE_VARSIZE_MAP(FIXED_INT16_ARRAY_TYPE, fixed_int16_array)
- ALLOCATE_VARSIZE_MAP(FIXED_UINT32_ARRAY_TYPE, fixed_uint32_array)
- ALLOCATE_VARSIZE_MAP(FIXED_INT32_ARRAY_TYPE, fixed_int32_array)
- ALLOCATE_VARSIZE_MAP(FIXED_FLOAT32_ARRAY_TYPE, fixed_float32_array)
- ALLOCATE_VARSIZE_MAP(FIXED_FLOAT64_ARRAY_TYPE, fixed_float64_array)
+#define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \
+ ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, \
+ fixed_##type##_array)
+
+ TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP)
+#undef ALLOCATE_FIXED_TYPED_ARRAY_MAP
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, non_strict_arguments_elements)
set_empty_byte_array(byte_array);
}
-#define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type) \
+#define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
{ ExternalArray* obj; \
if (!AllocateEmptyExternalArray(kExternal##Type##Array)->To(&obj)) \
return false; \
set_empty_external_##type##_array(obj); \
}
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Byte, byte)
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(UnsignedByte, unsigned_byte)
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Short, short) // NOLINT
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(UnsignedShort, unsigned_short)
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Int, int)
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(UnsignedInt, unsigned_int)
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Float, float)
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Double, double)
- ALLOCATE_EMPTY_EXTERNAL_ARRAY(Pixel, pixel)
+ TYPED_ARRAYS(ALLOCATE_EMPTY_EXTERNAL_ARRAY)
#undef ALLOCATE_EMPTY_EXTERNAL_ARRAY
}
ASSERT(!InNewSpace(empty_fixed_array()));
Heap::RootListIndex Heap::RootIndexForExternalArrayType(
ExternalArrayType array_type) {
switch (array_type) {
- case kExternalByteArray:
- return kExternalByteArrayMapRootIndex;
- case kExternalUnsignedByteArray:
- return kExternalUnsignedByteArrayMapRootIndex;
- case kExternalShortArray:
- return kExternalShortArrayMapRootIndex;
- case kExternalUnsignedShortArray:
- return kExternalUnsignedShortArrayMapRootIndex;
- case kExternalIntArray:
- return kExternalIntArrayMapRootIndex;
- case kExternalUnsignedIntArray:
- return kExternalUnsignedIntArrayMapRootIndex;
- case kExternalFloatArray:
- return kExternalFloatArrayMapRootIndex;
- case kExternalDoubleArray:
- return kExternalDoubleArrayMapRootIndex;
- case kExternalPixelArray:
- return kExternalPixelArrayMapRootIndex;
+#define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return kExternal##Type##ArrayMapRootIndex;
+
+ TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX)
+#undef ARRAY_TYPE_TO_ROOT_INDEX
+
default:
UNREACHABLE();
return kUndefinedValueRootIndex;
Heap::RootListIndex Heap::RootIndexForFixedTypedArray(
ExternalArrayType array_type) {
switch (array_type) {
- case kExternalByteArray:
- return kFixedInt8ArrayMapRootIndex;
- case kExternalUnsignedByteArray:
- return kFixedUint8ArrayMapRootIndex;
- case kExternalShortArray:
- return kFixedInt16ArrayMapRootIndex;
- case kExternalUnsignedShortArray:
- return kFixedUint16ArrayMapRootIndex;
- case kExternalIntArray:
- return kFixedInt32ArrayMapRootIndex;
- case kExternalUnsignedIntArray:
- return kFixedUint32ArrayMapRootIndex;
- case kExternalFloatArray:
- return kFixedFloat32ArrayMapRootIndex;
- case kExternalDoubleArray:
- return kFixedFloat64ArrayMapRootIndex;
- case kExternalPixelArray:
- return kFixedUint8ClampedArrayMapRootIndex;
+#define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return kFixed##Type##ArrayMapRootIndex;
+
+ TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX)
+#undef ARRAY_TYPE_TO_ROOT_INDEX
+
default:
UNREACHABLE();
return kUndefinedValueRootIndex;
Heap::RootListIndex Heap::RootIndexForEmptyExternalArray(
ElementsKind elementsKind) {
switch (elementsKind) {
- case EXTERNAL_BYTE_ELEMENTS:
- return kEmptyExternalByteArrayRootIndex;
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- return kEmptyExternalUnsignedByteArrayRootIndex;
- case EXTERNAL_SHORT_ELEMENTS:
- return kEmptyExternalShortArrayRootIndex;
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- return kEmptyExternalUnsignedShortArrayRootIndex;
- case EXTERNAL_INT_ELEMENTS:
- return kEmptyExternalIntArrayRootIndex;
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- return kEmptyExternalUnsignedIntArrayRootIndex;
- case EXTERNAL_FLOAT_ELEMENTS:
- return kEmptyExternalFloatArrayRootIndex;
- case EXTERNAL_DOUBLE_ELEMENTS:
- return kEmptyExternalDoubleArrayRootIndex;
- case EXTERNAL_PIXEL_ELEMENTS:
- return kEmptyExternalPixelArrayRootIndex;
+#define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ return kEmptyExternal##Type##ArrayRootIndex;
+
+ TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX)
+#undef ELEMENT_KIND_TO_ROOT_INDEX
+
default:
UNREACHABLE();
return kUndefinedValueRootIndex;
int* element_size,
ElementsKind* element_kind) {
switch (array_type) {
- case kExternalUnsignedByteArray:
- *element_size = 1;
- *element_kind = UINT8_ELEMENTS;
- return;
- case kExternalByteArray:
- *element_size = 1;
- *element_kind = INT8_ELEMENTS;
- return;
- case kExternalUnsignedShortArray:
- *element_size = 2;
- *element_kind = UINT16_ELEMENTS;
- return;
- case kExternalShortArray:
- *element_size = 2;
- *element_kind = INT16_ELEMENTS;
- return;
- case kExternalUnsignedIntArray:
- *element_size = 4;
- *element_kind = UINT32_ELEMENTS;
- return;
- case kExternalIntArray:
- *element_size = 4;
- *element_kind = INT32_ELEMENTS;
- return;
- case kExternalFloatArray:
- *element_size = 4;
- *element_kind = FLOAT32_ELEMENTS;
- return;
- case kExternalDoubleArray:
- *element_size = 8;
- *element_kind = FLOAT64_ELEMENTS;
- return;
- case kExternalPixelArray:
- *element_size = 1;
- *element_kind = UINT8_CLAMPED_ELEMENTS;
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ *element_size = size; \
+ *element_kind = TYPE##_ELEMENTS; \
return;
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+
default:
*element_size = 0; // Bogus
*element_kind = UINT8_ELEMENTS; // Bogus
int size = OBJECT_POINTER_ALIGN(
length * element_size + FixedTypedArrayBase::kDataOffset);
#ifndef V8_HOST_ARCH_64_BIT
- if (array_type == kExternalDoubleArray) {
+ if (array_type == kExternalFloat64Array) {
size += kPointerSize;
}
#endif
MaybeObject* maybe_object = AllocateRaw(size, space, OLD_DATA_SPACE);
if (!maybe_object->To(&object)) return maybe_object;
- if (array_type == kExternalDoubleArray) {
+ if (array_type == kExternalFloat64Array) {
object = EnsureDoubleAligned(this, object, size);
}
V(Map, short_external_ascii_string_map, ShortExternalAsciiStringMap) \
V(Map, undetectable_string_map, UndetectableStringMap) \
V(Map, undetectable_ascii_string_map, UndetectableAsciiStringMap) \
- V(Map, external_byte_array_map, ExternalByteArrayMap) \
- V(Map, external_unsigned_byte_array_map, ExternalUnsignedByteArrayMap) \
- V(Map, external_short_array_map, ExternalShortArrayMap) \
- V(Map, external_unsigned_short_array_map, ExternalUnsignedShortArrayMap) \
- V(Map, external_int_array_map, ExternalIntArrayMap) \
- V(Map, external_unsigned_int_array_map, ExternalUnsignedIntArrayMap) \
- V(Map, external_float_array_map, ExternalFloatArrayMap) \
- V(Map, external_double_array_map, ExternalDoubleArrayMap) \
- V(Map, external_pixel_array_map, ExternalPixelArrayMap) \
- V(ExternalArray, empty_external_byte_array, \
- EmptyExternalByteArray) \
- V(ExternalArray, empty_external_unsigned_byte_array, \
- EmptyExternalUnsignedByteArray) \
- V(ExternalArray, empty_external_short_array, EmptyExternalShortArray) \
- V(ExternalArray, empty_external_unsigned_short_array, \
- EmptyExternalUnsignedShortArray) \
- V(ExternalArray, empty_external_int_array, EmptyExternalIntArray) \
- V(ExternalArray, empty_external_unsigned_int_array, \
- EmptyExternalUnsignedIntArray) \
- V(ExternalArray, empty_external_float_array, EmptyExternalFloatArray) \
- V(ExternalArray, empty_external_double_array, EmptyExternalDoubleArray) \
- V(ExternalArray, empty_external_pixel_array, \
- EmptyExternalPixelArray) \
+ V(Map, external_int8_array_map, ExternalInt8ArrayMap) \
+ V(Map, external_uint8_array_map, ExternalUint8ArrayMap) \
+ V(Map, external_int16_array_map, ExternalInt16ArrayMap) \
+ V(Map, external_uint16_array_map, ExternalUint16ArrayMap) \
+ V(Map, external_int32_array_map, ExternalInt32ArrayMap) \
+ V(Map, external_uint32_array_map, ExternalUint32ArrayMap) \
+ V(Map, external_float32_array_map, ExternalFloat32ArrayMap) \
+ V(Map, external_float64_array_map, ExternalFloat64ArrayMap) \
+ V(Map, external_uint8_clamped_array_map, ExternalUint8ClampedArrayMap) \
+ V(ExternalArray, empty_external_int8_array, \
+ EmptyExternalInt8Array) \
+ V(ExternalArray, empty_external_uint8_array, \
+ EmptyExternalUint8Array) \
+ V(ExternalArray, empty_external_int16_array, EmptyExternalInt16Array) \
+ V(ExternalArray, empty_external_uint16_array, \
+ EmptyExternalUint16Array) \
+ V(ExternalArray, empty_external_int32_array, EmptyExternalInt32Array) \
+ V(ExternalArray, empty_external_uint32_array, \
+ EmptyExternalUint32Array) \
+ V(ExternalArray, empty_external_float32_array, EmptyExternalFloat32Array) \
+ V(ExternalArray, empty_external_float64_array, EmptyExternalFloat64Array) \
+ V(ExternalArray, empty_external_uint8_clamped_array, \
+ EmptyExternalUint8ClampedArray) \
V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \
V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \
V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \
Range* HLoadKeyed::InferRange(Zone* zone) {
switch (elements_kind()) {
- case EXTERNAL_BYTE_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
return new(zone) Range(kMinInt8, kMaxInt8);
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
return new(zone) Range(kMinUInt8, kMaxUInt8);
- case EXTERNAL_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
return new(zone) Range(kMinInt16, kMaxInt16);
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
return new(zone) Range(kMinUInt16, kMaxUInt16);
default:
return HValue::InferRange(zone);
kIsDead,
// Instructions that are allowed to produce full range unsigned integer
// values are marked with kUint32 flag. If arithmetic shift or a load from
- // EXTERNAL_UNSIGNED_INT_ELEMENTS array is not marked with this flag
+ // EXTERNAL_UINT32_ELEMENTS array is not marked with this flag
// it will deoptimize if result does not fit into signed integer range.
// HGraph::ComputeSafeUint32Operations is responsible for setting this
// flag.
SetGVNFlag(kDependsOnDoubleArrayElements);
}
} else {
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
- elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
set_representation(Representation::Double());
}
// EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating.
- if ((elements_kind >= EXTERNAL_BYTE_ELEMENTS &&
- elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) ||
+ if ((elements_kind >= EXTERNAL_INT8_ELEMENTS &&
+ elements_kind <= EXTERNAL_UINT32_ELEMENTS) ||
(elements_kind >= UINT8_ELEMENTS &&
elements_kind <= INT32_ELEMENTS)) {
SetFlag(kTruncatingToInt32);
// operation.
if (store->value() == val) {
// Clamping or a conversion to double should have beed inserted.
- ASSERT(store->elements_kind() != EXTERNAL_PIXEL_ELEMENTS);
- ASSERT(store->elements_kind() != EXTERNAL_FLOAT_ELEMENTS);
- ASSERT(store->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS);
+ ASSERT(store->elements_kind() != EXTERNAL_UINT8_CLAMPED_ELEMENTS);
+ ASSERT(store->elements_kind() != EXTERNAL_FLOAT32_ELEMENTS);
+ ASSERT(store->elements_kind() != EXTERNAL_FLOAT64_ELEMENTS);
return true;
}
}
LoadKeyedHoleMode load_mode) {
if (is_store) {
ASSERT(val != NULL);
- if (elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
+ if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
elements_kind == UINT8_CLAMPED_ELEMENTS) {
val = Add<HClampToUint8>(val);
}
HLoadKeyed* load = Add<HLoadKeyed>(
elements, checked_key, dependency, elements_kind, load_mode);
if (FLAG_opt_safe_uint32_operations &&
- (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS ||
+ (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
elements_kind == UINT32_ELEMENTS)) {
graph()->RecordUint32Instruction(load);
}
BuildArrayBufferViewInitialization<JSTypedArray>(
obj, buffer, byte_offset, byte_length);
- ExternalArrayType array_type = kExternalByteArray; // Bogus initialization.
+ ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
size_t element_size = 1; // Bogus initialization.
Runtime::ArrayIdToTypeAndSize(array_id, &array_type, &element_size);
elements_kind,
0,
instr->additional_index()));
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
if (CpuFeatures::IsSupported(SSE2)) {
CpuFeatureScope scope(masm(), SSE2);
} else {
X87Mov(ToX87Register(instr->result()), operand, kX87FloatOperand);
}
- } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
if (CpuFeatures::IsSupported(SSE2)) {
CpuFeatureScope scope(masm(), SSE2);
} else {
Register result(ToRegister(instr->result()));
switch (elements_kind) {
- case EXTERNAL_BYTE_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
case INT8_ELEMENTS:
__ movsx_b(result, operand);
break;
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
__ movzx_b(result, operand);
break;
- case EXTERNAL_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
case INT16_ELEMENTS:
__ movsx_w(result, operand);
break;
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
__ movzx_w(result, operand);
break;
- case EXTERNAL_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
case INT32_ELEMENTS:
__ mov(result, operand);
break;
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case UINT32_ELEMENTS:
__ mov(result, operand);
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
DeoptimizeIf(negative, instr->environment());
}
break;
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
case FAST_SMI_ELEMENTS:
elements_kind,
0,
instr->additional_index()));
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
CpuFeatureScope scope(masm(), SSE2);
__ fld(0);
__ fstp_s(operand);
}
- } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
CpuFeatureScope scope(masm(), SSE2);
} else {
Register value = ToRegister(instr->value());
switch (elements_kind) {
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
case UINT8_ELEMENTS:
case INT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
__ mov_b(operand, value);
break;
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
case INT16_ELEMENTS:
__ mov_w(operand, value);
break;
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case UINT32_ELEMENTS:
case INT32_ELEMENTS:
__ mov(operand, value);
break;
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
case FAST_SMI_ELEMENTS:
DefineAsRegister(result);
bool can_deoptimize = instr->RequiresHoleCheck() ||
- (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
+ (elements_kind == EXTERNAL_UINT32_ELEMENTS);
// An unsigned int array load might overflow and cause a deopt, make sure it
// has an environment.
return can_deoptimize ? AssignEnvironment(result) : result;
// Determine if we need a byte register in this case for the value.
bool val_is_fixed_register =
- elements_kind == EXTERNAL_BYTE_ELEMENTS ||
- elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS ||
- elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
+ elements_kind == EXTERNAL_INT8_ELEMENTS ||
+ elements_kind == EXTERNAL_UINT8_ELEMENTS ||
+ elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
elements_kind == UINT8_ELEMENTS ||
elements_kind == INT8_ELEMENTS ||
elements_kind == UINT8_CLAMPED_ELEMENTS;
// an index cannot fold the scale operation into a load and need an extra
// temp register to do the work.
return key_representation.IsSmi() &&
- (elements_kind == EXTERNAL_BYTE_ELEMENTS ||
- elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS ||
- elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
+ (elements_kind == EXTERNAL_INT8_ELEMENTS ||
+ elements_kind == EXTERNAL_UINT8_ELEMENTS ||
+ elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
elements_kind == UINT8_ELEMENTS ||
elements_kind == INT8_ELEMENTS ||
elements_kind == UINT8_CLAMPED_ELEMENTS);
? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
: 0;
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS ||
- elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
int base_offset =
(instr->additional_index() << element_size_shift) + additional_offset;
__ sll(scratch0(), key, shift_size);
__ Addu(scratch0(), scratch0(), external_pointer);
}
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
__ lwc1(result, MemOperand(scratch0(), base_offset));
__ cvt_d_s(result, result);
element_size_shift, shift_size,
instr->additional_index(), additional_offset);
switch (elements_kind) {
- case EXTERNAL_BYTE_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
case INT8_ELEMENTS:
__ lb(result, mem_operand);
break;
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
__ lbu(result, mem_operand);
break;
- case EXTERNAL_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
case INT16_ELEMENTS:
__ lh(result, mem_operand);
break;
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
__ lhu(result, mem_operand);
break;
- case EXTERNAL_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
case INT32_ELEMENTS:
__ lw(result, mem_operand);
break;
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case UINT32_ELEMENTS:
__ lw(result, mem_operand);
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
break;
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_ELEMENTS:
case FAST_SMI_ELEMENTS:
? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
: 0;
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS ||
- elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
int base_offset =
(instr->additional_index() << element_size_shift) + additional_offset;
__ Addu(address, external_pointer, address);
}
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
__ cvt_s_d(double_scratch0(), value);
__ swc1(double_scratch0(), MemOperand(address, base_offset));
element_size_shift, shift_size,
instr->additional_index(), additional_offset);
switch (elements_kind) {
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
case INT8_ELEMENTS:
__ sb(value, mem_operand);
break;
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case INT16_ELEMENTS:
case UINT16_ELEMENTS:
__ sh(value, mem_operand);
break;
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case INT32_ELEMENTS:
case UINT32_ELEMENTS:
__ sw(value, mem_operand);
break;
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_ELEMENTS:
case FAST_SMI_ELEMENTS:
// An unsigned int array load might overflow and cause a deopt, make sure it
// has an environment.
bool can_deoptimize = instr->RequiresHoleCheck() ||
- elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS ||
+ elements_kind == EXTERNAL_UINT32_ELEMENTS ||
elements_kind == UINT32_ELEMENTS;
return can_deoptimize ? AssignEnvironment(result) : result;
}
case FREE_SPACE_TYPE:
FreeSpace::cast(this)->FreeSpaceVerify();
break;
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- ExternalPixelArray::cast(this)->ExternalPixelArrayVerify();
- break;
- case EXTERNAL_BYTE_ARRAY_TYPE:
- ExternalByteArray::cast(this)->ExternalByteArrayVerify();
- break;
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- ExternalUnsignedByteArray::cast(this)->ExternalUnsignedByteArrayVerify();
- break;
- case EXTERNAL_SHORT_ARRAY_TYPE:
- ExternalShortArray::cast(this)->ExternalShortArrayVerify();
- break;
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- ExternalUnsignedShortArray::cast(this)->
- ExternalUnsignedShortArrayVerify();
- break;
- case EXTERNAL_INT_ARRAY_TYPE:
- ExternalIntArray::cast(this)->ExternalIntArrayVerify();
- break;
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayVerify();
- break;
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- ExternalFloatArray::cast(this)->ExternalFloatArrayVerify();
- break;
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
- ExternalDoubleArray::cast(this)->ExternalDoubleArrayVerify();
- break;
- case FIXED_UINT8_ARRAY_TYPE:
- FixedUint8Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_INT8_ARRAY_TYPE:
- FixedInt8Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_UINT16_ARRAY_TYPE:
- FixedUint16Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_INT16_ARRAY_TYPE:
- FixedInt16Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_UINT32_ARRAY_TYPE:
- FixedUint32Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_INT32_ARRAY_TYPE:
- FixedInt32Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_FLOAT32_ARRAY_TYPE:
- FixedFloat32Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_FLOAT64_ARRAY_TYPE:
- FixedFloat64Array::cast(this)->FixedTypedArrayVerify();
- break;
- case FIXED_UINT8_CLAMPED_ARRAY_TYPE:
- FixedUint8ClampedArray::cast(this)->FixedTypedArrayVerify();
+
+#define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ External##Type##Array::cast(this)->External##Type##ArrayVerify(); \
+ break; \
+ case FIXED_##TYPE##_ARRAY_TYPE: \
+ Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \
break;
+
+ TYPED_ARRAYS(VERIFY_TYPED_ARRAY)
+#undef VERIFY_TYPED_ARRAY
+
case CODE_TYPE:
Code::cast(this)->CodeVerify();
break;
}
-void ExternalPixelArray::ExternalPixelArrayVerify() {
- CHECK(IsExternalPixelArray());
-}
-
-
-void ExternalByteArray::ExternalByteArrayVerify() {
- CHECK(IsExternalByteArray());
-}
-
-
-void ExternalUnsignedByteArray::ExternalUnsignedByteArrayVerify() {
- CHECK(IsExternalUnsignedByteArray());
-}
-
-
-void ExternalShortArray::ExternalShortArrayVerify() {
- CHECK(IsExternalShortArray());
-}
-
-
-void ExternalUnsignedShortArray::ExternalUnsignedShortArrayVerify() {
- CHECK(IsExternalUnsignedShortArray());
-}
-
-
-void ExternalIntArray::ExternalIntArrayVerify() {
- CHECK(IsExternalIntArray());
-}
-
-
-void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() {
- CHECK(IsExternalUnsignedIntArray());
-}
-
-
-void ExternalFloatArray::ExternalFloatArrayVerify() {
- CHECK(IsExternalFloatArray());
-}
-
+#define EXTERNAL_ARRAY_VERIFY(Type, type, TYPE, ctype, size) \
+ void External##Type##Array::External##Type##ArrayVerify() { \
+ CHECK(IsExternal##Type##Array()); \
+ }
-void ExternalDoubleArray::ExternalDoubleArrayVerify() {
- CHECK(IsExternalDoubleArray());
-}
+TYPED_ARRAYS(EXTERNAL_ARRAY_VERIFY)
+#undef EXTERNAL_ARRAY_VERIFY
template <class Traits>
info->number_of_fast_unused_elements_ += holes;
break;
}
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS: {
- info->number_of_objects_with_fast_elements_++;
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS:
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+ { info->number_of_objects_with_fast_elements_++;
FixedArrayBase* e = FixedArrayBase::cast(elements());
info->number_of_fast_used_elements_ += e->length();
break;
}
-TYPE_CHECKER(ExternalPixelArray, EXTERNAL_PIXEL_ARRAY_TYPE)
-
-
bool Object::IsExternalArray() {
if (!Object::IsHeapObject())
return false;
}
-TYPE_CHECKER(ExternalByteArray, EXTERNAL_BYTE_ARRAY_TYPE)
-TYPE_CHECKER(ExternalUnsignedByteArray, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE)
-TYPE_CHECKER(ExternalShortArray, EXTERNAL_SHORT_ARRAY_TYPE)
-TYPE_CHECKER(ExternalUnsignedShortArray, EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE)
-TYPE_CHECKER(ExternalIntArray, EXTERNAL_INT_ARRAY_TYPE)
-TYPE_CHECKER(ExternalUnsignedIntArray, EXTERNAL_UNSIGNED_INT_ARRAY_TYPE)
-TYPE_CHECKER(ExternalFloatArray, EXTERNAL_FLOAT_ARRAY_TYPE)
-TYPE_CHECKER(ExternalDoubleArray, EXTERNAL_DOUBLE_ARRAY_TYPE)
+#define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \
+ TYPE_CHECKER(External##Type##Array, EXTERNAL_##TYPE##_ARRAY_TYPE) \
+ TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE)
+
+TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER)
+#undef TYPED_ARRAY_TYPE_CHECKER
bool Object::IsFixedTypedArrayBase() {
}
-TYPE_CHECKER(FixedUint8Array, FIXED_UINT8_ARRAY_TYPE)
-TYPE_CHECKER(FixedInt8Array, FIXED_INT8_ARRAY_TYPE)
-TYPE_CHECKER(FixedUint16Array, FIXED_UINT16_ARRAY_TYPE)
-TYPE_CHECKER(FixedInt16Array, FIXED_INT16_ARRAY_TYPE)
-TYPE_CHECKER(FixedUint32Array, FIXED_UINT32_ARRAY_TYPE)
-TYPE_CHECKER(FixedInt32Array, FIXED_INT32_ARRAY_TYPE)
-TYPE_CHECKER(FixedFloat32Array, FIXED_FLOAT32_ARRAY_TYPE)
-TYPE_CHECKER(FixedFloat64Array, FIXED_FLOAT64_ARRAY_TYPE)
-TYPE_CHECKER(FixedUint8ClampedArray, FIXED_UINT8_CLAMPED_ARRAY_TYPE)
-
-
bool MaybeObject::IsFailure() {
return HAS_FAILURE_TAG(this);
}
CAST_ACCESSOR(ByteArray)
CAST_ACCESSOR(FreeSpace)
CAST_ACCESSOR(ExternalArray)
-CAST_ACCESSOR(ExternalByteArray)
-CAST_ACCESSOR(ExternalUnsignedByteArray)
-CAST_ACCESSOR(ExternalShortArray)
-CAST_ACCESSOR(ExternalUnsignedShortArray)
-CAST_ACCESSOR(ExternalIntArray)
-CAST_ACCESSOR(ExternalUnsignedIntArray)
-CAST_ACCESSOR(ExternalFloatArray)
-CAST_ACCESSOR(ExternalDoubleArray)
-CAST_ACCESSOR(ExternalPixelArray)
+CAST_ACCESSOR(ExternalInt8Array)
+CAST_ACCESSOR(ExternalUint8Array)
+CAST_ACCESSOR(ExternalInt16Array)
+CAST_ACCESSOR(ExternalUint16Array)
+CAST_ACCESSOR(ExternalInt32Array)
+CAST_ACCESSOR(ExternalUint32Array)
+CAST_ACCESSOR(ExternalFloat32Array)
+CAST_ACCESSOR(ExternalFloat64Array)
+CAST_ACCESSOR(ExternalUint8ClampedArray)
CAST_ACCESSOR(Struct)
CAST_ACCESSOR(AccessorInfo)
}
-uint8_t* ExternalPixelArray::external_pixel_pointer() {
+uint8_t* ExternalUint8ClampedArray::external_uint8_clamped_pointer() {
return reinterpret_cast<uint8_t*>(external_pointer());
}
-uint8_t ExternalPixelArray::get_scalar(int index) {
+uint8_t ExternalUint8ClampedArray::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
- uint8_t* ptr = external_pixel_pointer();
+ uint8_t* ptr = external_uint8_clamped_pointer();
return ptr[index];
}
-MaybeObject* ExternalPixelArray::get(int index) {
+MaybeObject* ExternalUint8ClampedArray::get(int index) {
return Smi::FromInt(static_cast<int>(get_scalar(index)));
}
-void ExternalPixelArray::set(int index, uint8_t value) {
+void ExternalUint8ClampedArray::set(int index, uint8_t value) {
ASSERT((index >= 0) && (index < this->length()));
- uint8_t* ptr = external_pixel_pointer();
+ uint8_t* ptr = external_uint8_clamped_pointer();
ptr[index] = value;
}
}
-int8_t ExternalByteArray::get_scalar(int index) {
+int8_t ExternalInt8Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
int8_t* ptr = static_cast<int8_t*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalByteArray::get(int index) {
+MaybeObject* ExternalInt8Array::get(int index) {
return Smi::FromInt(static_cast<int>(get_scalar(index)));
}
-void ExternalByteArray::set(int index, int8_t value) {
+void ExternalInt8Array::set(int index, int8_t value) {
ASSERT((index >= 0) && (index < this->length()));
int8_t* ptr = static_cast<int8_t*>(external_pointer());
ptr[index] = value;
}
-uint8_t ExternalUnsignedByteArray::get_scalar(int index) {
+uint8_t ExternalUint8Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalUnsignedByteArray::get(int index) {
+MaybeObject* ExternalUint8Array::get(int index) {
return Smi::FromInt(static_cast<int>(get_scalar(index)));
}
-void ExternalUnsignedByteArray::set(int index, uint8_t value) {
+void ExternalUint8Array::set(int index, uint8_t value) {
ASSERT((index >= 0) && (index < this->length()));
uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
ptr[index] = value;
}
-int16_t ExternalShortArray::get_scalar(int index) {
+int16_t ExternalInt16Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
int16_t* ptr = static_cast<int16_t*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalShortArray::get(int index) {
+MaybeObject* ExternalInt16Array::get(int index) {
return Smi::FromInt(static_cast<int>(get_scalar(index)));
}
-void ExternalShortArray::set(int index, int16_t value) {
+void ExternalInt16Array::set(int index, int16_t value) {
ASSERT((index >= 0) && (index < this->length()));
int16_t* ptr = static_cast<int16_t*>(external_pointer());
ptr[index] = value;
}
-uint16_t ExternalUnsignedShortArray::get_scalar(int index) {
+uint16_t ExternalUint16Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalUnsignedShortArray::get(int index) {
+MaybeObject* ExternalUint16Array::get(int index) {
return Smi::FromInt(static_cast<int>(get_scalar(index)));
}
-void ExternalUnsignedShortArray::set(int index, uint16_t value) {
+void ExternalUint16Array::set(int index, uint16_t value) {
ASSERT((index >= 0) && (index < this->length()));
uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
ptr[index] = value;
}
-int32_t ExternalIntArray::get_scalar(int index) {
+int32_t ExternalInt32Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
int32_t* ptr = static_cast<int32_t*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalIntArray::get(int index) {
+MaybeObject* ExternalInt32Array::get(int index) {
return GetHeap()->NumberFromInt32(get_scalar(index));
}
-void ExternalIntArray::set(int index, int32_t value) {
+void ExternalInt32Array::set(int index, int32_t value) {
ASSERT((index >= 0) && (index < this->length()));
int32_t* ptr = static_cast<int32_t*>(external_pointer());
ptr[index] = value;
}
-uint32_t ExternalUnsignedIntArray::get_scalar(int index) {
+uint32_t ExternalUint32Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalUnsignedIntArray::get(int index) {
+MaybeObject* ExternalUint32Array::get(int index) {
return GetHeap()->NumberFromUint32(get_scalar(index));
}
-void ExternalUnsignedIntArray::set(int index, uint32_t value) {
+void ExternalUint32Array::set(int index, uint32_t value) {
ASSERT((index >= 0) && (index < this->length()));
uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
ptr[index] = value;
}
-float ExternalFloatArray::get_scalar(int index) {
+float ExternalFloat32Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
float* ptr = static_cast<float*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalFloatArray::get(int index) {
+MaybeObject* ExternalFloat32Array::get(int index) {
return GetHeap()->NumberFromDouble(get_scalar(index));
}
-void ExternalFloatArray::set(int index, float value) {
+void ExternalFloat32Array::set(int index, float value) {
ASSERT((index >= 0) && (index < this->length()));
float* ptr = static_cast<float*>(external_pointer());
ptr[index] = value;
}
-double ExternalDoubleArray::get_scalar(int index) {
+double ExternalFloat64Array::get_scalar(int index) {
ASSERT((index >= 0) && (index < this->length()));
double* ptr = static_cast<double*>(external_pointer());
return ptr[index];
}
-MaybeObject* ExternalDoubleArray::get(int index) {
+MaybeObject* ExternalFloat64Array::get(int index) {
return GetHeap()->NumberFromDouble(get_scalar(index));
}
-void ExternalDoubleArray::set(int index, double value) {
+void ExternalFloat64Array::set(int index, double value) {
ASSERT((index >= 0) && (index < this->length()));
double* ptr = static_cast<double*>(external_pointer());
ptr[index] = value;
}
-#define EXTERNAL_ELEMENTS_CHECK(name, type) \
-bool JSObject::HasExternal##name##Elements() { \
- HeapObject* array = elements(); \
- ASSERT(array != NULL); \
- if (!array->IsHeapObject()) \
- return false; \
- return array->map()->instance_type() == type; \
+#define EXTERNAL_ELEMENTS_CHECK(Type, type, TYPE, ctype, size) \
+bool JSObject::HasExternal##Type##Elements() { \
+ HeapObject* array = elements(); \
+ ASSERT(array != NULL); \
+ if (!array->IsHeapObject()) \
+ return false; \
+ return array->map()->instance_type() == EXTERNAL_##TYPE##_ARRAY_TYPE; \
}
+TYPED_ARRAYS(EXTERNAL_ELEMENTS_CHECK)
-EXTERNAL_ELEMENTS_CHECK(Byte, EXTERNAL_BYTE_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(UnsignedByte, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(Short, EXTERNAL_SHORT_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(UnsignedShort,
- EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(Int, EXTERNAL_INT_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(UnsignedInt,
- EXTERNAL_UNSIGNED_INT_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(Float,
- EXTERNAL_FLOAT_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(Double,
- EXTERNAL_DOUBLE_ARRAY_TYPE)
-EXTERNAL_ELEMENTS_CHECK(Pixel, EXTERNAL_PIXEL_ARRAY_TYPE)
+#undef EXTERNAL_ELEMENTS_CHECK
bool JSObject::HasFixedTypedArrayElements() {
case FREE_SPACE_TYPE:
FreeSpace::cast(this)->FreeSpacePrint(out);
break;
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- ExternalPixelArray::cast(this)->ExternalPixelArrayPrint(out);
- break;
- case EXTERNAL_BYTE_ARRAY_TYPE:
- ExternalByteArray::cast(this)->ExternalByteArrayPrint(out);
- break;
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- ExternalUnsignedByteArray::cast(this)
- ->ExternalUnsignedByteArrayPrint(out);
- break;
- case EXTERNAL_SHORT_ARRAY_TYPE:
- ExternalShortArray::cast(this)->ExternalShortArrayPrint(out);
- break;
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- ExternalUnsignedShortArray::cast(this)
- ->ExternalUnsignedShortArrayPrint(out);
- break;
- case EXTERNAL_INT_ARRAY_TYPE:
- ExternalIntArray::cast(this)->ExternalIntArrayPrint(out);
- break;
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out);
- break;
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out);
- break;
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
- ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out);
+
+#define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ External##Type##Array::cast(this)->External##Type##ArrayPrint(out); \
break;
-#define PRINT_FIXED_TYPED_ARRAY(Type) \
+
+ TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY)
+#undef PRINT_EXTERNAL_ARRAY
+
+#define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
case Fixed##Type##Array::kInstanceType: \
Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \
break;
- PRINT_FIXED_TYPED_ARRAY(Uint8)
- PRINT_FIXED_TYPED_ARRAY(Int8)
- PRINT_FIXED_TYPED_ARRAY(Uint16)
- PRINT_FIXED_TYPED_ARRAY(Int16)
- PRINT_FIXED_TYPED_ARRAY(Uint32)
- PRINT_FIXED_TYPED_ARRAY(Int32)
- PRINT_FIXED_TYPED_ARRAY(Float32)
- PRINT_FIXED_TYPED_ARRAY(Float64)
- PRINT_FIXED_TYPED_ARRAY(Uint8Clamped)
-
-#undef PPINT_FIXED_TYPED_ARRAY
-
+ TYPED_ARRAYS(PRINT_FIXED_TYPED_ARRAY)
+#undef PRINT_FIXED_TYPED_ARRAY
case FILLER_TYPE:
PrintF(out, "filler");
}
-void ExternalPixelArray::ExternalPixelArrayPrint(FILE* out) {
- PrintF(out, "external pixel array");
-}
-
-
-void ExternalByteArray::ExternalByteArrayPrint(FILE* out) {
- PrintF(out, "external byte array");
-}
-
-
-void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) {
- PrintF(out, "external unsigned byte array");
-}
-
-
-void ExternalShortArray::ExternalShortArrayPrint(FILE* out) {
- PrintF(out, "external short array");
-}
-
-
-void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) {
- PrintF(out, "external unsigned short array");
-}
-
-
-void ExternalIntArray::ExternalIntArrayPrint(FILE* out) {
- PrintF(out, "external int array");
-}
-
-
-void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) {
- PrintF(out, "external unsigned int array");
-}
-
+#define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
+ void External##Type##Array::External##Type##ArrayPrint(FILE* out) { \
+ PrintF(out, "external " #type " array"); \
+ }
-void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) {
- PrintF(out, "external float array");
-}
+TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
+#undef EXTERNAL_ARRAY_PRINTER
-void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) {
- PrintF(out, "external double array");
-}
template <class Traits>
void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) {
break; \
}
- PRINT_ELEMENTS(EXTERNAL_PIXEL_ELEMENTS, ExternalPixelArray)
- PRINT_ELEMENTS(EXTERNAL_BYTE_ELEMENTS, ExternalByteArray)
- PRINT_ELEMENTS(EXTERNAL_UNSIGNED_BYTE_ELEMENTS,
- ExternalUnsignedByteArray)
- PRINT_ELEMENTS(EXTERNAL_SHORT_ELEMENTS, ExternalShortArray)
- PRINT_ELEMENTS(EXTERNAL_UNSIGNED_SHORT_ELEMENTS,
- ExternalUnsignedShortArray)
- PRINT_ELEMENTS(EXTERNAL_INT_ELEMENTS, ExternalIntArray)
- PRINT_ELEMENTS(EXTERNAL_UNSIGNED_INT_ELEMENTS,
- ExternalUnsignedIntArray)
- PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT_ELEMENTS, ExternalFloatArray)
- PRINT_DOUBLE_ELEMENTS(EXTERNAL_DOUBLE_ELEMENTS, ExternalDoubleArray)
+ PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray)
+ PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array)
+ PRINT_ELEMENTS(EXTERNAL_UINT8_ELEMENTS,
+ ExternalUint8Array)
+ PRINT_ELEMENTS(EXTERNAL_INT16_ELEMENTS, ExternalInt16Array)
+ PRINT_ELEMENTS(EXTERNAL_UINT16_ELEMENTS,
+ ExternalUint16Array)
+ PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array)
+ PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS,
+ ExternalUint32Array)
+ PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
+ PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
return kVisitJSFunction;
case HEAP_NUMBER_TYPE:
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- case EXTERNAL_BYTE_ARRAY_TYPE:
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- case EXTERNAL_SHORT_ARRAY_TYPE:
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- case EXTERNAL_INT_ARRAY_TYPE:
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
+#define EXTERNAL_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE:
+
+ TYPED_ARRAYS(EXTERNAL_ARRAY_CASE)
return GetVisitorIdForSize(kVisitDataObject,
kVisitDataObjectGeneric,
instance_size);
+#undef EXTERNAL_ARRAY_CASE
case FIXED_UINT8_ARRAY_TYPE:
case FIXED_INT8_ARRAY_TYPE:
case FREE_SPACE_TYPE:
accumulator->Add("<FreeSpace[%u]>", FreeSpace::cast(this)->Size());
break;
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- accumulator->Add("<ExternalPixelArray[%u]>",
- ExternalPixelArray::cast(this)->length());
- break;
- case EXTERNAL_BYTE_ARRAY_TYPE:
- accumulator->Add("<ExternalByteArray[%u]>",
- ExternalByteArray::cast(this)->length());
- break;
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- accumulator->Add("<ExternalUnsignedByteArray[%u]>",
- ExternalUnsignedByteArray::cast(this)->length());
- break;
- case EXTERNAL_SHORT_ARRAY_TYPE:
- accumulator->Add("<ExternalShortArray[%u]>",
- ExternalShortArray::cast(this)->length());
- break;
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- accumulator->Add("<ExternalUnsignedShortArray[%u]>",
- ExternalUnsignedShortArray::cast(this)->length());
- break;
- case EXTERNAL_INT_ARRAY_TYPE:
- accumulator->Add("<ExternalIntArray[%u]>",
- ExternalIntArray::cast(this)->length());
- break;
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- accumulator->Add("<ExternalUnsignedIntArray[%u]>",
- ExternalUnsignedIntArray::cast(this)->length());
- break;
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- accumulator->Add("<ExternalFloatArray[%u]>",
- ExternalFloatArray::cast(this)->length());
- break;
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
- accumulator->Add("<ExternalDoubleArray[%u]>",
- ExternalDoubleArray::cast(this)->length());
- break;
- case FIXED_UINT8_ARRAY_TYPE:
- accumulator->Add("<FixedUint8Array[%u]>",
- FixedUint8Array::cast(this)->length());
+#define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ accumulator->Add("<External" #Type "Array[%u]>", \
+ External##Type##Array::cast(this)->length()); \
+ break; \
+ case FIXED_##TYPE##_ARRAY_TYPE: \
+ accumulator->Add("<Fixed" #Type "Array[%u]>", \
+ Fixed##Type##Array::cast(this)->length()); \
break;
+
+ TYPED_ARRAYS(TYPED_ARRAY_SHORT_PRINT)
+#undef TYPED_ARRAY_SHORT_PRINT
+
case SHARED_FUNCTION_INFO_TYPE: {
SharedFunctionInfo* shared = SharedFunctionInfo::cast(this);
SmartArrayPointer<char> debug_name =
case SYMBOL_TYPE:
Symbol::BodyDescriptor::IterateBody(this, v);
break;
+
case HEAP_NUMBER_TYPE:
case FILLER_TYPE:
case BYTE_ARRAY_TYPE:
case FREE_SPACE_TYPE:
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- case EXTERNAL_BYTE_ARRAY_TYPE:
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- case EXTERNAL_SHORT_ARRAY_TYPE:
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- case EXTERNAL_INT_ARRAY_TYPE:
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
- case FIXED_INT8_ARRAY_TYPE:
- case FIXED_UINT8_ARRAY_TYPE:
- case FIXED_INT16_ARRAY_TYPE:
- case FIXED_UINT16_ARRAY_TYPE:
- case FIXED_INT32_ARRAY_TYPE:
- case FIXED_UINT32_ARRAY_TYPE:
- case FIXED_FLOAT32_ARRAY_TYPE:
- case FIXED_FLOAT64_ARRAY_TYPE:
- case FIXED_UINT8_CLAMPED_ARRAY_TYPE:
break;
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ case FIXED_##TYPE##_ARRAY_TYPE: \
+ break;
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+
case SHARED_FUNCTION_INFO_TYPE: {
SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
break;
// Check if the object is among the indexed properties.
ElementsKind kind = GetElementsKind();
switch (kind) {
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ // Raw pixels and external arrays do not reference other
+ // objects.
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+ break;
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+
case FAST_DOUBLE_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
- // Raw pixels and external arrays do not reference other
- // objects.
break;
case FAST_SMI_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS:
case NON_STRICT_ARGUMENTS_ELEMENTS:
UNIMPLEMENTED();
break;
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+
case FAST_DOUBLE_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
// No contained objects, nothing to do.
break;
}
case FAST_HOLEY_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
break;
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
// Ignore getters and setters on pixel and external array elements.
return;
+
case DICTIONARY_ELEMENTS:
if (UpdateGetterSetterInDictionary(object->element_dictionary(),
index,
case FAST_HOLEY_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
break;
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
// Ignore getters and setters on pixel and external array
// elements.
return factory->undefined_value();
+
case DICTIONARY_ELEMENTS:
break;
case NON_STRICT_ARGUMENTS_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
return SetFastDoubleElement(object, index, value, strict_mode,
check_prototype);
- case EXTERNAL_PIXEL_ELEMENTS: {
- ExternalPixelArray* pixels = ExternalPixelArray::cast(object->elements());
- return handle(pixels->SetValue(index, *value), isolate);
- }
- case EXTERNAL_BYTE_ELEMENTS: {
- Handle<ExternalByteArray> array(
- ExternalByteArray::cast(object->elements()));
- return ExternalByteArray::SetValue(array, index, value);
- }
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
- Handle<ExternalUnsignedByteArray> array(
- ExternalUnsignedByteArray::cast(object->elements()));
- return ExternalUnsignedByteArray::SetValue(array, index, value);
- }
- case EXTERNAL_SHORT_ELEMENTS: {
- Handle<ExternalShortArray> array(ExternalShortArray::cast(
- object->elements()));
- return ExternalShortArray::SetValue(array, index, value);
- }
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
- Handle<ExternalUnsignedShortArray> array(
- ExternalUnsignedShortArray::cast(object->elements()));
- return ExternalUnsignedShortArray::SetValue(array, index, value);
- }
- case EXTERNAL_INT_ELEMENTS: {
- Handle<ExternalIntArray> array(
- ExternalIntArray::cast(object->elements()));
- return ExternalIntArray::SetValue(array, index, value);
- }
- case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
- Handle<ExternalUnsignedIntArray> array(
- ExternalUnsignedIntArray::cast(object->elements()));
- return ExternalUnsignedIntArray::SetValue(array, index, value);
- }
- case EXTERNAL_FLOAT_ELEMENTS: {
- Handle<ExternalFloatArray> array(
- ExternalFloatArray::cast(object->elements()));
- return ExternalFloatArray::SetValue(array, index, value);
- }
- case EXTERNAL_DOUBLE_ELEMENTS: {
- Handle<ExternalDoubleArray> array(
- ExternalDoubleArray::cast(object->elements()));
- return ExternalDoubleArray::SetValue(array, index, value);
- }
- case UINT8_ELEMENTS: {
- Handle<FixedUint8Array> array(
- FixedUint8Array::cast(object->elements()));
- return FixedUint8Array::SetValue(array, index, value);
- }
- case UINT8_CLAMPED_ELEMENTS: {
- Handle<FixedUint8ClampedArray> array(
- FixedUint8ClampedArray::cast(object->elements()));
- return FixedUint8ClampedArray::SetValue(array, index, value);
- }
- case INT8_ELEMENTS: {
- Handle<FixedInt8Array> array(
- FixedInt8Array::cast(object->elements()));
- return FixedInt8Array::SetValue(array, index, value);
- }
- case UINT16_ELEMENTS: {
- Handle<FixedUint16Array> array(
- FixedUint16Array::cast(object->elements()));
- return FixedUint16Array::SetValue(array, index, value);
- }
- case INT16_ELEMENTS: {
- Handle<FixedInt16Array> array(
- FixedInt16Array::cast(object->elements()));
- return FixedInt16Array::SetValue(array, index, value);
- }
- case UINT32_ELEMENTS: {
- Handle<FixedUint32Array> array(
- FixedUint32Array::cast(object->elements()));
- return FixedUint32Array::SetValue(array, index, value);
- }
- case INT32_ELEMENTS: {
- Handle<FixedInt32Array> array(
- FixedInt32Array::cast(object->elements()));
- return FixedInt32Array::SetValue(array, index, value);
- }
- case FLOAT32_ELEMENTS: {
- Handle<FixedFloat32Array> array(
- FixedFloat32Array::cast(object->elements()));
- return FixedFloat32Array::SetValue(array, index, value);
- }
- case FLOAT64_ELEMENTS: {
- Handle<FixedFloat64Array> array(
- FixedFloat64Array::cast(object->elements()));
- return FixedFloat64Array::SetValue(array, index, value);
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: { \
+ Handle<External##Type##Array> array( \
+ External##Type##Array::cast(object->elements())); \
+ return External##Type##Array::SetValue(array, index, value); \
+ } \
+ case TYPE##_ELEMENTS: { \
+ Handle<Fixed##Type##Array> array( \
+ Fixed##Type##Array::cast(object->elements())); \
+ return Fixed##Type##Array::SetValue(array, index, value); \
}
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+
+#undef TYPED_ARRAY_CASE
+
case DICTIONARY_ELEMENTS:
return SetDictionaryElement(object, index, value, attributes, strict_mode,
check_prototype,
}
break;
}
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS: {
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+ {
// External arrays are considered 100% used.
FixedArrayBase* external_array = FixedArrayBase::cast(elements());
*capacity = external_array->length();
ASSERT(!storage || storage->length() >= counter);
break;
}
- case EXTERNAL_PIXEL_ELEMENTS: {
- int length = ExternalPixelArray::cast(elements())->length();
- while (counter < length) {
- if (storage != NULL) {
- storage->set(counter, Smi::FromInt(counter));
- }
- counter++;
- }
- ASSERT(!storage || storage->length() >= counter);
- break;
- }
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS: {
+
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+ {
int length = FixedArrayBase::cast(elements())->length();
while (counter < length) {
if (storage != NULL) {
ASSERT(!storage || storage->length() >= counter);
break;
}
+
case DICTIONARY_ELEMENTS: {
if (storage != NULL) {
element_dictionary()->CopyKeysTo(storage,
ExternalArrayType JSTypedArray::type() {
switch (elements()->map()->instance_type()) {
- case EXTERNAL_BYTE_ARRAY_TYPE:
- return kExternalByteArray;
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- return kExternalUnsignedByteArray;
- case EXTERNAL_SHORT_ARRAY_TYPE:
- return kExternalShortArray;
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- return kExternalUnsignedShortArray;
- case EXTERNAL_INT_ARRAY_TYPE:
- return kExternalIntArray;
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- return kExternalUnsignedIntArray;
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- return kExternalFloatArray;
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
- return kExternalDoubleArray;
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- return kExternalPixelArray;
+#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ return kExternal##Type##Array;
+
+ TYPED_ARRAYS(INSTANCE_TYPE_TO_ARRAY_TYPE)
+#undef INSTANCE_TYPE_TO_ARRAY_TYPE
+
default:
return static_cast<ExternalArrayType>(-1);
}
size_t JSTypedArray::element_size() {
switch (elements()->map()->instance_type()) {
- case EXTERNAL_BYTE_ARRAY_TYPE:
- return 1;
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
- return 1;
- case EXTERNAL_SHORT_ARRAY_TYPE:
- return 2;
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
- return 2;
- case EXTERNAL_INT_ARRAY_TYPE:
- return 4;
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
- return 4;
- case EXTERNAL_FLOAT_ARRAY_TYPE:
- return 4;
- case EXTERNAL_DOUBLE_ARRAY_TYPE:
- return 8;
- case EXTERNAL_PIXEL_ARRAY_TYPE:
- return 1;
+#define INSTANCE_TYPE_TO_ELEMENT_SIZE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ return size;
+
+ TYPED_ARRAYS(INSTANCE_TYPE_TO_ELEMENT_SIZE)
+#undef INSTANCE_TYPE_TO_ELEMENT_SIZE
+
default:
UNREACHABLE();
return 0;
}
-Object* ExternalPixelArray::SetValue(uint32_t index, Object* value) {
+Object* ExternalUint8ClampedArray::SetValue(uint32_t index, Object* value) {
uint8_t clamped_value = 0;
if (index < static_cast<uint32_t>(length())) {
if (value->IsSmi()) {
}
+Handle<Object> ExternalUint8ClampedArray::SetValue(
+ Handle<ExternalUint8ClampedArray> array,
+ uint32_t index,
+ Handle<Object> value) {
+ return Handle<Object>(array->SetValue(index, *value), array->GetIsolate());
+}
+
+
template<typename ExternalArrayClass, typename ValueType>
static MaybeObject* ExternalArrayIntSetter(Heap* heap,
ExternalArrayClass* receiver,
}
-Handle<Object> ExternalByteArray::SetValue(Handle<ExternalByteArray> array,
+Handle<Object> ExternalInt8Array::SetValue(Handle<ExternalInt8Array> array,
uint32_t index,
Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
}
-MaybeObject* ExternalByteArray::SetValue(uint32_t index, Object* value) {
- return ExternalArrayIntSetter<ExternalByteArray, int8_t>
+MaybeObject* ExternalInt8Array::SetValue(uint32_t index, Object* value) {
+ return ExternalArrayIntSetter<ExternalInt8Array, int8_t>
(GetHeap(), this, index, value);
}
-Handle<Object> ExternalUnsignedByteArray::SetValue(
- Handle<ExternalUnsignedByteArray> array,
+Handle<Object> ExternalUint8Array::SetValue(
+ Handle<ExternalUint8Array> array,
uint32_t index,
Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
}
-MaybeObject* ExternalUnsignedByteArray::SetValue(uint32_t index,
+MaybeObject* ExternalUint8Array::SetValue(uint32_t index,
Object* value) {
- return ExternalArrayIntSetter<ExternalUnsignedByteArray, uint8_t>
+ return ExternalArrayIntSetter<ExternalUint8Array, uint8_t>
(GetHeap(), this, index, value);
}
-Handle<Object> ExternalShortArray::SetValue(
- Handle<ExternalShortArray> array,
+Handle<Object> ExternalInt16Array::SetValue(
+ Handle<ExternalInt16Array> array,
uint32_t index,
Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
}
-MaybeObject* ExternalShortArray::SetValue(uint32_t index,
+MaybeObject* ExternalInt16Array::SetValue(uint32_t index,
Object* value) {
- return ExternalArrayIntSetter<ExternalShortArray, int16_t>
+ return ExternalArrayIntSetter<ExternalInt16Array, int16_t>
(GetHeap(), this, index, value);
}
-Handle<Object> ExternalUnsignedShortArray::SetValue(
- Handle<ExternalUnsignedShortArray> array,
+Handle<Object> ExternalUint16Array::SetValue(
+ Handle<ExternalUint16Array> array,
uint32_t index,
Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
}
-MaybeObject* ExternalUnsignedShortArray::SetValue(uint32_t index,
+MaybeObject* ExternalUint16Array::SetValue(uint32_t index,
Object* value) {
- return ExternalArrayIntSetter<ExternalUnsignedShortArray, uint16_t>
+ return ExternalArrayIntSetter<ExternalUint16Array, uint16_t>
(GetHeap(), this, index, value);
}
-Handle<Object> ExternalIntArray::SetValue(Handle<ExternalIntArray> array,
+Handle<Object> ExternalInt32Array::SetValue(Handle<ExternalInt32Array> array,
uint32_t index,
Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
}
-MaybeObject* ExternalIntArray::SetValue(uint32_t index, Object* value) {
- return ExternalArrayIntSetter<ExternalIntArray, int32_t>
+MaybeObject* ExternalInt32Array::SetValue(uint32_t index, Object* value) {
+ return ExternalArrayIntSetter<ExternalInt32Array, int32_t>
(GetHeap(), this, index, value);
}
-Handle<Object> ExternalUnsignedIntArray::SetValue(
- Handle<ExternalUnsignedIntArray> array,
+Handle<Object> ExternalUint32Array::SetValue(
+ Handle<ExternalUint32Array> array,
uint32_t index,
Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
}
-MaybeObject* ExternalUnsignedIntArray::SetValue(uint32_t index, Object* value) {
+MaybeObject* ExternalUint32Array::SetValue(uint32_t index, Object* value) {
uint32_t cast_value = 0;
Heap* heap = GetHeap();
if (index < static_cast<uint32_t>(length())) {
}
-Handle<Object> ExternalFloatArray::SetValue(Handle<ExternalFloatArray> array,
- uint32_t index,
- Handle<Object> value) {
+Handle<Object> ExternalFloat32Array::SetValue(
+ Handle<ExternalFloat32Array> array,
+ uint32_t index,
+ Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
array->SetValue(index, *value),
Object);
}
-MaybeObject* ExternalFloatArray::SetValue(uint32_t index, Object* value) {
+MaybeObject* ExternalFloat32Array::SetValue(uint32_t index, Object* value) {
float cast_value = static_cast<float>(OS::nan_value());
Heap* heap = GetHeap();
if (index < static_cast<uint32_t>(length())) {
}
-Handle<Object> ExternalDoubleArray::SetValue(Handle<ExternalDoubleArray> array,
- uint32_t index,
- Handle<Object> value) {
+Handle<Object> ExternalFloat64Array::SetValue(
+ Handle<ExternalFloat64Array> array,
+ uint32_t index,
+ Handle<Object> value) {
CALL_HEAP_FUNCTION(array->GetIsolate(),
array->SetValue(index, *value),
Object);
}
-MaybeObject* ExternalDoubleArray::SetValue(uint32_t index, Object* value) {
+MaybeObject* ExternalFloat64Array::SetValue(uint32_t index, Object* value) {
double double_value = OS::nan_value();
Heap* heap = GetHeap();
if (index < static_cast<uint32_t>(length())) {
// - TransitionArray
// - FixedDoubleArray
// - ExternalArray
-// - ExternalPixelArray
-// - ExternalByteArray
-// - ExternalUnsignedByteArray
-// - ExternalShortArray
-// - ExternalUnsignedShortArray
-// - ExternalIntArray
-// - ExternalUnsignedIntArray
-// - ExternalFloatArray
+// - ExternalUint8ClampedArray
+// - ExternalInt8Array
+// - ExternalUint8Array
+// - ExternalInt16Array
+// - ExternalUint16Array
+// - ExternalInt32Array
+// - ExternalUint32Array
+// - ExternalFloat32Array
// - Name
// - String
// - SeqString
/* Note: the order of these external array */ \
/* types is relied upon in */ \
/* Object::IsExternalArray(). */ \
- V(EXTERNAL_BYTE_ARRAY_TYPE) \
- V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \
- V(EXTERNAL_SHORT_ARRAY_TYPE) \
- V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \
- V(EXTERNAL_INT_ARRAY_TYPE) \
- V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \
- V(EXTERNAL_FLOAT_ARRAY_TYPE) \
- V(EXTERNAL_DOUBLE_ARRAY_TYPE) \
- V(EXTERNAL_PIXEL_ARRAY_TYPE) \
+ V(EXTERNAL_INT8_ARRAY_TYPE) \
+ V(EXTERNAL_UINT8_ARRAY_TYPE) \
+ V(EXTERNAL_INT16_ARRAY_TYPE) \
+ V(EXTERNAL_UINT16_ARRAY_TYPE) \
+ V(EXTERNAL_INT32_ARRAY_TYPE) \
+ V(EXTERNAL_UINT32_ARRAY_TYPE) \
+ V(EXTERNAL_FLOAT32_ARRAY_TYPE) \
+ V(EXTERNAL_FLOAT64_ARRAY_TYPE) \
+ V(EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE) \
\
V(FIXED_INT8_ARRAY_TYPE) \
V(FIXED_UINT8_ARRAY_TYPE) \
FOREIGN_TYPE,
BYTE_ARRAY_TYPE,
FREE_SPACE_TYPE,
- EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
- EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
- EXTERNAL_SHORT_ARRAY_TYPE,
- EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE,
- EXTERNAL_INT_ARRAY_TYPE,
- EXTERNAL_UNSIGNED_INT_ARRAY_TYPE,
- EXTERNAL_FLOAT_ARRAY_TYPE,
- EXTERNAL_DOUBLE_ARRAY_TYPE,
- EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
+
+ EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
+ EXTERNAL_UINT8_ARRAY_TYPE,
+ EXTERNAL_INT16_ARRAY_TYPE,
+ EXTERNAL_UINT16_ARRAY_TYPE,
+ EXTERNAL_INT32_ARRAY_TYPE,
+ EXTERNAL_UINT32_ARRAY_TYPE,
+ EXTERNAL_FLOAT32_ARRAY_TYPE,
+ EXTERNAL_FLOAT64_ARRAY_TYPE,
+ EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
FIXED_UINT8_ARRAY_TYPE,
LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
FIRST_NONSTRING_TYPE = SYMBOL_TYPE,
// Boundaries for testing for an external array.
- FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE,
- LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE,
+ FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_INT8_ARRAY_TYPE,
+ LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE,
// Boundaries for testing for a fixed typed array.
FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
V(Symbol) \
\
V(ExternalArray) \
- V(ExternalByteArray) \
- V(ExternalUnsignedByteArray) \
- V(ExternalShortArray) \
- V(ExternalUnsignedShortArray) \
- V(ExternalIntArray) \
- V(ExternalUnsignedIntArray) \
- V(ExternalFloatArray) \
- V(ExternalDoubleArray) \
- V(ExternalPixelArray) \
+ V(ExternalInt8Array) \
+ V(ExternalUint8Array) \
+ V(ExternalInt16Array) \
+ V(ExternalUint16Array) \
+ V(ExternalInt32Array) \
+ V(ExternalUint32Array) \
+ V(ExternalFloat32Array) \
+ V(ExternalFloat64Array) \
+ V(ExternalUint8ClampedArray) \
V(FixedTypedArrayBase) \
V(FixedUint8Array) \
V(FixedInt8Array) \
inline bool HasNonStrictArgumentsElements();
inline bool HasDictionaryElements();
- inline bool HasExternalPixelElements();
+ inline bool HasExternalUint8ClampedElements();
inline bool HasExternalArrayElements();
- inline bool HasExternalByteElements();
- inline bool HasExternalUnsignedByteElements();
- inline bool HasExternalShortElements();
- inline bool HasExternalUnsignedShortElements();
- inline bool HasExternalIntElements();
- inline bool HasExternalUnsignedIntElements();
- inline bool HasExternalFloatElements();
- inline bool HasExternalDoubleElements();
+ inline bool HasExternalInt8Elements();
+ inline bool HasExternalUint8Elements();
+ inline bool HasExternalInt16Elements();
+ inline bool HasExternalUint16Elements();
+ inline bool HasExternalInt32Elements();
+ inline bool HasExternalUint32Elements();
+ inline bool HasExternalFloat32Elements();
+ inline bool HasExternalFloat64Elements();
inline bool HasFixedTypedArrayElements();
};
+// V has parameters (Type, type, TYPE, C type, element_size)
+#define TYPED_ARRAYS(V) \
+ V(Uint8, uint8, UINT8, uint8_t, 1) \
+ V(Int8, int8, INT8, int8_t, 1) \
+ V(Uint16, uint16, UINT16, uint16_t, 2) \
+ V(Int16, int16, INT16, int16_t, 2) \
+ V(Uint32, uint32, UINT32, uint32_t, 4) \
+ V(Int32, int32, INT32, int32_t, 4) \
+ V(Float32, float32, FLOAT32, float, 4) \
+ V(Float64, float64, FLOAT64, double, 8) \
+ V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t, 1)
+
+
+
// An ExternalArray represents a fixed-size array of primitive values
// which live outside the JavaScript heap. Its subclasses are used to
// implement the CanvasArray types being defined in the WebGL
};
-// A ExternalPixelArray represents a fixed-size byte array with special
+// A ExternalUint8ClampedArray represents a fixed-size byte array with special
// semantics used for implementing the CanvasPixelArray object. Please see the
// specification at:
// multipage/the-canvas-element.html#canvaspixelarray
// In particular, write access clamps the value written to 0 or 255 if the
// value written is outside this range.
-class ExternalPixelArray: public ExternalArray {
+class ExternalUint8ClampedArray: public ExternalArray {
public:
- inline uint8_t* external_pixel_pointer();
+ inline uint8_t* external_uint8_clamped_pointer();
// Setter and getter.
inline uint8_t get_scalar(int index);
// undefined and clamps the converted value between 0 and 255.
Object* SetValue(uint32_t index, Object* value);
+ static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array,
+ uint32_t index,
+ Handle<Object> value);
+
// Casting.
- static inline ExternalPixelArray* cast(Object* obj);
+ static inline ExternalUint8ClampedArray* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalPixelArray)
- DECLARE_VERIFIER(ExternalPixelArray)
+ DECLARE_PRINTER(ExternalUint8ClampedArray)
+ DECLARE_VERIFIER(ExternalUint8ClampedArray)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray);
};
-class ExternalByteArray: public ExternalArray {
+class ExternalInt8Array: public ExternalArray {
public:
// Setter and getter.
inline int8_t get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, int8_t value);
- static Handle<Object> SetValue(Handle<ExternalByteArray> array,
+ static Handle<Object> SetValue(Handle<ExternalInt8Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalByteArray* cast(Object* obj);
+ static inline ExternalInt8Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalByteArray)
- DECLARE_VERIFIER(ExternalByteArray)
+ DECLARE_PRINTER(ExternalInt8Array)
+ DECLARE_VERIFIER(ExternalInt8Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array);
};
-class ExternalUnsignedByteArray: public ExternalArray {
+class ExternalUint8Array: public ExternalArray {
public:
// Setter and getter.
inline uint8_t get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, uint8_t value);
- static Handle<Object> SetValue(Handle<ExternalUnsignedByteArray> array,
+ static Handle<Object> SetValue(Handle<ExternalUint8Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalUnsignedByteArray* cast(Object* obj);
+ static inline ExternalUint8Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalUnsignedByteArray)
- DECLARE_VERIFIER(ExternalUnsignedByteArray)
+ DECLARE_PRINTER(ExternalUint8Array)
+ DECLARE_VERIFIER(ExternalUint8Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array);
};
-class ExternalShortArray: public ExternalArray {
+class ExternalInt16Array: public ExternalArray {
public:
// Setter and getter.
inline int16_t get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, int16_t value);
- static Handle<Object> SetValue(Handle<ExternalShortArray> array,
+ static Handle<Object> SetValue(Handle<ExternalInt16Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalShortArray* cast(Object* obj);
+ static inline ExternalInt16Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalShortArray)
- DECLARE_VERIFIER(ExternalShortArray)
+ DECLARE_PRINTER(ExternalInt16Array)
+ DECLARE_VERIFIER(ExternalInt16Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array);
};
-class ExternalUnsignedShortArray: public ExternalArray {
+class ExternalUint16Array: public ExternalArray {
public:
// Setter and getter.
inline uint16_t get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, uint16_t value);
- static Handle<Object> SetValue(Handle<ExternalUnsignedShortArray> array,
+ static Handle<Object> SetValue(Handle<ExternalUint16Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalUnsignedShortArray* cast(Object* obj);
+ static inline ExternalUint16Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalUnsignedShortArray)
- DECLARE_VERIFIER(ExternalUnsignedShortArray)
+ DECLARE_PRINTER(ExternalUint16Array)
+ DECLARE_VERIFIER(ExternalUint16Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array);
};
-class ExternalIntArray: public ExternalArray {
+class ExternalInt32Array: public ExternalArray {
public:
// Setter and getter.
inline int32_t get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, int32_t value);
- static Handle<Object> SetValue(Handle<ExternalIntArray> array,
+ static Handle<Object> SetValue(Handle<ExternalInt32Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalIntArray* cast(Object* obj);
+ static inline ExternalInt32Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalIntArray)
- DECLARE_VERIFIER(ExternalIntArray)
+ DECLARE_PRINTER(ExternalInt32Array)
+ DECLARE_VERIFIER(ExternalInt32Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array);
};
-class ExternalUnsignedIntArray: public ExternalArray {
+class ExternalUint32Array: public ExternalArray {
public:
// Setter and getter.
inline uint32_t get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, uint32_t value);
- static Handle<Object> SetValue(Handle<ExternalUnsignedIntArray> array,
+ static Handle<Object> SetValue(Handle<ExternalUint32Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalUnsignedIntArray* cast(Object* obj);
+ static inline ExternalUint32Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalUnsignedIntArray)
- DECLARE_VERIFIER(ExternalUnsignedIntArray)
+ DECLARE_PRINTER(ExternalUint32Array)
+ DECLARE_VERIFIER(ExternalUint32Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array);
};
-class ExternalFloatArray: public ExternalArray {
+class ExternalFloat32Array: public ExternalArray {
public:
// Setter and getter.
inline float get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, float value);
- static Handle<Object> SetValue(Handle<ExternalFloatArray> array,
+ static Handle<Object> SetValue(Handle<ExternalFloat32Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalFloatArray* cast(Object* obj);
+ static inline ExternalFloat32Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalFloatArray)
- DECLARE_VERIFIER(ExternalFloatArray)
+ DECLARE_PRINTER(ExternalFloat32Array)
+ DECLARE_VERIFIER(ExternalFloat32Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array);
};
-class ExternalDoubleArray: public ExternalArray {
+class ExternalFloat64Array: public ExternalArray {
public:
// Setter and getter.
inline double get_scalar(int index);
MUST_USE_RESULT inline MaybeObject* get(int index);
inline void set(int index, double value);
- static Handle<Object> SetValue(Handle<ExternalDoubleArray> array,
+ static Handle<Object> SetValue(Handle<ExternalFloat64Array> array,
uint32_t index,
Handle<Object> value);
MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
// Casting.
- static inline ExternalDoubleArray* cast(Object* obj);
+ static inline ExternalFloat64Array* cast(Object* obj);
// Dispatched behavior.
- DECLARE_PRINTER(ExternalDoubleArray)
- DECLARE_VERIFIER(ExternalDoubleArray)
+ DECLARE_PRINTER(ExternalFloat64Array)
+ DECLARE_VERIFIER(ExternalFloat64Array)
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array);
};
DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray);
};
-#define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType) \
+#define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \
class Type##ArrayTraits { \
public: \
typedef elementType ElementType; \
\
typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array;
-FIXED_TYPED_ARRAY_TRAITS(Uint8, uint8, UINT8, uint8_t)
-FIXED_TYPED_ARRAY_TRAITS(Int8, int8, INT8, int8_t)
-FIXED_TYPED_ARRAY_TRAITS(Uint16, uint16, UINT16, uint16_t)
-FIXED_TYPED_ARRAY_TRAITS(Int16, int16, INT16, int16_t)
-FIXED_TYPED_ARRAY_TRAITS(Uint32, uint32, UINT32, uint32_t)
-FIXED_TYPED_ARRAY_TRAITS(Int32, int32, INT32, int32_t)
-FIXED_TYPED_ARRAY_TRAITS(Float32, float32, FLOAT32, float)
-FIXED_TYPED_ARRAY_TRAITS(Float64, float64, FLOAT64, double)
-FIXED_TYPED_ARRAY_TRAITS(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t)
+TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS)
#undef FIXED_TYPED_ARRAY_TRAITS
void Runtime::ArrayIdToTypeAndSize(
int arrayId, ExternalArrayType* array_type, size_t* element_size) {
switch (arrayId) {
- case ARRAY_ID_UINT8:
- *array_type = kExternalUnsignedByteArray;
- *element_size = 1;
- break;
- case ARRAY_ID_INT8:
- *array_type = kExternalByteArray;
- *element_size = 1;
- break;
- case ARRAY_ID_UINT16:
- *array_type = kExternalUnsignedShortArray;
- *element_size = 2;
- break;
- case ARRAY_ID_INT16:
- *array_type = kExternalShortArray;
- *element_size = 2;
- break;
- case ARRAY_ID_UINT32:
- *array_type = kExternalUnsignedIntArray;
- *element_size = 4;
- break;
- case ARRAY_ID_INT32:
- *array_type = kExternalIntArray;
- *element_size = 4;
- break;
- case ARRAY_ID_FLOAT32:
- *array_type = kExternalFloatArray;
- *element_size = 4;
- break;
- case ARRAY_ID_FLOAT64:
- *array_type = kExternalDoubleArray;
- *element_size = 8;
- break;
- case ARRAY_ID_UINT8C:
- *array_type = kExternalPixelArray;
- *element_size = 1;
+#define ARRAY_ID_CASE(Type, type, TYPE, ctype, size) \
+ case ARRAY_ID_##TYPE: \
+ *array_type = kExternal##Type##Array; \
+ *element_size = size; \
break;
+
+ TYPED_ARRAYS(ARRAY_ID_CASE)
+#undef ARRAY_ID_CASE
+
default:
UNREACHABLE();
}
holder->SetInternalField(i, Smi::FromInt(0));
}
- ExternalArrayType array_type = kExternalByteArray; // Bogus initialization.
+ ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
size_t element_size = 1; // Bogus initialization.
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size);
holder->SetInternalField(i, Smi::FromInt(0));
}
- ExternalArrayType array_type = kExternalByteArray; // Bogus initialization.
+ ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
size_t element_size = 1; // Bogus initialization.
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size);
break;
}
case NON_STRICT_ARGUMENTS_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
- case UINT8_ELEMENTS:
- case INT8_ELEMENTS:
- case UINT16_ELEMENTS:
- case INT16_ELEMENTS:
- case UINT32_ELEMENTS:
- case INT32_ELEMENTS:
- case FLOAT32_ELEMENTS:
- case FLOAT64_ELEMENTS:
- case UINT8_CLAMPED_ELEMENTS:
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
+ case TYPE##_ELEMENTS: \
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
// External arrays are always dense.
return length;
}
default: {
int dense_elements_length;
switch (kind) {
- case EXTERNAL_PIXEL_ELEMENTS: {
- dense_elements_length =
- ExternalPixelArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_BYTE_ELEMENTS: {
- dense_elements_length =
- ExternalByteArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
- dense_elements_length =
- ExternalUnsignedByteArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_SHORT_ELEMENTS: {
- dense_elements_length =
- ExternalShortArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
- dense_elements_length =
- ExternalUnsignedShortArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_INT_ELEMENTS: {
- dense_elements_length =
- ExternalIntArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
- dense_elements_length =
- ExternalUnsignedIntArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_FLOAT_ELEMENTS: {
- dense_elements_length =
- ExternalFloatArray::cast(object->elements())->length();
- break;
- }
- case EXTERNAL_DOUBLE_ELEMENTS: {
- dense_elements_length =
- ExternalDoubleArray::cast(object->elements())->length();
- break;
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: { \
+ dense_elements_length = \
+ External##Type##Array::cast(object->elements())->length(); \
+ break; \
}
+
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+
default:
UNREACHABLE();
dense_elements_length = 0;
}
break;
}
- case EXTERNAL_PIXEL_ELEMENTS: {
- Handle<ExternalPixelArray> pixels(ExternalPixelArray::cast(
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS: {
+ Handle<ExternalUint8ClampedArray> pixels(ExternalUint8ClampedArray::cast(
receiver->elements()));
for (uint32_t j = 0; j < length; j++) {
Handle<Smi> e(Smi::FromInt(pixels->get_scalar(j)), isolate);
}
break;
}
- case EXTERNAL_BYTE_ELEMENTS: {
- IterateExternalArrayElements<ExternalByteArray, int8_t>(
+ case EXTERNAL_INT8_ELEMENTS: {
+ IterateExternalArrayElements<ExternalInt8Array, int8_t>(
isolate, receiver, true, true, visitor);
break;
}
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
- IterateExternalArrayElements<ExternalUnsignedByteArray, uint8_t>(
+ case EXTERNAL_UINT8_ELEMENTS: {
+ IterateExternalArrayElements<ExternalUint8Array, uint8_t>(
isolate, receiver, true, true, visitor);
break;
}
- case EXTERNAL_SHORT_ELEMENTS: {
- IterateExternalArrayElements<ExternalShortArray, int16_t>(
+ case EXTERNAL_INT16_ELEMENTS: {
+ IterateExternalArrayElements<ExternalInt16Array, int16_t>(
isolate, receiver, true, true, visitor);
break;
}
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
- IterateExternalArrayElements<ExternalUnsignedShortArray, uint16_t>(
+ case EXTERNAL_UINT16_ELEMENTS: {
+ IterateExternalArrayElements<ExternalUint16Array, uint16_t>(
isolate, receiver, true, true, visitor);
break;
}
- case EXTERNAL_INT_ELEMENTS: {
- IterateExternalArrayElements<ExternalIntArray, int32_t>(
+ case EXTERNAL_INT32_ELEMENTS: {
+ IterateExternalArrayElements<ExternalInt32Array, int32_t>(
isolate, receiver, true, false, visitor);
break;
}
- case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
- IterateExternalArrayElements<ExternalUnsignedIntArray, uint32_t>(
+ case EXTERNAL_UINT32_ELEMENTS: {
+ IterateExternalArrayElements<ExternalUint32Array, uint32_t>(
isolate, receiver, true, false, visitor);
break;
}
- case EXTERNAL_FLOAT_ELEMENTS: {
- IterateExternalArrayElements<ExternalFloatArray, float>(
+ case EXTERNAL_FLOAT32_ELEMENTS: {
+ IterateExternalArrayElements<ExternalFloat32Array, float>(
isolate, receiver, false, false, visitor);
break;
}
- case EXTERNAL_DOUBLE_ELEMENTS: {
- IterateExternalArrayElements<ExternalDoubleArray, double>(
+ case EXTERNAL_FLOAT64_ELEMENTS: {
+ IterateExternalArrayElements<ExternalFloat64Array, double>(
isolate, receiver, false, false, visitor);
break;
}
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(NonStrictArgumentsElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalPixelElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalByteElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedByteElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalShortElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedShortElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalIntElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedIntElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalFloatElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalDoubleElements)
// Properties test sitting with elements tests - not fooling anyone.
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties)
#undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION
+#define TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype, size) \
+ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasExternal##Type##Elements) { \
+ CONVERT_ARG_CHECKED(JSObject, obj, 0); \
+ return isolate->heap()->ToBoolean(obj->HasExternal##Type##Elements()); \
+ }
+
+TYPED_ARRAYS(TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION)
+
+#undef TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 2);
F(HasFastHoleyElements, 1, 1) \
F(HasDictionaryElements, 1, 1) \
F(HasNonStrictArgumentsElements, 1, 1) \
- F(HasExternalPixelElements, 1, 1) \
+ F(HasExternalUint8ClampedElements, 1, 1) \
F(HasExternalArrayElements, 1, 1) \
- F(HasExternalByteElements, 1, 1) \
- F(HasExternalUnsignedByteElements, 1, 1) \
- F(HasExternalShortElements, 1, 1) \
- F(HasExternalUnsignedShortElements, 1, 1) \
- F(HasExternalIntElements, 1, 1) \
- F(HasExternalUnsignedIntElements, 1, 1) \
- F(HasExternalFloatElements, 1, 1) \
- F(HasExternalDoubleElements, 1, 1) \
+ F(HasExternalInt8Elements, 1, 1) \
+ F(HasExternalUint8Elements, 1, 1) \
+ F(HasExternalInt16Elements, 1, 1) \
+ F(HasExternalUint16Elements, 1, 1) \
+ F(HasExternalInt32Elements, 1, 1) \
+ F(HasExternalUint32Elements, 1, 1) \
+ F(HasExternalFloat32Elements, 1, 1) \
+ F(HasExternalFloat64Elements, 1, 1) \
F(HasFastProperties, 1, 1) \
F(TransitionElementsKind, 2, 1) \
F(HaveSameMap, 2, 1) \
ARRAY_ID_INT32 = 6,
ARRAY_ID_FLOAT32 = 7,
ARRAY_ID_FLOAT64 = 8,
- ARRAY_ID_UINT8C = 9
+ ARRAY_ID_UINT8_CLAMPED = 9
};
static void ArrayIdToTypeAndSize(int array_id,
LLoadExternalArrayPointer* instr) {
Register result = ToRegister(instr->result());
Register input = ToRegister(instr->object());
- __ movp(result, FieldOperand(input,
- ExternalPixelArray::kExternalPointerOffset));
+ __ movp(result,
+ FieldOperand(input,
+ ExternalUint8ClampedArray::kExternalPointerOffset));
}
base_offset,
instr->additional_index()));
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
XMMRegister result(ToDoubleRegister(instr->result()));
__ movss(result, operand);
__ cvtss2sd(result, result);
- } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
__ movsd(ToDoubleRegister(instr->result()), operand);
} else {
Register result(ToRegister(instr->result()));
switch (elements_kind) {
- case EXTERNAL_BYTE_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
case INT8_ELEMENTS:
__ movsxbq(result, operand);
break;
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case EXTERNAL_PIXEL_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
__ movzxbq(result, operand);
break;
- case EXTERNAL_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
case INT16_ELEMENTS:
__ movsxwq(result, operand);
break;
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
__ movzxwq(result, operand);
break;
- case EXTERNAL_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
case INT32_ELEMENTS:
__ movsxlq(result, operand);
break;
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case UINT32_ELEMENTS:
__ movl(result, operand);
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
DeoptimizeIf(negative, instr->environment());
}
break;
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
case FAST_ELEMENTS:
base_offset,
instr->additional_index()));
- if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS) {
XMMRegister value(ToDoubleRegister(instr->value()));
__ cvtsd2ss(value, value);
__ movss(operand, value);
- } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
+ } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
__ movsd(operand, ToDoubleRegister(instr->value()));
} else {
Register value(ToRegister(instr->value()));
switch (elements_kind) {
- case EXTERNAL_PIXEL_ELEMENTS:
- case EXTERNAL_BYTE_ELEMENTS:
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case INT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
__ movb(operand, value);
break;
- case EXTERNAL_SHORT_ELEMENTS:
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_INT16_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case INT16_ELEMENTS:
case UINT16_ELEMENTS:
__ movw(operand, value);
break;
- case EXTERNAL_INT_ELEMENTS:
- case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_INT32_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case INT32_ELEMENTS:
case UINT32_ELEMENTS:
__ movl(operand, value);
break;
- case EXTERNAL_FLOAT_ELEMENTS:
- case EXTERNAL_DOUBLE_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
case FAST_ELEMENTS:
DefineAsRegister(result);
bool can_deoptimize = instr->RequiresHoleCheck() ||
- (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ||
+ (elements_kind == EXTERNAL_UINT32_ELEMENTS) ||
(elements_kind == UINT32_ELEMENTS);
// An unsigned int array load might overflow and cause a deopt, make sure it
// has an environment.
(instr->is_external() &&
instr->elements()->representation().IsExternal()));
bool val_is_temp_register =
- elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
- elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
+ elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
elements_kind == FLOAT32_ELEMENTS;
LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
: UseRegister(instr->value());
v8::HandleScope scope(context->GetIsolate());
const int kElementCount = 260;
uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
- i::Handle<i::ExternalPixelArray> pixels =
- i::Handle<i::ExternalPixelArray>::cast(
+ i::Handle<i::ExternalUint8ClampedArray> pixels =
+ i::Handle<i::ExternalUint8ClampedArray>::cast(
factory->NewExternalArray(kElementCount,
- v8::kExternalPixelArray,
+ v8::kExternalUint8ClampedArray,
pixel_data));
// Force GC to trigger verification.
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
v8::HandleScope scope(isolate);
const int kElementCount = 260;
uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
- i::Handle<i::ExternalPixelArray> pixels =
- i::Handle<i::ExternalPixelArray>::cast(
+ i::Handle<i::ExternalUint8ClampedArray> pixels =
+ i::Handle<i::ExternalUint8ClampedArray>::cast(
factory->NewExternalArray(kElementCount,
- v8::kExternalPixelArray,
+ v8::kExternalUint8ClampedArray,
pixel_data));
for (int i = 0; i < kElementCount; i++) {
pixels->set(i, i % 256);
static int ExternalArrayElementSize(v8::ExternalArrayType array_type) {
switch (array_type) {
- case v8::kExternalByteArray:
- case v8::kExternalUnsignedByteArray:
- case v8::kExternalPixelArray:
+ case v8::kExternalInt8Array:
+ case v8::kExternalUint8Array:
+ case v8::kExternalUint8ClampedArray:
return 1;
break;
- case v8::kExternalShortArray:
- case v8::kExternalUnsignedShortArray:
+ case v8::kExternalInt16Array:
+ case v8::kExternalUint16Array:
return 2;
break;
- case v8::kExternalIntArray:
- case v8::kExternalUnsignedIntArray:
- case v8::kExternalFloatArray:
+ case v8::kExternalInt32Array:
+ case v8::kExternalUint32Array:
+ case v8::kExternalFloat32Array:
return 4;
break;
- case v8::kExternalDoubleArray:
+ case v8::kExternalFloat64Array:
return 8;
break;
default:
"}"
"ext_array[7];");
CHECK_EQ(0, result->Int32Value());
- if (array_type == v8::kExternalDoubleArray ||
- array_type == v8::kExternalFloatArray) {
+ if (array_type == v8::kExternalFloat64Array ||
+ array_type == v8::kExternalFloat32Array) {
CHECK_EQ(static_cast<int>(i::OS::nan_value()),
static_cast<int>(
jsobj->GetElement(isolate, 7)->ToObjectChecked()->Number()));
static_cast<int>(
jsobj->GetElement(isolate, 6)->ToObjectChecked()->Number()));
- if (array_type != v8::kExternalFloatArray &&
- array_type != v8::kExternalDoubleArray) {
+ if (array_type != v8::kExternalFloat32Array &&
+ array_type != v8::kExternalFloat64Array) {
// Though the specification doesn't state it, be explicit about
// converting NaNs and +/-Infinity to zero.
result = CompileRun("for (var i = 0; i < 8; i++) {"
"}"
"ext_array[5];");
int expected_value =
- (array_type == v8::kExternalPixelArray) ? 255 : 0;
+ (array_type == v8::kExternalUint8ClampedArray) ? 255 : 0;
CHECK_EQ(expected_value, result->Int32Value());
CheckElementValue(isolate, expected_value, jsobj, 5);
"var source_data = [0.6, 10.6];"
"var expected_results = [1, 11];";
bool is_unsigned =
- (array_type == v8::kExternalUnsignedByteArray ||
- array_type == v8::kExternalUnsignedShortArray ||
- array_type == v8::kExternalUnsignedIntArray);
- bool is_pixel_data = array_type == v8::kExternalPixelArray;
+ (array_type == v8::kExternalUint8Array ||
+ array_type == v8::kExternalUint16Array ||
+ array_type == v8::kExternalUint32Array);
+ bool is_pixel_data = array_type == v8::kExternalUint8ClampedArray;
i::OS::SNPrintF(test_buf,
"%s"
THREADED_TEST(FixedUint8Array) {
FixedTypedArrayTestHelper<i::FixedUint8Array, i::UINT8_ELEMENTS, uint8_t>(
- v8::kExternalUnsignedByteArray,
+ v8::kExternalUint8Array,
0x0, 0xFF);
}
THREADED_TEST(FixedUint8ClampedArray) {
FixedTypedArrayTestHelper<i::FixedUint8ClampedArray,
i::UINT8_CLAMPED_ELEMENTS, uint8_t>(
- v8::kExternalPixelArray,
+ v8::kExternalUint8ClampedArray,
0x0, 0xFF);
}
THREADED_TEST(FixedInt8Array) {
FixedTypedArrayTestHelper<i::FixedInt8Array, i::INT8_ELEMENTS, int8_t>(
- v8::kExternalByteArray,
+ v8::kExternalInt8Array,
-0x80, 0x7F);
}
THREADED_TEST(FixedUint16Array) {
FixedTypedArrayTestHelper<i::FixedUint16Array, i::UINT16_ELEMENTS, uint16_t>(
- v8::kExternalUnsignedShortArray,
+ v8::kExternalUint16Array,
0x0, 0xFFFF);
}
THREADED_TEST(FixedInt16Array) {
FixedTypedArrayTestHelper<i::FixedInt16Array, i::INT16_ELEMENTS, int16_t>(
- v8::kExternalShortArray,
+ v8::kExternalInt16Array,
-0x8000, 0x7FFF);
}
THREADED_TEST(FixedUint32Array) {
FixedTypedArrayTestHelper<i::FixedUint32Array, i::UINT32_ELEMENTS, uint32_t>(
- v8::kExternalUnsignedIntArray,
+ v8::kExternalUint32Array,
0x0, UINT_MAX);
}
THREADED_TEST(FixedInt32Array) {
FixedTypedArrayTestHelper<i::FixedInt32Array, i::INT32_ELEMENTS, int32_t>(
- v8::kExternalIntArray,
+ v8::kExternalInt32Array,
INT_MIN, INT_MAX);
}
THREADED_TEST(FixedFloat32Array) {
FixedTypedArrayTestHelper<i::FixedFloat32Array, i::FLOAT32_ELEMENTS, float>(
- v8::kExternalFloatArray,
+ v8::kExternalFloat32Array,
-500, 500);
}
THREADED_TEST(FixedFloat64Array) {
FixedTypedArrayTestHelper<i::FixedFloat64Array, i::FLOAT64_ELEMENTS, float>(
- v8::kExternalDoubleArray,
+ v8::kExternalFloat64Array,
-500, 500);
}
}
-THREADED_TEST(ExternalByteArray) {
- ExternalArrayTestHelper<i::ExternalByteArray, int8_t>(
- v8::kExternalByteArray,
+THREADED_TEST(ExternalInt8Array) {
+ ExternalArrayTestHelper<i::ExternalInt8Array, int8_t>(
+ v8::kExternalInt8Array,
-128,
127);
}
-THREADED_TEST(ExternalUnsignedByteArray) {
- ExternalArrayTestHelper<i::ExternalUnsignedByteArray, uint8_t>(
- v8::kExternalUnsignedByteArray,
+THREADED_TEST(ExternalUint8Array) {
+ ExternalArrayTestHelper<i::ExternalUint8Array, uint8_t>(
+ v8::kExternalUint8Array,
0,
255);
}
-THREADED_TEST(ExternalPixelArray) {
- ExternalArrayTestHelper<i::ExternalPixelArray, uint8_t>(
- v8::kExternalPixelArray,
+THREADED_TEST(ExternalUint8ClampedArray) {
+ ExternalArrayTestHelper<i::ExternalUint8ClampedArray, uint8_t>(
+ v8::kExternalUint8ClampedArray,
0,
255);
}
-THREADED_TEST(ExternalShortArray) {
- ExternalArrayTestHelper<i::ExternalShortArray, int16_t>(
- v8::kExternalShortArray,
+THREADED_TEST(ExternalInt16Array) {
+ ExternalArrayTestHelper<i::ExternalInt16Array, int16_t>(
+ v8::kExternalInt16Array,
-32768,
32767);
}
-THREADED_TEST(ExternalUnsignedShortArray) {
- ExternalArrayTestHelper<i::ExternalUnsignedShortArray, uint16_t>(
- v8::kExternalUnsignedShortArray,
+THREADED_TEST(ExternalUint16Array) {
+ ExternalArrayTestHelper<i::ExternalUint16Array, uint16_t>(
+ v8::kExternalUint16Array,
0,
65535);
}
-THREADED_TEST(ExternalIntArray) {
- ExternalArrayTestHelper<i::ExternalIntArray, int32_t>(
- v8::kExternalIntArray,
+THREADED_TEST(ExternalInt32Array) {
+ ExternalArrayTestHelper<i::ExternalInt32Array, int32_t>(
+ v8::kExternalInt32Array,
INT_MIN, // -2147483648
INT_MAX); // 2147483647
}
-THREADED_TEST(ExternalUnsignedIntArray) {
- ExternalArrayTestHelper<i::ExternalUnsignedIntArray, uint32_t>(
- v8::kExternalUnsignedIntArray,
+THREADED_TEST(ExternalUint32Array) {
+ ExternalArrayTestHelper<i::ExternalUint32Array, uint32_t>(
+ v8::kExternalUint32Array,
0,
UINT_MAX); // 4294967295
}
-THREADED_TEST(ExternalFloatArray) {
- ExternalArrayTestHelper<i::ExternalFloatArray, float>(
- v8::kExternalFloatArray,
+THREADED_TEST(ExternalFloat32Array) {
+ ExternalArrayTestHelper<i::ExternalFloat32Array, float>(
+ v8::kExternalFloat32Array,
-500,
500);
}
-THREADED_TEST(ExternalDoubleArray) {
- ExternalArrayTestHelper<i::ExternalDoubleArray, double>(
- v8::kExternalDoubleArray,
+THREADED_TEST(ExternalFloat64Array) {
+ ExternalArrayTestHelper<i::ExternalFloat64Array, double>(
+ v8::kExternalFloat64Array,
-500,
500);
}
THREADED_TEST(ExternalArrays) {
- TestExternalByteArray();
- TestExternalUnsignedByteArray();
- TestExternalShortArray();
- TestExternalUnsignedShortArray();
- TestExternalIntArray();
- TestExternalUnsignedIntArray();
- TestExternalFloatArray();
+ TestExternalInt8Array();
+ TestExternalUint8Array();
+ TestExternalInt16Array();
+ TestExternalUint16Array();
+ TestExternalInt32Array();
+ TestExternalUint32Array();
+ TestExternalFloat32Array();
}
THREADED_TEST(ExternalArrayInfo) {
- ExternalArrayInfoTestHelper(v8::kExternalByteArray);
- ExternalArrayInfoTestHelper(v8::kExternalUnsignedByteArray);
- ExternalArrayInfoTestHelper(v8::kExternalShortArray);
- ExternalArrayInfoTestHelper(v8::kExternalUnsignedShortArray);
- ExternalArrayInfoTestHelper(v8::kExternalIntArray);
- ExternalArrayInfoTestHelper(v8::kExternalUnsignedIntArray);
- ExternalArrayInfoTestHelper(v8::kExternalFloatArray);
- ExternalArrayInfoTestHelper(v8::kExternalDoubleArray);
- ExternalArrayInfoTestHelper(v8::kExternalPixelArray);
+ ExternalArrayInfoTestHelper(v8::kExternalInt8Array);
+ ExternalArrayInfoTestHelper(v8::kExternalUint8Array);
+ ExternalArrayInfoTestHelper(v8::kExternalInt16Array);
+ ExternalArrayInfoTestHelper(v8::kExternalUint16Array);
+ ExternalArrayInfoTestHelper(v8::kExternalInt32Array);
+ ExternalArrayInfoTestHelper(v8::kExternalUint32Array);
+ ExternalArrayInfoTestHelper(v8::kExternalFloat32Array);
+ ExternalArrayInfoTestHelper(v8::kExternalFloat64Array);
+ ExternalArrayInfoTestHelper(v8::kExternalUint8ClampedArray);
}
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
- ExtArrayLimitsHelper(isolate, v8::kExternalByteArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalByteArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalUnsignedByteArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalUnsignedByteArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalShortArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalShortArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalUnsignedShortArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalUnsignedShortArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalIntArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalIntArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalUnsignedIntArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalUnsignedIntArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalFloatArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalFloatArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalDoubleArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalDoubleArray, 0xffffffff);
- ExtArrayLimitsHelper(isolate, v8::kExternalPixelArray, 0x40000000);
- ExtArrayLimitsHelper(isolate, v8::kExternalPixelArray, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalInt8Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalInt8Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint8Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint8Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalInt16Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalInt16Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint16Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint16Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalInt32Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalInt32Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint32Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint32Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalFloat32Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalFloat32Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalFloat64Array, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalFloat64Array, 0xffffffff);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint8ClampedArray, 0x40000000);
+ ExtArrayLimitsHelper(isolate, v8::kExternalUint8ClampedArray, 0xffffffff);
}
THREADED_TEST(Uint8Array) {
- TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUnsignedByteArray>(
- v8::kExternalUnsignedByteArray, 0, 0xFF);
+ TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUint8Array>(
+ v8::kExternalUint8Array, 0, 0xFF);
}
THREADED_TEST(Int8Array) {
- TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalByteArray>(
- v8::kExternalByteArray, -0x80, 0x7F);
+ TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalInt8Array>(
+ v8::kExternalInt8Array, -0x80, 0x7F);
}
THREADED_TEST(Uint16Array) {
TypedArrayTestHelper<uint16_t,
v8::Uint16Array,
- i::ExternalUnsignedShortArray>(
- v8::kExternalUnsignedShortArray, 0, 0xFFFF);
+ i::ExternalUint16Array>(
+ v8::kExternalUint16Array, 0, 0xFFFF);
}
THREADED_TEST(Int16Array) {
- TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalShortArray>(
- v8::kExternalShortArray, -0x8000, 0x7FFF);
+ TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalInt16Array>(
+ v8::kExternalInt16Array, -0x8000, 0x7FFF);
}
THREADED_TEST(Uint32Array) {
- TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUnsignedIntArray>(
- v8::kExternalUnsignedIntArray, 0, UINT_MAX);
+ TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUint32Array>(
+ v8::kExternalUint32Array, 0, UINT_MAX);
}
THREADED_TEST(Int32Array) {
- TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalIntArray>(
- v8::kExternalIntArray, INT_MIN, INT_MAX);
+ TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalInt32Array>(
+ v8::kExternalInt32Array, INT_MIN, INT_MAX);
}
THREADED_TEST(Float32Array) {
- TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloatArray>(
- v8::kExternalFloatArray, -500, 500);
+ TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloat32Array>(
+ v8::kExternalFloat32Array, -500, 500);
}
THREADED_TEST(Float64Array) {
- TypedArrayTestHelper<double, v8::Float64Array, i::ExternalDoubleArray>(
- v8::kExternalDoubleArray, -500, 500);
+ TypedArrayTestHelper<double, v8::Float64Array, i::ExternalFloat64Array>(
+ v8::kExternalFloat64Array, -500, 500);
}
THREADED_TEST(Uint8ClampedArray) {
- TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray, i::ExternalPixelArray>(
- v8::kExternalPixelArray, 0, 0xFF);
+ TypedArrayTestHelper<uint8_t,
+ v8::Uint8ClampedArray, i::ExternalUint8ClampedArray>(
+ v8::kExternalUint8ClampedArray, 0, 0xFF);
}
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
// Every external kind is also an external array.
assertTrue(%HasExternalArrayElements(obj));
- if (%HasExternalByteElements(obj)) {
+ if (%HasExternalInt8Elements(obj)) {
return elements_kind.external_byte;
}
- if (%HasExternalUnsignedByteElements(obj)) {
+ if (%HasExternalUint8Elements(obj)) {
return elements_kind.external_unsigned_byte;
}
- if (%HasExternalShortElements(obj)) {
+ if (%HasExternalInt16Elements(obj)) {
return elements_kind.external_short;
}
- if (%HasExternalUnsignedShortElements(obj)) {
+ if (%HasExternalUint16Elements(obj)) {
return elements_kind.external_unsigned_short;
}
- if (%HasExternalIntElements(obj)) {
+ if (%HasExternalInt32Elements(obj)) {
return elements_kind.external_int;
}
- if (%HasExternalUnsignedIntElements(obj)) {
+ if (%HasExternalUint32Elements(obj)) {
return elements_kind.external_unsigned_int;
}
- if (%HasExternalFloatElements(obj)) {
+ if (%HasExternalFloat32Elements(obj)) {
return elements_kind.external_float;
}
- if (%HasExternalDoubleElements(obj)) {
+ if (%HasExternalFloat64Elements(obj)) {
return elements_kind.external_double;
}
- if (%HasExternalPixelElements(obj)) {
+ if (%HasExternalUint8ClampedElements(obj)) {
return elements_kind.external_pixel;
}
}