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

Issue 2598623002: Cache hash code for closures. (Closed)

Created:
4 years ago by Florian Schneider
Modified:
3 years, 12 months ago
Reviewers:
Cutch, siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Cache hash code for closures. Computing the hash code for closures is fairly expensive since it involves the function name and signature strings. This CL caches the hash code in the ClosureData object. Fixes #28161. R=asiva@google.com Committed: https://github.com/dart-lang/sdk/commit/7615e899be45747efd987db74033bf0f2ba9fb70

Patch Set 1 #

Patch Set 2 : null == hash not computed yet #

Total comments: 2

Patch Set 3 : addressed dbc comments #

Total comments: 2

Patch Set 4 : fixed GC tracing and snapshot reader #

Patch Set 5 : remove redundant assertion #

Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -13 lines) Patch
M runtime/lib/function.cc View 1 chunk +1 line, -11 lines 0 comments Download
M runtime/vm/clustered_snapshot.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/object.h View 1 2 chunks +5 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 2 chunks +27 lines, -0 lines 0 comments Download
M runtime/vm/raw_object.h View 1 2 3 1 chunk +5 lines, -1 line 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 13 (3 generated)
Florian Schneider
4 years ago (2016-12-21 15:25:27 UTC) #2
Cutch
DBC https://codereview.chromium.org/2598623002/diff/20001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/2598623002/diff/20001/runtime/vm/object.cc#newcode6854 runtime/vm/object.cc:6854: return Smi::New(Smi::Value(Smi::RawCast(ClosureData::Cast(obj).hash()))); this can just be Smi::RawCast(ClosureData::Cast(obj).hash()))
4 years ago (2016-12-21 15:39:45 UTC) #4
Florian Schneider
https://codereview.chromium.org/2598623002/diff/20001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/2598623002/diff/20001/runtime/vm/object.cc#newcode6854 runtime/vm/object.cc:6854: return Smi::New(Smi::Value(Smi::RawCast(ClosureData::Cast(obj).hash()))); On 2016/12/21 15:39:45, Cutch wrote: > this ...
4 years ago (2016-12-21 15:49:40 UTC) #5
siva
I believe you need to write out a null in RawClosureData::WriteTo(...) for the hash value ...
4 years ago (2016-12-21 16:46:04 UTC) #6
Cutch
DBC2 https://codereview.chromium.org/2598623002/diff/40001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/2598623002/diff/40001/runtime/vm/object.cc#newcode6853 runtime/vm/object.cc:6853: ASSERT(Object::Handle(ClosureData::Cast(obj).hash()).IsSmi()); Smi::RawCast already ASSERTS that the object is ...
4 years ago (2016-12-21 16:49:38 UTC) #7
Florian Schneider
On 2016/12/21 16:46:04, siva wrote: > I believe you need to write out a null ...
4 years ago (2016-12-21 16:51:13 UTC) #8
siva
On 2016/12/21 16:51:13, Florian Schneider wrote: > On 2016/12/21 16:46:04, siva wrote: > > I ...
4 years ago (2016-12-21 16:54:25 UTC) #9
Florian Schneider
Ptal. Added to_snapshot() for ClosureData. Snapshot size is unchanged. https://codereview.chromium.org/2598623002/diff/40001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/2598623002/diff/40001/runtime/vm/object.cc#newcode6853 runtime/vm/object.cc:6853: ...
4 years ago (2016-12-22 10:11:17 UTC) #10
siva
lgtm
4 years ago (2016-12-22 18:24:55 UTC) #11
Florian Schneider
3 years, 12 months ago (2016-12-23 10:39:31 UTC) #13
Message was sent while issue was closed.
Committed patchset #5 (id:80001) manually as
7615e899be45747efd987db74033bf0f2ba9fb70 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698