summaryrefslogtreecommitdiff
path: root/deps/v8/include
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-11-06 18:05:48 +0800
committerRich Trott <rtrott@gmail.com>2018-11-08 15:01:06 -0800
commit00d368e5bc63a2009bd12932558eba71f0e1bc5a (patch)
treead810068014db2c3481dfcf1fc49d26492a9f1a1 /deps/v8/include
parent7d86a5324bc29c21afce8cba3dba508b78d48cd5 (diff)
downloadandroid-node-v8-00d368e5bc63a2009bd12932558eba71f0e1bc5a.tar.gz
android-node-v8-00d368e5bc63a2009bd12932558eba71f0e1bc5a.tar.bz2
android-node-v8-00d368e5bc63a2009bd12932558eba71f0e1bc5a.zip
deps: cherry-pick 0483e9a from upstream V8
Original commit message: [api] Allow embedder to construct an Array from Local<Value>* Currently to obtain a v8::Array out of a C array or a std::vector, one needs to loop through the elements and call array->Set() multiple times, and these calls go into v8::Object::Set() which can be slow. This patch adds a new Array::New overload that converts a Local<Value>* with known size into a Local<Array>. Change-Id: I0a768f0e18eec51e78d58be455482ec6425ca188 Reviewed-on: https://chromium-review.googlesource.com/c/1317049 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Joyee Cheung <joyee@igalia.com> Cr-Commit-Position: refs/heads/master@{#57261} Refs: https://github.com/v8/v8/commit/0483e9a9abe77a73632fd85b9c0cd608efa9aa0d PR-URL: https://github.com/nodejs/node/pull/24125 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/v8/include')
-rw-r--r--deps/v8/include/v8.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index c48025871a..e1951ec270 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -3779,6 +3779,12 @@ class V8_EXPORT Array : public Object {
*/
static Local<Array> New(Isolate* isolate, int length = 0);
+ /**
+ * Creates a JavaScript array out of a Local<Value> array in C++
+ * with a known length.
+ */
+ static Local<Array> New(Isolate* isolate, Local<Value>* elements,
+ size_t length);
V8_INLINE static Array* Cast(Value* obj);
private:
Array();