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

Issue 8340017: Use a common subroutine for the snapshot reading and writing of strings. (Closed)

Created:
9 years, 1 month ago by cshapiro
Modified:
9 years, 1 month ago
Reviewers:
turnidge
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Use a common subroutine for the snapshot reading and writing of strings. Committed: https://code.google.com/p/dart/source/detail?r=1517

Patch Set 1 #

Patch Set 2 : Make StringReadFrom static #

Total comments: 1

Patch Set 3 : Address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+74 lines, -92 lines) Patch
M runtime/vm/object.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 1 chunk +69 lines, -92 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
cshapiro
9 years, 1 month ago (2011-10-27 02:33:16 UTC) #1
turnidge
9 years, 1 month ago (2011-10-27 17:28:35 UTC) #2
LGTM

I didn't see any errors with your transformation.  The code looks fine.  Do you
happen to know if there are any simple tests of this code?

http://codereview.chromium.org/8340017/diff/3001/runtime/vm/raw_object_snapsh...
File runtime/vm/raw_object_snapshot.cc (right):

http://codereview.chromium.org/8340017/diff/3001/runtime/vm/raw_object_snapsh...
runtime/vm/raw_object_snapshot.cc:1017:
((str_obj).*(set_hash))(Smi::Value(smi_hash));
Thinking out loud...  Optional...

If you wanted to get rid of the set_hash parameter and make this line a bit more
readable, you could do:

(str_obj).SetHash(Smi::Value(smi_hash));

To make that work, you would need to declare that ReadStringFrom is a friend of
class String.  In some sense, it is, as it messes with all sorts of funny string
internals.  Another option is that ReadStringFrom could become a protected
static method on String itself.

I tried to see a way to get rid of the char_addr parameter as well, but I was
foiled by the differing return types.  So given that that needs to stay, keeping
the set_hash parameter as well is no big deal.

So feel free to ignore this...

Powered by Google App Engine
This is Rietveld 408576698