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

Issue 10916207: Support receiving GrowableObjectArray on native ports (Closed)

Created:
8 years, 3 months ago by Søren Gjesse
Modified:
8 years, 3 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Support receiving GrowableObjectArray on native ports Array literals are created as GrowableObjectArrays internally. A GrowableObjectArray holds a length and a backing store. The backing store is an array. When receiving a GrowableObjectArray an object is created for holding the GrowableObjectArray. The the backing store has been read the object holding the GrowableObjectArray is transformed into an array with its content from the backing store. R=asiva@google.com, ager@google.com BUG=dart:4993 TEST=runtime/vm/snapshot_test.cc/DartGeneratedArrayLiteralMessagesWithBackref, runtime/vm/snapshot_test.cc/DartGeneratedArrayLiteralMessages Committed: https://code.google.com/p/dart/source/detail?r=12197

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressed review comments from ager@ #

Total comments: 8

Patch Set 3 : Addressed review commetns #

Unified diffs Side-by-side diffs Delta from patch set Stats (+306 lines, -0 lines) Patch
M runtime/vm/dart_api_message.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_message.cc View 1 2 1 chunk +18 lines, -0 lines 0 comments Download
M runtime/vm/snapshot_test.cc View 1 2 3 chunks +283 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Søren Gjesse
8 years, 3 months ago (2012-09-10 12:00:27 UTC) #1
Mads Ager (google)
LGTM, but we should wait for Siva's comments. https://chromiumcodereview.appspot.com/10916207/diff/1/runtime/vm/dart_api_message.cc File runtime/vm/dart_api_message.cc (right): https://chromiumcodereview.appspot.com/10916207/diff/1/runtime/vm/dart_api_message.cc#newcode167 runtime/vm/dart_api_message.cc:167: // ...
8 years, 3 months ago (2012-09-10 13:28:18 UTC) #2
Søren Gjesse
http://codereview.chromium.org/10916207/diff/1/runtime/vm/dart_api_message.cc File runtime/vm/dart_api_message.cc (right): http://codereview.chromium.org/10916207/diff/1/runtime/vm/dart_api_message.cc#newcode167 runtime/vm/dart_api_message.cc:167: // Allocate a Dart_CObject structure for holding the GrowableObjectArray ...
8 years, 3 months ago (2012-09-10 14:02:02 UTC) #3
Mads Ager (google)
Even better! :) http://codereview.chromium.org/10916207/diff/4001/runtime/vm/dart_api_message.cc File runtime/vm/dart_api_message.cc (right): http://codereview.chromium.org/10916207/diff/4001/runtime/vm/dart_api_message.cc#newcode216 runtime/vm/dart_api_message.cc:216: // Allocate an empty array for ...
8 years, 3 months ago (2012-09-10 14:05:04 UTC) #4
siva
LGTM with question regarding how free of this growable array object should be done if ...
8 years, 3 months ago (2012-09-11 01:46:23 UTC) #5
Søren Gjesse
8 years, 3 months ago (2012-09-11 14:36:03 UTC) #6
https://chromiumcodereview.appspot.com/10916207/diff/4001/runtime/vm/dart_api...
File runtime/vm/dart_api_message.cc (right):

https://chromiumcodereview.appspot.com/10916207/diff/4001/runtime/vm/dart_api...
runtime/vm/dart_api_message.cc:216: // Allocate an empty array for the
GrowableObjectArray this will be updated
On 2012/09/10 14:05:05, Mads Ager wrote:
> this will -> which will

Done.

https://chromiumcodereview.appspot.com/10916207/diff/4001/runtime/vm/dart_api...
runtime/vm/dart_api_message.cc:225: value->value.as_array.values =
content->value.as_array.values;
On 2012/09/11 01:46:23, siva wrote:
> How will this work if the allocator specified in the constructor for
> ApiMessageReader is a malloc allocator?
> 
> A free of the returned object will not deallocate the backing store right.
> 
> Agreed that we currently only use a zone allocator in the
> native message handler and all the test cases and this is
> not an issue with a zone allocator.
> 
> The ApiMessageHandler class itself doesn't specify that only a zone allocator
> should be used.
> 

We don't really have a way of running through the decoded structure to free the
individual pieces. This was already the case before as the decoded structure can
have cycles and there is no specification of how the various pieces for the
decoded structure are allocated.

I added a comment to the ApiMessageReader saying that the allocator needs to
keep track of data allocated to be able to free it again.

https://chromiumcodereview.appspot.com/10916207/diff/4001/runtime/vm/snapshot...
File runtime/vm/snapshot_test.cc (right):

https://chromiumcodereview.appspot.com/10916207/diff/4001/runtime/vm/snapshot...
runtime/vm/snapshot_test.cc:1684: EXPECT_EQ(Dart_CObject::kInt64,
element->type);
On 2012/09/11 01:46:23, siva wrote:
> In the string case you had a verification that element was "Hello, world!" but
> here there is no such check against an
> expected value.

Done.

https://chromiumcodereview.appspot.com/10916207/diff/4001/runtime/vm/snapshot...
runtime/vm/snapshot_test.cc:1697: EXPECT_EQ(Dart_CObject::kBigint,
element->type);
On 2012/09/11 01:46:23, siva wrote:
> Ditto comment regarding check against expected value.

Done.

Powered by Google App Engine
This is Rietveld 408576698