Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 4827963358969856: Issue 147 - [Typed objects] Implement object types (Closed)

Created:
April 4, 2014, 10:28 a.m. by Wladimir Palant
Modified:
April 22, 2014, 7:12 p.m.
Reviewers:
René Jeschke
CC:
Felix Dahlke, tschuster
Visibility:
Public.

Description

This is only the first type - so far only the actual object types have been implemented and no garbage collection mechanism.

Patch Set 1 #

Total comments: 15

Patch Set 2 : Fixed comments and one more issue #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3289 lines, -0 lines) Patch
A lib/typedObjects.js View 1 1 chunk +71 lines, -0 lines 0 comments Download
A lib/typedObjects/objectTypes.js View 1 1 chunk +199 lines, -0 lines 0 comments Download
A lib/typedObjects/primitiveTypes.js View 1 1 chunk +65 lines, -0 lines 0 comments Download
A lib/typedObjects/references.js View 1 1 chunk +103 lines, -0 lines 0 comments Download
A lib/typedObjects/utils.js View 1 1 chunk +131 lines, -0 lines 0 comments Download
A run_tests.py View 1 chunk +49 lines, -0 lines 0 comments Download
A test/common.js View 1 chunk +22 lines, -0 lines 0 comments Download
A test/index.html View 1 chunk +22 lines, -0 lines 0 comments Download
A test/jquery-1.7.1.min.js View 1 chunk +4 lines, -0 lines 0 comments Download
A test/qunit.css View 1 chunk +244 lines, -0 lines 0 comments Download
A test/qunit.js View 1 chunk +2212 lines, -0 lines 0 comments Download
A test/tests/typedObjects.js View 1 1 chunk +167 lines, -0 lines 0 comments Download

Messages

Total messages: 4
Wladimir Palant
April 4, 2014, 10:28 a.m. (2014-04-04 10:28:24 UTC) #1
René Jeschke
First: sorry for the long wait, needed to wrap my head around this and was ...
April 21, 2014, 5:24 p.m. (2014-04-21 17:24:12 UTC) #2
Wladimir Palant
> Another issue I see is that we should be aware of the (memory) overhead ...
April 22, 2014, 3:25 p.m. (2014-04-22 15:25:05 UTC) #3
René Jeschke
April 22, 2014, 3:40 p.m. (2014-04-22 15:40:33 UTC) #4
LGTM

http://codereview.adblockplus.org/4827963358969856/diff/5629499534213120/lib/...
File lib/typedObjects/objectTypes.js (right):

http://codereview.adblockplus.org/4827963358969856/diff/5629499534213120/lib/...
lib/typedObjects/objectTypes.js:51: [this.firstFree.targetBufferIndex,
this.firstFree.targetByteOffset];
On 2014/04/22 15:25:05, Wladimir Palant wrote:
> On 2014/04/21 17:24:12, René Jeschke wrote:
> > Do we gain anything from [a, b] = [c, d] instead of using a = c; b = d; ? 
> 
> reference.bufferIndex = reference.targetBufferIndex will change what memory
area
> the reference points to. Consequently, reading reference.targetByteOffset will
> return bogus data.
> 
> AFAIK, using the destructuring assignment like that won't actually create a
> temporary array.

Right, using temporaries also will look ugly. So: ok.

http://codereview.adblockplus.org/4827963358969856/diff/5629499534213120/lib/...
lib/typedObjects/objectTypes.js:165: byteLength = ((byteLength - 1) |
(maxReferenceLength - 1)) + 1;
On 2014/04/22 15:25:05, Wladimir Palant wrote:
> On 2014/04/21 17:24:12, René Jeschke wrote:
> > This only works correctly if either 'byteLength' or 'maxReferenceLength' is
a
> > power-of-two. Have you considered this or better: can this become a problem?
> 
> No, maxReferenceLength has to be a power of two - that's a requirement for
each
> primitive type. Note that we round up the size of the Reference class in
> calculateSize() for that very reason (not that it changes much, size of an
> object reference is 8 bytes anyway).

Okay then.

http://codereview.adblockplus.org/4827963358969856/diff/5629499534213120/lib/...
lib/typedObjects/objectTypes.js:181: constructor: (typeof meta.constructor ==
"function" ? meta.constructor : null)
On 2014/04/22 15:25:05, Wladimir Palant wrote:
> This was a bug - each JavaScript object has a constructor property that is a
> function.

Didn't know that, now I do. Finally a good use case for 'hasOwnProperty'.

http://codereview.adblockplus.org/4827963358969856/diff/5629499534213120/lib/...
File lib/typedObjects/utils.js (right):

http://codereview.adblockplus.org/4827963358969856/diff/5629499534213120/lib/...
lib/typedObjects/utils.js:24: exports.log2 = function log2(/**Integer*/ num)
/**Integer*/
On 2014/04/22 15:25:05, Wladimir Palant wrote:
> Changed name into ilog2 but I didn't really feel like introducing an
additional
> check/branch to this function.

Alright then.

Powered by Google App Engine
This is Rietveld