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

Issue 8438071: Clean up Scope::CollectUsedVariables. (Closed)

Created:
9 years, 1 month ago by Steven
Modified:
9 years, 1 month ago
CC:
v8-dev
Visibility:
Public.

Description

Clean up Scope::CollectUsedVariables. Committed: http://code.google.com/p/v8/source/detail?r=9874

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -59 lines) Patch
M src/liveedit.cc View 1 chunk +10 lines, -19 lines 4 comments Download
M src/scopeinfo.cc View 2 chunks +8 lines, -31 lines 2 comments Download
M src/scopes.h View 2 chunks +8 lines, -2 lines 0 comments Download
M src/scopes.cc View 2 chunks +28 lines, -7 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Steven
PTAL. http://codereview.chromium.org/8438071/diff/1/src/liveedit.cc File src/liveedit.cc (right): http://codereview.chromium.org/8438071/diff/1/src/liveedit.cc#newcode863 src/liveedit.cc:863: for (int k = 1; k < context_list.length(); ...
9 years, 1 month ago (2011-11-03 12:39:39 UTC) #1
Kevin Millikin (Chromium)
LGTM. http://codereview.chromium.org/8438071/diff/1/src/liveedit.cc File src/liveedit.cc (right): http://codereview.chromium.org/8438071/diff/1/src/liveedit.cc#newcode863 src/liveedit.cc:863: for (int k = 1; k < context_list.length(); ...
9 years, 1 month ago (2011-11-03 13:12:20 UTC) #2
Steven
9 years, 1 month ago (2011-11-03 14:55:59 UTC) #3
http://codereview.chromium.org/8438071/diff/1/src/liveedit.cc
File src/liveedit.cc (right):

http://codereview.chromium.org/8438071/diff/1/src/liveedit.cc#newcode863
src/liveedit.cc:863: for (int k = 1; k < context_list.length(); k++) {
On 2011/11/03 13:12:20, Kevin Millikin wrote:
> On 2011/11/03 12:39:39, Steven wrote:
> > Why does the iteration start at 1 here? Is this maybe a bug?
> 
> It does look like a bug.  I'm not even sure whether it's a one or an L.  In
any
> case, it's more obviously correct to have:
> 
> context_list.Sort(&CompareLocal)
> 
> and expose CompareLocal from scopes.cc (I'd put CompareLocal in in
> variables.{h,cc} if it were me, and I'd rename it to CompareIndex or
something).

Done.

http://codereview.chromium.org/8438071/diff/1/src/liveedit.cc#newcode870
src/liveedit.cc:870: context_list[k] = context_list[l];
Honestly this whole code looks like a giant bug to me. This is sort of supposed
to be some kind of selection sort, but here one entry is copied over another one
instead of being swapped or so.

http://codereview.chromium.org/8438071/diff/1/src/scopeinfo.cc
File src/scopeinfo.cc (right):

http://codereview.chromium.org/8438071/diff/1/src/scopeinfo.cc#newcode58
src/scopeinfo.cc:58: ASSERT(context_locals.length() == context_local_count);
Yep. Those counts actually reflect how many times  AllocateHeapSlot /
AllocateStackSlot are called. Unused variables are not allocated so the asserts
should always hold. Will still use stack_locals.length() though.
On 2011/11/03 13:12:20, Kevin Millikin wrote:
> Are these asserts true for the case where some variables are unused?  It seems
> like nothing really depends on these invariants, if we just use
> stack_locals.length() instead of stack_local_count everywhere below.

Powered by Google App Engine
This is Rietveld 408576698