From 60f831749fa43d3c3c8b559d8ad18a694dbf2731 Mon Sep 17 00:00:00 2001 From: karl Date: Fri, 9 Oct 2015 13:44:29 -0700 Subject: [PATCH] Emit better error message if array buffer allocation fails Now emits `Array buffer allocation failed` instead of `Invalid array buffer length`. Review URL: https://codereview.chromium.org/1393263003 Cr-Commit-Position: refs/heads/master@{#31200} --- src/messages.h | 1 + src/runtime/runtime-typedarray.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/messages.h b/src/messages.h index 21a4788d33..0282c6fb7d 100644 --- a/src/messages.h +++ b/src/messages.h @@ -253,6 +253,7 @@ class CallSite { T(DateRange, "Provided date is not in valid range.") \ T(ExpectedLocation, "Expected Area/Location for time zone, got %") \ T(InvalidArrayBufferLength, "Invalid array buffer length") \ + T(ArrayBufferAllocationFailed, "Array buffer allocation failed") \ T(InvalidArrayLength, "Invalid array length") \ T(InvalidCodePoint, "Invalid code point %") \ T(InvalidCountValue, "Invalid count value") \ diff --git a/src/runtime/runtime-typedarray.cc b/src/runtime/runtime-typedarray.cc index 8a3fce0a92..b963868e81 100644 --- a/src/runtime/runtime-typedarray.cc +++ b/src/runtime/runtime-typedarray.cc @@ -33,7 +33,7 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferInitialize) { holder, isolate, allocated_length, true, is_shared ? SharedFlag::kShared : SharedFlag::kNotShared)) { THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); + isolate, NewRangeError(MessageTemplate::kArrayBufferAllocationFailed)); } return *holder; }