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

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: removing inlined helper Created 4 years, 4 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') | 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..da097bd530bb73a3e701bdf5b07aeb18187f866c 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5548,7 +5548,6 @@ void* v8::Object::SlowGetAlignedPointerFromInternalField(int index) {
i::Handle<i::JSObject>::cast(obj)->GetInternalField(index), location);
}
-
void v8::Object::SetAlignedPointerInInternalField(int index, void* value) {
i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
const char* location = "v8::Object::SetAlignedPointerInInternalField()";
@@ -5558,6 +5557,24 @@ 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 = object->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...
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698