Skip to content

Commit 87afca3

Browse files
arvCommit bot
authored andcommitted
Revert of Additional HandleScopes to limit Handle consumption. (patchset v8#4 id:50001 of https://codereview.chromium.org/1185633002/)
Reason for revert: Fails the following test handle-count-ast handle-count-runtime-... on V8 Linux - nosnap - debug - 1 http://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20nosnap%20-%20debug%20-%201/builds/851/steps/Check/logs/stdio Original issue's description: > Additional HandleScopes to limit Handle consumption. > > erikcorry@chromium.org suggested digging into v8 handle usage. Found potential scopes in ast.cc and runtime-literals.cc and added tests. > > The runtime-literals.cc change reduces peak handles in imaging-darkroom.js from 1,282,610 to 428,218. The ast.cc change reduces the peak handles in string-tagcloud.js from 80,738 to 8,176. > > No significant handle count issues found with major websites, but substantial savings on some benchmarks and demos: > > Kraken's imaging-darkroom.js down from 1,282,610 to 428,218 due to runtime-literals.cc scope. > SunSpider's string-tagcloud.js down from 80,738 to 8.176 due to ast.cc > > http://www.flohofwoe.net/demos/dragons_asmjs.html (738,906 -> 478,296) > http://www.flohofwoe.net/demos/instancing_asmjs.html (737,884 -> 477,274) > https://dl.dropboxusercontent.com/u/16662598/Ports/DOSBox-web/doom.html?engine=dosbox-growth.js (1,724,114 -> 1,087,408) > https://kripken.github.io/ammo.js/examples/new/ammo.html (175,784 -> 142,058) > > BUG= > > Committed: https://crrev.com/3a4c7538839186aa38910c66c986abb563f4ccd2 > Cr-Commit-Position: refs/heads/master@{#29155} TBR=yangguo@chromium.org,erikcorry@chromium.org,oth@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= Review URL: https://codereview.chromium.org/1194873004 Cr-Commit-Position: refs/heads/master@{#29160}
1 parent e6fed5e commit 87afca3

8 files changed

Lines changed: 4 additions & 1267 deletions

File tree

src/ast.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,10 +521,8 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) {
521521
depth_acc = m_literal->depth() + 1;
522522
}
523523
}
524-
525-
// New handle scope here, needs to be after BuildContants().
526-
HandleScope scope(isolate);
527524
Handle<Object> boilerplate_value = GetBoilerplateValue(element, isolate);
525+
528526
if (boilerplate_value->IsTheHole()) {
529527
is_holey = true;
530528
continue;

src/handles-inl.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,7 @@ HandleScope::HandleScope(Isolate* isolate) {
9292

9393

9494
HandleScope::~HandleScope() {
95-
#ifdef DEBUG
96-
if (FLAG_check_handle_count) {
97-
int before = NumberOfHandles(isolate_);
98-
CloseScope(isolate_, prev_next_, prev_limit_);
99-
int after = NumberOfHandles(isolate_);
100-
DCHECK(after - before < kCheckHandleThreshold);
101-
DCHECK(before < kCheckHandleThreshold);
102-
} else {
103-
#endif // DEBUG
104-
CloseScope(isolate_, prev_next_, prev_limit_);
105-
#ifdef DEBUG
106-
}
107-
#endif // DEBUG
95+
CloseScope(isolate_, prev_next_, prev_limit_);
10896
}
10997

11098

src/handles.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ class HandleScope {
208208

209209
Isolate* isolate() { return isolate_; }
210210

211-
static const int kCheckHandleThreshold = 16 * 1024;
212-
213211
private:
214212
// Prevent heap allocation or illegal handle scopes.
215213
HandleScope(const HandleScope&);

src/heap/heap.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ void Heap::GarbageCollectionEpilogue() {
646646
if (FLAG_print_handles) PrintHandles();
647647
if (FLAG_gc_verbose) Print();
648648
if (FLAG_code_stats) ReportCodeStatistics("After GC");
649-
if (FLAG_check_handle_count) CheckHandleCount();
650649
#endif
650+
if (FLAG_check_handle_count) CheckHandleCount();
651651
if (FLAG_deopt_every_n_garbage_collections > 0) {
652652
// TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that
653653
// the topmost optimized frame can be deoptimized safely, because it
@@ -5957,9 +5957,7 @@ void Heap::PrintHandles() {
59575957
class CheckHandleCountVisitor : public ObjectVisitor {
59585958
public:
59595959
CheckHandleCountVisitor() : handle_count_(0) {}
5960-
~CheckHandleCountVisitor() {
5961-
CHECK(handle_count_ < HandleScope::kCheckHandleThreshold);
5962-
}
5960+
~CheckHandleCountVisitor() { CHECK(handle_count_ < 2000); }
59635961
void VisitPointers(Object** start, Object** end) {
59645962
handle_count_ += end - start;
59655963
}

src/runtime/runtime-literals.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
191191
isolate->factory()->CopyFixedArray(fixed_array_values);
192192
copied_elements_values = fixed_array_values_copy;
193193
for (int i = 0; i < fixed_array_values->length(); i++) {
194-
HandleScope scope(isolate);
195194
if (fixed_array_values->get(i)->IsFixedArray()) {
196195
// The value contains the constant_properties of a
197196
// simple object or array literal.

test/cctest/test-types.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,6 @@ struct Tests : Rep {
15051505
void Union3() {
15061506
// Monotonicity: T1->Is(T2) or T1->Is(T3) implies T1->Is(Union(T2, T3))
15071507
for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) {
1508-
HandleScope scope(isolate);
15091508
for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) {
15101509
for (TypeIterator it3 = it2; it3 != T.types.end(); ++it3) {
15111510
TypeHandle type1 = *it1;
@@ -1758,7 +1757,6 @@ struct Tests : Rep {
17581757

17591758
// Monotonicity: T1->Is(T2) and T1->Is(T3) implies T1->Is(Intersect(T2, T3))
17601759
for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) {
1761-
HandleScope scope(isolate);
17621760
for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) {
17631761
for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) {
17641762
TypeHandle type1 = *it1;

test/mjsunit/handle-count-ast.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/mjsunit/handle-count-runtime-literals.js

Lines changed: 0 additions & 1230 deletions
This file was deleted.

0 commit comments

Comments
 (0)