Commit b624783b authored by ulan@chromium.org's avatar ulan@chromium.org

Reduce number of writes to DependentCode array when inserting dependent IC.

BUG=305878
LOG=Y
R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/339843004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21873 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3b53ba87
......@@ -12061,8 +12061,17 @@ 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);
Object* head = object_at(i);
// Try to insert the stub after the head of the list to minimize number of
// writes to the DependentCode array, since a write to the array can make it
// strong if it was alread marked by incremental marker.
if (head->IsCode()) {
stub->set_next_code_link(Code::cast(head)->next_code_link());
Code::cast(head)->set_next_code_link(*stub);
} else {
stub->set_next_code_link(head);
set_object_at(i, *stub);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment