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

Unified Diff: src/api.cc

Issue 1155893003: Add {Map,Set}::FromArray to the API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 7 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 | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 7cf416cfbd240bfd8f85b8ec9dc331b5649df117..7e3fa51261b087bef1e67b46957fb5dcb1c50799 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6156,6 +6156,19 @@ Local<Array> Map::AsArray() const {
}
+MaybeLocal<Map> Map::FromArray(Local<Context> context, Local<Array> array) {
+ PREPARE_FOR_EXECUTION(context, "Map::FromArray", Map);
+ i::Handle<i::Object> result;
+ i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)};
+ has_pending_exception =
+ !i::Execution::Call(isolate, isolate->map_from_array(),
+ isolate->factory()->undefined_value(),
+ arraysize(argv), argv, false).ToHandle(&result);
+ RETURN_ON_FAILED_EXECUTION(Map);
+ RETURN_ESCAPED(Local<Map>::Cast(Utils::ToLocal(result)));
+}
+
+
Local<v8::Set> v8::Set::New(Isolate* isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
LOG_API(i_isolate, "Set::New");
@@ -6192,6 +6205,19 @@ Local<Array> Set::AsArray() const {
}
+MaybeLocal<Set> Set::FromArray(Local<Context> context, Local<Array> array) {
+ PREPARE_FOR_EXECUTION(context, "Set::FromArray", Set);
+ i::Handle<i::Object> result;
+ i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)};
+ has_pending_exception =
+ !i::Execution::Call(isolate, isolate->set_from_array(),
+ isolate->factory()->undefined_value(),
+ arraysize(argv), argv, false).ToHandle(&result);
+ RETURN_ON_FAILED_EXECUTION(Set);
+ RETURN_ESCAPED(Local<Set>::Cast(Utils::ToLocal(result)));
+}
+
+
bool Value::IsPromise() const {
auto self = Utils::OpenHandle(this);
return i::Object::IsPromise(self);
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698