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

Issue 10828399: Implement class hierarchy analysis in the VM. (Closed)

Created:
8 years, 4 months ago by regis
Modified:
8 years, 4 months ago
Reviewers:
srdjan
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Implement class hierarchy analysis in the VM. Add test. Committed: https://code.google.com/p/dart/source/detail?r=11006

Patch Set 1 #

Total comments: 20

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+260 lines, -0 lines) Patch
M runtime/vm/class_finalizer.cc View 1 2 chunks +9 lines, -0 lines 0 comments Download
M runtime/vm/class_table.h View 1 2 chunks +19 lines, -0 lines 0 comments Download
M runtime/vm/class_table.cc View 1 1 chunk +75 lines, -0 lines 0 comments Download
A runtime/vm/class_table_test.cc View 1 1 chunk +126 lines, -0 lines 0 comments Download
M runtime/vm/object.h View 1 1 chunk +7 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 1 1 chunk +22 lines, -0 lines 0 comments Download
M runtime/vm/raw_object.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/vm_sources.gypi View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
regis
8 years, 4 months ago (2012-08-20 21:47:34 UTC) #1
srdjan
LGTM with questions https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table.cc File runtime/vm/class_table.cc (right): https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table.cc#newcode101 runtime/vm/class_table.cc:101: static bool ContainsCid(ZoneGrowableArray<intptr_t>* cids, intptr_t cid) ...
8 years, 4 months ago (2012-08-20 22:47:15 UTC) #2
regis
8 years, 4 months ago (2012-08-20 23:37:21 UTC) #3
Thanks!

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table.cc
File runtime/vm/class_table.cc (right):

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:101: static bool
ContainsCid(ZoneGrowableArray<intptr_t>* cids, intptr_t cid) {
On 2012/08/20 22:47:16, srdjan wrote:
> COde below would look simpler if you change cids to be constant reference.

Done.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:112: static void
CollectSubclassIds(ZoneGrowableArray<intptr_t>* cids,
On 2012/08/20 22:47:16, srdjan wrote:
> For later: maybe we should create a hash_set<intptr_t> if we decide to use
STLs.

OK

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:115:
GrowableObjectArray::Handle(cls.direct_subclasses());
On 2012/08/20 22:47:16, srdjan wrote:
> How about : if (cls_direct_subclasses.IsNull()) return;

Done.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:134: ASSERT(!cls.IsNull());
On 2012/08/20 22:47:16, srdjan wrote:
> ASSERT(cls.IsInstance()) ?

You can use IsInstance() on handles of objects. Here, we have a class. Once we
have kDartObjectCid, we can assert cid > kDartObjectCid.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:135: ZoneGrowableArray<intptr_t>* ids = new
ZoneGrowableArray<intptr_t>(2);
On 2012/08/20 22:47:16, srdjan wrote:
> Why 2? If you do not specify anything, the data does not get allocated until
> really needed.

Done.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:145: ZoneGrowableArray<Function*>* functions = new
ZoneGrowableArray<Function*>(2);
On 2012/08/20 22:47:16, srdjan wrote:
> ditto

Done.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:150: ASSERT(cid != kObjectCid);
On 2012/08/20 22:47:16, srdjan wrote:
> Assert not correct

We do not yet have kDartObjectCid. I've added a TODO and changed the ASSERT.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:152: cls = At(cid);
On 2012/08/20 22:47:16, srdjan wrote:
> ASSERT(cls.IsInstance()).

Done.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/class_table...
runtime/vm/class_table.cc:168: ZoneGrowableArray<intptr_t>* cids = new
ZoneGrowableArray<intptr_t>(4);
On 2012/08/20 22:47:16, srdjan wrote:
> ditto.

Done.

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/object.cc
File runtime/vm/object.cc (right):

https://chromiumcodereview.appspot.com/10828399/diff/1/runtime/vm/object.cc#n...
runtime/vm/object.cc:1864: ASSERT(id() != kObjectCid);
On 2012/08/20 22:47:16, srdjan wrote:
> AS discussed need a different cid.

Changed assert and added TODO.

Powered by Google App Engine
This is Rietveld 408576698