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

Unified Diff: src/objects.cc

Issue 2428473002: [ic] Cache weak cells containing prototypes in respective PrototypeInfo objects. (Closed)
Patch Set: Created 4 years, 2 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') | src/objects-debug.cc » ('j') | 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 ad2f679f4d86e2ea5275f821e90a81a21c05bc3c..a4a7022ed8bbbc14b7988bb64b216fe7545b8ba3 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12732,6 +12732,24 @@ Handle<Cell> Map::GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
return cell;
}
+// static
+Handle<WeakCell> Map::GetOrCreatePrototypeWeakCell(Handle<JSObject> prototype,
+ Isolate* isolate) {
+ DCHECK(!prototype.is_null());
+ Handle<PrototypeInfo> proto_info =
+ GetOrCreatePrototypeInfo(prototype, isolate);
+ Object* maybe_cell = proto_info->weak_cell();
+ // Return existing cell if it's already created.
+ if (maybe_cell->IsWeakCell()) {
+ Handle<WeakCell> cell(WeakCell::cast(maybe_cell), isolate);
+ DCHECK(!cell->cleared());
+ return cell;
+ }
+ // Otherwise create a new cell.
+ Handle<WeakCell> cell = isolate->factory()->NewWeakCell(prototype);
+ proto_info->set_weak_cell(*cell);
+ return cell;
+}
// static
void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype,
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698