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

Issue 9139067: Use special allocation functions for object creation while deserializing from a full snapshot in ... (Closed)

Created:
8 years, 11 months ago by siva
Modified:
8 years, 11 months ago
Reviewers:
Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Use special allocation functions for object creation while deserializing from a full snapshot in order to avoid the following: - unnecessary initialization of objects with null - avoid handle creation Committed: https://code.google.com/p/dart/source/detail?r=3380

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Total comments: 12

Patch Set 8 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+463 lines, -123 lines) Patch
M vm/object.h View 1 2 3 4 5 6 7 7 chunks +10 lines, -14 lines 0 comments Download
M vm/object.cc View 1 2 3 4 5 6 7 3 chunks +16 lines, -12 lines 0 comments Download
M vm/raw_object.h View 1 2 3 4 5 6 7 10 chunks +20 lines, -0 lines 0 comments Download
M vm/raw_object_snapshot.cc View 1 2 3 4 5 6 7 28 chunks +171 lines, -91 lines 0 comments Download
M vm/snapshot.h View 1 2 3 4 5 6 7 2 chunks +44 lines, -0 lines 0 comments Download
M vm/snapshot.cc View 1 2 3 4 5 6 7 7 chunks +202 lines, -6 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
siva
8 years, 11 months ago (2012-01-16 05:02:16 UTC) #1
Ivan Posva
LGTM with comments. -Ivan http://codereview.chromium.org/9139067/diff/15002/vm/raw_object_snapshot.cc File vm/raw_object_snapshot.cc (right): http://codereview.chromium.org/9139067/diff/15002/vm/raw_object_snapshot.cc#newcode14 vm/raw_object_snapshot.cc:14: (kind == Snapshot::kFull) ? reader->New##type() ...
8 years, 11 months ago (2012-01-16 19:30:33 UTC) #2
siva
8 years, 11 months ago (2012-01-18 00:00:24 UTC) #3
Addressed comments.

http://codereview.chromium.org/9139067/diff/15002/vm/raw_object_snapshot.cc
File vm/raw_object_snapshot.cc (right):

http://codereview.chromium.org/9139067/diff/15002/vm/raw_object_snapshot.cc#n...
vm/raw_object_snapshot.cc:14: (kind == Snapshot::kFull) ? reader->New##type() :
type::New()
On 2012/01/16 19:30:33, Ivan Posva wrote:
> Parens around this expression to avoid being surprised when
> NEW_OBJECT(Foo)->toBar()
> does not what you want.

Done.

http://codereview.chromium.org/9139067/diff/15002/vm/raw_object_snapshot.cc#n...
vm/raw_object_snapshot.cc:1269: str_obj->SetHash(hash);
In this case I will set the hash value to 0 so that it will
get computed when needed.

On 2012/01/16 19:30:33, Ivan Posva wrote:
> The hash should be calculated as the string is deserialized. Different
change...

http://codereview.chromium.org/9139067/diff/15002/vm/raw_object_snapshot.cc#n...
vm/raw_object_snapshot.cc:1291: str_obj.SetHash(hash);
In the full snapshot case I added an ASSERT to
ensure that the hash value read is equal to the computed
value. That way it does not have to be computed while reading.

On 2012/01/16 19:30:33, Ivan Posva wrote:
> ditto for hash calculation: Recalculate during the read below?

http://codereview.chromium.org/9139067/diff/15002/vm/raw_object_snapshot.cc#n...
vm/raw_object_snapshot.cc:1292: for (intptr_t i = 0; i < len; i++) {
On 2012/01/16 19:30:33, Ivan Posva wrote:
> ASSERT(*str_obj.CharAddr(i) != NULL);
> and avoid the handle operations for full snapshots.

Done.

http://codereview.chromium.org/9139067/diff/15002/vm/snapshot.cc
File vm/snapshot.cc (right):

http://codereview.chromium.org/9139067/diff/15002/vm/snapshot.cc#newcode66
vm/snapshot.cc:66: backward_references_((snapshot->kind() == Snapshot::kFull) ?
1024 : 4) {
Added two constants one for the full snapshot case and one for all other
snapshots.

On 2012/01/16 19:30:33, Ivan Posva wrote:
> 1024 and 4 seem like magic numbers. What do we need for loading the core
library
> snapshot?

http://codereview.chromium.org/9139067/diff/15002/vm/snapshot.h
File vm/snapshot.h (right):

http://codereview.chromium.org/9139067/diff/15002/vm/snapshot.h#newcode343
vm/snapshot.h:343: void NewArray(Array* array, intptr_t len);
On 2012/01/16 19:30:33, Ivan Posva wrote:
> RawArray* NewArray(intptr_t len);

Done.

Powered by Google App Engine
This is Rietveld 408576698