Revision: 11680
Author: [email protected]
Date: Wed May 30 07:26:34 2012
Log: Fix broken change to d8 typed arrays.
[email protected]
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/10441091
http://code.google.com/p/v8/source/detail?r=11680
Modified:
/branches/bleeding_edge/src/d8.cc
=======================================
--- /branches/bleeding_edge/src/d8.cc Wed May 30 06:35:29 2012
+++ /branches/bleeding_edge/src/d8.cc Wed May 30 07:26:34 2012
@@ -338,8 +338,8 @@
}
bool first_arg_is_array_buffer =
args[0]->IsObject() &&
- args[0]->ToObject()->GetHiddenValue(
- String::New(kArrayBufferMarkerPropName))->IsTrue();
+ !args[0]->ToObject()->GetHiddenValue(
+ String::New(kArrayBufferMarkerPropName)).IsEmpty();
// Currently, only the following constructors are supported:
// ArrayBuffer(unsigned long length)
// TypedArray(unsigned long length)
@@ -373,6 +373,9 @@
} else {
byteOffset = convertToUint(args[1], &try_catch);
if (try_catch.HasCaught()) return try_catch.Exception();
+ if (byteOffset > byteLength) {
+ return ThrowException(String::New("byteOffset out of bounds"));
+ }
if (byteOffset % element_size != 0) {
return ThrowException(
String::New("byteOffset must be multiple of element_size"));
@@ -391,8 +394,7 @@
}
if (byteOffset + length * element_size > byteLength) {
- return ThrowException(
- String::New("byteOffset or length out of bounds"));
+ return ThrowException(String::New("length out of bounds"));
}
byteLength = byteOffset + length * element_size;
@@ -454,7 +456,7 @@
Handle<String> prop_name = String::New(kArrayBufferReferencePropName);
Handle<Object> converted_object = object->ToObject();
Local<Value> prop_value = converted_object->GetHiddenValue(prop_name);
- if (data != NULL && !prop_value->IsObject()) {
+ if (data != NULL && prop_value.IsEmpty()) {
data = reinterpret_cast<size_t*>(data) -
kExternalArrayAllocationHeaderSize;
V8::AdjustAmountOfExternalAllocatedMemory(
-static_cast<int>(*reinterpret_cast<size_t*>(data)));
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev