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

Unified Diff: src/api.cc

Issue 2185963002: [api] Add v8::Object::SetAlignedPointerInInternalFields (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing typo Created 4 years, 5 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
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.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 553cf485d46090491ce302cbc4210856188fe3ca..cbeb670039c2e76a8c069d9d3cb0520fb3774ac2 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5558,6 +5558,25 @@ void v8::Object::SetAlignedPointerInInternalField(int index, void* value) {
DCHECK_EQ(value, GetAlignedPointerFromInternalField(index));
}
+void v8::Object::SetAlignedPointerInInternalFields(int argc, int indices[],
+ void* values[]) {
+ i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
+ const char* location = "v8::Object::SetAlignedPointerInInternalFields()";
+ i::DisallowHeapAllocation no_gc;
+ i::JSObject* object = i::JSObject::cast(*obj);
+ int nof_internal_fields = jobject->GetInternalFieldCount();
+ for (int i = 0; i < argc; i++) {
+ int index = indices[i];
+ if (!Utils::ApiCheck(
+ index < nof_internal_fields,
+ location, "Internal field out of bounds") {
+ return;
+ }
+ void* value = values[i];
+ object->SetInternalField(index, EncodeAlignedAsSmi(value, location));
+ DCHECK_EQ(value, GetAlignedPointerFromInternalField(index));
+ }
+}
static void* ExternalValue(i::Object* obj) {
// Obscure semantics for undefined, but somehow checked in our unit tests...
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698