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

Unified Diff: src/objects.cc

Issue 2161613002: Move SetObjectPrototype to JSObject (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates 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
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 6f38bdc5872084c4bdeb673b954804fdbf2893ab..120d8edfe8704cc1143887a2283ac86427663f4f 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3326,6 +3326,15 @@ void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map,
// When adding code here, add a DisallowHeapAllocation too.
}
+void JSObject::ForceSetPrototype(Handle<JSObject> object,
+ Handle<Object> proto) {
+ // object.__proto__ = proto;
+ Handle<Map> old_map = Handle<Map>(object->map());
+ Handle<Map> new_map = Map::Copy(old_map, "ForceSetPrototype");
+ Map::SetPrototype(new_map, proto, FAST_PROTOTYPE);
+ JSObject::MigrateToMap(object, new_map);
+}
+
int Map::NumberOfFields() {
DescriptorArray* descriptors = instance_descriptors();
int result = 0;
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698