Fix crash in --print-scopes when Scope::variables_ is empty

Apparently our HashMap can't deal with iteration over an empty map.

R=verwaest@chromium.org,neis@chromium.org
BUG=v8:5711

Review-Url: https://codereview.chromium.org/2551943003
Cr-Commit-Position: refs/heads/master@{#41535}
This commit is contained in:
adamk 2016-12-06 11:16:11 -08:00 committed by Commit bot
parent 52e2c154ff
commit 1f53653e6c

View File

@ -1556,8 +1556,10 @@ void Scope::Print(int n) {
PrintVar(n1, function);
}
PrintMap(n1, "// local vars:\n", &variables_, true, function);
PrintMap(n1, "// dynamic vars:\n", &variables_, false, function);
if (variables_.occupancy() > 0) {
PrintMap(n1, "// local vars:\n", &variables_, true, function);
PrintMap(n1, "// dynamic vars:\n", &variables_, false, function);
}
// Print inner scopes (disable by providing negative n).
if (n >= 0) {