Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: src/runtime/runtime-array.cc

Issue 1257223002: Revert of Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index b5655db611a5ce34161d45990718872fa7f02916..af2d4c54813104a5e9566293951e9c488822b9fd 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -298,6 +298,7 @@
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ELEMENTS: \
case TYPE##_ELEMENTS:
TYPED_ARRAYS(TYPED_ARRAY_CASE)
@@ -417,6 +418,7 @@
}
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
case TYPE##_ELEMENTS: \
+ case EXTERNAL_##TYPE##_ELEMENTS:
TYPED_ARRAYS(TYPED_ARRAY_CASE)
#undef TYPED_ARRAY_CASE
@@ -608,6 +610,15 @@
}
break;
}
+ 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);
+ visitor->visit(j, e);
+ }
+ break;
+ }
case UINT8_CLAMPED_ELEMENTS: {
Handle<FixedUint8ClampedArray> pixels(
FixedUint8ClampedArray::cast(receiver->elements()));
@@ -617,39 +628,79 @@
}
break;
}
+ case EXTERNAL_INT8_ELEMENTS: {
+ IterateTypedArrayElements<ExternalInt8Array, int8_t>(
+ isolate, receiver, true, true, visitor);
+ break;
+ }
case INT8_ELEMENTS: {
IterateTypedArrayElements<FixedInt8Array, int8_t>(
isolate, receiver, true, true, visitor);
break;
}
+ case EXTERNAL_UINT8_ELEMENTS: {
+ IterateTypedArrayElements<ExternalUint8Array, uint8_t>(
+ isolate, receiver, true, true, visitor);
+ break;
+ }
case UINT8_ELEMENTS: {
IterateTypedArrayElements<FixedUint8Array, uint8_t>(
isolate, receiver, true, true, visitor);
break;
}
+ case EXTERNAL_INT16_ELEMENTS: {
+ IterateTypedArrayElements<ExternalInt16Array, int16_t>(
+ isolate, receiver, true, true, visitor);
+ break;
+ }
case INT16_ELEMENTS: {
IterateTypedArrayElements<FixedInt16Array, int16_t>(
isolate, receiver, true, true, visitor);
break;
}
+ case EXTERNAL_UINT16_ELEMENTS: {
+ IterateTypedArrayElements<ExternalUint16Array, uint16_t>(
+ isolate, receiver, true, true, visitor);
+ break;
+ }
case UINT16_ELEMENTS: {
IterateTypedArrayElements<FixedUint16Array, uint16_t>(
isolate, receiver, true, true, visitor);
break;
}
+ case EXTERNAL_INT32_ELEMENTS: {
+ IterateTypedArrayElements<ExternalInt32Array, int32_t>(
+ isolate, receiver, true, false, visitor);
+ break;
+ }
case INT32_ELEMENTS: {
IterateTypedArrayElements<FixedInt32Array, int32_t>(
isolate, receiver, true, false, visitor);
break;
}
+ case EXTERNAL_UINT32_ELEMENTS: {
+ IterateTypedArrayElements<ExternalUint32Array, uint32_t>(
+ isolate, receiver, true, false, visitor);
+ break;
+ }
case UINT32_ELEMENTS: {
IterateTypedArrayElements<FixedUint32Array, uint32_t>(
isolate, receiver, true, false, visitor);
break;
}
+ case EXTERNAL_FLOAT32_ELEMENTS: {
+ IterateTypedArrayElements<ExternalFloat32Array, float>(
+ isolate, receiver, false, false, visitor);
+ break;
+ }
case FLOAT32_ELEMENTS: {
IterateTypedArrayElements<FixedFloat32Array, float>(
isolate, receiver, false, false, visitor);
+ break;
+ }
+ case EXTERNAL_FLOAT64_ELEMENTS: {
+ IterateTypedArrayElements<ExternalFloat64Array, double>(
+ isolate, receiver, false, false, visitor);
break;
}
case FLOAT64_ELEMENTS: {
@@ -1182,7 +1233,8 @@
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
- RUNTIME_ASSERT(!array->HasFixedTypedArrayElements() &&
+ RUNTIME_ASSERT(!array->HasExternalArrayElements() &&
+ !array->HasFixedTypedArrayElements() &&
!array->IsJSGlobalProxy());
JSObject::NormalizeElements(array);
return *array;
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698