Index: Source/bindings/core/v8/V8BindingMacros.h |
diff --git a/Source/bindings/core/v8/V8BindingMacros.h b/Source/bindings/core/v8/V8BindingMacros.h |
index 2377e9d0c1445e71a67a83ba53490c01fedf4887..9d68f90a667aa068d8a37935949567b05071ec0a 100644 |
--- a/Source/bindings/core/v8/V8BindingMacros.h |
+++ b/Source/bindings/core/v8/V8BindingMacros.h |
@@ -46,6 +46,14 @@ namespace blink { |
if (UNLIKELY(!var.prepare())) \ |
return retVal; |
+// Checks for a given v8::Value (value) whether it is an ArrayBufferView and |
+// below a certain size limit. If below the limit, memory is allocated on the |
+// stack to hold the actual payload. Keep the limit in sync with V8's |
+// typed_array_max_size. |
+#define allocateFlexibleArrayBufferViewStorage(value) \ |
+ (value->IsArrayBufferView() && (value.As<v8::ArrayBufferView>()->ByteLength() <= 64) ? \ |
+ alloca(value.As<v8::ArrayBufferView>()->ByteLength()) : nullptr) |
+ |
template <typename T> |
inline bool v8Call(v8::Maybe<T> maybe, T& outVariable) |
{ |