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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 1389603002: Oilpan: Don't limit the number of wrappers collected in minor GC cycles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (classId != WrapperTypeInfo::NodeClassId) 114 if (classId != WrapperTypeInfo::NodeClassId)
115 return; 115 return;
116 116
117 // To make minor GC cycle time bounded, we limit the number of wrappers handled 117 // To make minor GC cycle time bounded, we limit the number of wrappers handled
118 // by each minor GC cycle to 10000. This value was selected so that the minor 118 // by each minor GC cycle to 10000. This value was selected so that the minor
119 // GC cycle time is bounded to 20 ms in a case where the new space size 119 // GC cycle time is bounded to 20 ms in a case where the new space size
120 // is 16 MB and it is full of wrappers (which is almost the worst case). 120 // is 16 MB and it is full of wrappers (which is almost the worst case).
121 // Practically speaking, as far as I crawled real web applications, 121 // Practically speaking, as far as I crawled real web applications,
122 // the number of wrappers handled by each minor GC cycle is at most 3000 . 122 // the number of wrappers handled by each minor GC cycle is at most 3000 .
123 // So this limit is mainly for pathological micro benchmarks. 123 // So this limit is mainly for pathological micro benchmarks.
124 //
125 // In Oilpan, we don't limit the number of wrappers to collect as many
126 // wrappers in minor GC cycles as possible. This may increase the pause
127 // time of a minor GC, but if we give up collecting wrappers in a minor
128 // GC, it will instead end up with increasing the cost of subsequent
129 // Oilpan's GCs. Thus it will be better to collect as many wrappers as
130 // possible for minimizing the value of max(a pause time of a minor GC,
131 // a pause time of Oilpan's GC).
132 #if !ENABLE(OILPAN)
124 const unsigned wrappersHandledByEachMinorGC = 10000; 133 const unsigned wrappersHandledByEachMinorGC = 10000;
125 if (m_nodesInNewSpace.size() >= wrappersHandledByEachMinorGC) 134 if (m_nodesInNewSpace.size() >= wrappersHandledByEachMinorGC)
126 return; 135 return;
136 #endif
127 137
128 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8 ::Persistent<v8::Object>::Cast(*value)); 138 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8 ::Persistent<v8::Object>::Cast(*value));
129 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); 139 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper));
130 ASSERT(V8Node::hasInstance(wrapper, m_isolate)); 140 ASSERT(V8Node::hasInstance(wrapper, m_isolate));
131 Node* node = V8Node::toImpl(wrapper); 141 Node* node = V8Node::toImpl(wrapper);
132 // A minor DOM GC can handle only node wrappers in the main world. 142 // A minor DOM GC can handle only node wrappers in the main world.
133 // Note that node->wrapper().IsEmpty() returns true for nodes that 143 // Note that node->wrapper().IsEmpty() returns true for nodes that
134 // do not have wrappers in the main world. 144 // do not have wrappers in the main world.
135 if (node->containsWrapper()) { 145 if (node->containsWrapper()) {
136 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper); 146 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper);
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 Visitor* m_visitor; 543 Visitor* m_visitor;
534 }; 544 };
535 545
536 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) 546 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor)
537 { 547 {
538 DOMWrapperTracer tracer(visitor); 548 DOMWrapperTracer tracer(visitor);
539 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); 549 v8::V8::VisitHandlesWithClassIds(isolate, &tracer);
540 } 550 }
541 551
542 } // namespace blink 552 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698