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

Unified Diff: src/objects.cc

Issue 188783003: Make maps in monomorphic IC stubs weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase, address comments Created 6 years, 8 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 402d8ae399c3486ac960b25da415141be5bc1da7..441a91f9517bea1931df15ea5abfdd6a250fe921 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11538,6 +11538,21 @@ void Map::AddDependentCode(DependentCode::DependencyGroup group,
}
+void Map::AddDependentIC(Handle<Code> stub) {
+ ASSERT(stub->next_code_link()->IsUndefined());
+ int n = dependent_code()->number_of_entries(DependentCode::kWeakICGroup);
+ if (n == 0) {
+ // Slow path: insert the head of the list with possible heap allocation.
+ AddDependentCode(DependentCode::kWeakICGroup, stub);
+ } else {
+ // Fast path: link the stub to the existing head of the list without any
+ // heap allocation.
+ ASSERT(n == 1);
+ dependent_code()->AddToDependentICList(stub);
+ }
+}
+
+
DependentCode::GroupStartIndexes::GroupStartIndexes(DependentCode* entries) {
Recompute(entries);
}
@@ -11668,10 +11683,22 @@ void DependentCode::RemoveCompilationInfo(DependentCode::DependencyGroup group,
}
+static bool CodeListContains(Object* head, Code* code) {
+ while (!head->IsUndefined()) {
+ if (head == code) return true;
+ head = Code::cast(head)->next_code_link();
+ }
+ return false;
+}
+
+
bool DependentCode::Contains(DependencyGroup group, Code* code) {
GroupStartIndexes starts(this);
int start = starts.at(group);
int end = starts.at(group + 1);
+ if (group == kWeakICGroup) {
+ return CodeListContains(object_at(start), code);
+ }
for (int i = start; i < end; i++) {
if (object_at(i) == code) return true;
}
@@ -11728,6 +11755,15 @@ void DependentCode::DeoptimizeDependentCodeGroup(
}
+void DependentCode::AddToDependentICList(Handle<Code> stub) {
+ DisallowHeapAllocation no_heap_allocation;
+ GroupStartIndexes starts(this);
+ int i = starts.at(kWeakICGroup);
+ stub->set_next_code_link(object_at(i));
+ set_object_at(i, *stub);
+}
+
+
Handle<Object> JSObject::SetPrototype(Handle<JSObject> object,
Handle<Object> value,
bool skip_hidden_prototypes) {
« 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