Reviewers: rossberg,
Message:
PTAL.
Description:
Improve creating external array buffer in d8.
BUG=
TEST=
Please review this at http://codereview.chromium.org/10700031/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/d8.cc
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index
976510c464009a19f91bc9e7a0101decdc536fe4..ce2afd34d4b483d61165316e9ad1c1209ac4b7f9
100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -488,14 +488,7 @@ Handle<Value> Shell::CreateExternalArray(const
Arguments& args,
byteLength = length * element_size;
byteOffset = 0;
- Handle<Object> global = Context::GetCurrent()->Global();
- Handle<Value> array_buffer = global->Get(String::New("ArrayBuffer"));
- ASSERT(!try_catch.HasCaught() && array_buffer->IsFunction());
- Handle<Value> buffer_args[] = { Uint32::New(byteLength) };
- Handle<Value> result =
Handle<Function>::Cast(array_buffer)->NewInstance(
- 1, buffer_args);
- if (try_catch.HasCaught()) return result;
- buffer = result->ToObject();
+ buffer = CreateExternalArrayBuffer(Object::New(),
byteLength)->ToObject();
}
Handle<Object> array = CreateExternalArray(
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev