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

Issue 1709001: Fix one off error. (Closed)

Created:
10 years, 8 months ago by antonm
Modified:
9 years, 4 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

Fix one off error. Proper condition to start eviction is when next possible index is equal to cache length. Committed: http://code.google.com/p/v8/source/detail?r=4460

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressing Lasse's comments #

Patch Set 3 : Rebaseling #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -2 lines) Patch
M src/objects.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M test/mjsunit/string-search.js View 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
antonm
Lasse, may you have a look? If it's fine, I'd bring it to trunk.
10 years, 8 months ago (2010-04-20 19:37:51 UTC) #1
Lasse Reichstein
LGTM. Am I correct that the bug means that you write one entry (two elements) ...
10 years, 8 months ago (2010-04-21 07:26:35 UTC) #2
antonm
10 years, 8 months ago (2010-04-21 11:02:12 UTC) #3
Lasse, thanks lot for review!

I'm submitting it with one change in 5 mins (to run the tests) as I want it on
trunk soon.

And you are quite right: my mistake made the code overwrite values past the
fixed array, so poor maps :(

http://codereview.chromium.org/1709001/diff/1/2
File src/runtime.cc (right):

http://codereview.chromium.org/1709001/diff/1/2#newcode10094
src/runtime.cc:10094: if (size < cache->length()) {
On 2010/04/21 07:26:35, Lasse Reichstein wrote:
> Is there something we could pre-fill the cache with to remove this case (and
> also remove the "size" handling entirely)? It would need to have a key value
> that is never an input to the function (e.g., a newly created object that
isn't
> used anywhere else).
> 

Caches are allocated filled with holes, so it's already the case.  However,
could you explain what's the benefit of omitting this check?

And as we iterate backwards, that seems difficult to remove size completely. 

Probably I miss some elegant solution.

http://codereview.chromium.org/1709001/diff/1/2#newcode10098
src/runtime.cc:10098: int target_index = finger_index + 2;
On 2010/04/21 07:26:35, Lasse Reichstein wrote:
> This constant, 2, should have a name.
> Perhaps add  JSFunctionResultCache::kEntrySize = 2  and use it here.

Sure.

Powered by Google App Engine
This is Rietveld 408576698