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

Issue 21924007: Make new Harmony constructors subclassing-friendly (Closed)

Created:
7 years, 4 months ago by Dmitry Lomov (no reviews)
Modified:
7 years, 4 months ago
CC:
v8-dev, arv (Not doing code reviews)
Visibility:
Public.

Description

Make new Harmony constructors subclassing-friendly R=mstarzinger@chromium.org CC=arv@chromium.org

Patch Set 1 : #

Total comments: 8

Patch Set 2 : CR feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+257 lines, -79 lines) Patch
M src/arraybuffer.js View 1 chunk +2 lines, -6 lines 0 comments Download
M src/collection.js View 8 chunks +8 lines, -24 lines 0 comments Download
M src/messages.js View 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime.h View 3 chunks +5 lines, -1 line 0 comments Download
M src/runtime.cc View 1 8 chunks +163 lines, -16 lines 0 comments Download
M src/typedarray.js View 2 chunks +19 lines, -27 lines 0 comments Download
M test/mjsunit/harmony/collections.js View 2 chunks +15 lines, -1 line 0 comments Download
M test/mjsunit/harmony/typedarrays.js View 3 chunks +44 lines, -4 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Dmitry Lomov (no reviews)
PTAL.
7 years, 4 months ago (2013-08-03 15:10:40 UTC) #1
arv (Not doing code reviews)
https://codereview.chromium.org/21924007/diff/3001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/21924007/diff/3001/src/collection.js#newcode52 src/collection.js:52: if (!IS_SET(this)) { Remember that all of these needs ...
7 years, 4 months ago (2013-08-04 16:44:28 UTC) #2
Dmitry Lomov (no reviews)
https://codereview.chromium.org/21924007/diff/3001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/21924007/diff/3001/src/collection.js#newcode52 src/collection.js:52: if (!IS_SET(this)) { On 2013/08/04 16:44:28, arv wrote: > ...
7 years, 4 months ago (2013-08-05 10:15:22 UTC) #3
arv (Not doing code reviews)
https://codereview.chromium.org/21924007/diff/3001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/21924007/diff/3001/src/collection.js#newcode52 src/collection.js:52: if (!IS_SET(this)) { On 2013/08/05 10:15:22, Dmitry Lomov (chromium) ...
7 years, 4 months ago (2013-08-05 13:34:33 UTC) #4
Dmitry Lomov (no reviews)
7 years, 4 months ago (2013-08-05 14:07:51 UTC) #5
Ok upon some deliberation, I decided that it is too early to land this patch.

1. This patch does not have any support for methods other than constructors
being invoked on uninitialized objects.
2. We do not expose @@construct on JS objects anyway yet, so this patch solves a
problem that does not exists
3  Once we do expose @@construct, we need to think carefully what the design
would be (a strawman per Andreas's suggestion all un-initialized objects sstart
with the same instance type [say JS_BLUEPRINT] that transitions to correct
instance type after a call to constructor)

Thanks to Erik's change in https://code.google.com/p/v8/source/detail?r=16006,
we in a nice future-proof state now, which will let us move forward once we
start implementing subclassing support in earnest.

On 2013/08/05 13:34:33, arv wrote:
> https://codereview.chromium.org/21924007/diff/3001/src/collection.js
> File src/collection.js (right):
> 
> https://codereview.chromium.org/21924007/diff/3001/src/collection.js#newcode52
> src/collection.js:52: if (!IS_SET(this)) {
> On 2013/08/05 10:15:22, Dmitry Lomov (chromium) wrote:
> > On 2013/08/04 16:44:28, arv wrote:
> > > Remember that all of these needs to be changed to actually test that it is
> an
> > > initialized Set and not just a Set.
> > > 
> > > var uninitializedSet = %NewObject(Set);
> > > assertThrows(function() {
> > >   Set.prototype.add.call(uninitializedSet, 'key');
> > > }, TypeError);
> > > 
> > > At this point, the only way to get  an uninitialized Set is to use
> %NewObject
> > so
> > > and user code will not be able to trigger this. But once we expose
@@create
> > this
> > > will need to be fixed.
> > 
> > Do you think we should fix all of these in this CL or we can do other error
> > checking in later CLs? (this whole @@create thing is a can of worms,
> obviously)
> 
> I think it is fine to do this later. It is not observable without %NewObject
> 
> https://codereview.chromium.org/21924007/diff/3001/src/runtime.cc
> File src/runtime.cc (right):
> 
> https://codereview.chromium.org/21924007/diff/3001/src/runtime.cc#newcode914
> src/runtime.cc:914: ArrayIdToTypeAndSize(arrayId, &array_type, &element_size,
> &name);
> On 2013/08/05 10:15:22, Dmitry Lomov (chromium) wrote:
> > On 2013/08/04 16:44:28, arv wrote:
> > > Can you move this code into the error cases? The common case is that there
> is
> > no
> > > error and we can skip all this extra work just to get the name that we are
> not
> > > going to use.
> > 
> > Done. Do you think it's cleaner that way? (Perf impact is non-existent of
> > course)
> > 
> 
> Sorry, I think my comment was bad advice. I didn't realize that this work
needs
> to be done in the common case anyway. Adding the name will be lost in the
noise.
> I didn't realize how much work is done on initialization anyway.
> 
> I'll let you determine which way you prefer. The old way is definitely
cleaner.

Powered by Google App Engine
This is Rietveld 408576698