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

Unified Diff: src/d8.cc

Issue 10700031: Improve creating external array buffer in d8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698