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

Issue 7321004: Implement Object.keys for proxies. (Closed)

Created:
9 years, 5 months ago by rossberg
Modified:
9 years, 5 months ago
CC:
v8-dev
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 8

Patch Set 2 : Adressing Mads comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -5 lines) Patch
M src/proxy.js View 1 1 chunk +12 lines, -0 lines 0 comments Download
M src/v8natives.js View 1 5 chunks +11 lines, -4 lines 0 comments Download
M test/mjsunit/harmony/proxies.js View 2 chunks +49 lines, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
rossberg
9 years, 5 months ago (2011-07-07 13:08:43 UTC) #1
rossberg
9 years, 5 months ago (2011-07-08 13:10:16 UTC) #2
Mads Ager (chromium)
LGTM with a couple of performance and behavior questions. http://codereview.chromium.org/7321004/diff/1/src/proxy.js File src/proxy.js (right): http://codereview.chromium.org/7321004/diff/1/src/proxy.js#newcode140 src/proxy.js:140: ...
9 years, 5 months ago (2011-07-12 13:28:19 UTC) #3
rossberg
http://codereview.chromium.org/7321004/diff/1/src/proxy.js File src/proxy.js (right): http://codereview.chromium.org/7321004/diff/1/src/proxy.js#newcode140 src/proxy.js:140: return this.getOwnPropertyNames().filter( On 2011/07/12 13:28:19, Mads Ager wrote: > ...
9 years, 5 months ago (2011-07-13 10:11:52 UTC) #4
Mads Ager (chromium)
9 years, 5 months ago (2011-07-13 10:17:25 UTC) #5
Still LGTM.

http://codereview.chromium.org/7321004/diff/1/src/proxy.js
File src/proxy.js (right):

http://codereview.chromium.org/7321004/diff/1/src/proxy.js#newcode142
src/proxy.js:142: return this.getOwnPropertyDescriptor('' + name).enumerable
On 2011/07/13 10:11:52, rossberg wrote:
> On 2011/07/12 13:28:19, Mads Ager wrote:
> > Do you need the string conversion here? Does getOwnPropertyNames ever return
> > somthing that is not a string?
> 
> Yes, that's actually a minor inconsistency in the current spec (which doesn't
> have the conversion) that I reported -- getOwnPropertyNames is a user trap, so
> it can return anything.
> 
> There are a few inconsistencies like that in the spec...
> 
> > If so, consider using TO_STRING_INLINE(name) to
> > make this faster.
> 
> Done, but I have a question: doing TO_STRING_INLINE(names[i]) kept segfaulting
> on me, until I found out that I better do "var name = names[i];
> TO_STRING_INLINE(name)" instead. Is that a known (documented?) limitation?

Yes, that is on purpose. The point is that TO_STRING_INLINE is a macro (defined
in macros.py) which has a fast case and a slow case. The macro duplicates the
argument and therefore we require it to be a variable to help ourselves avoid
repeating stuff with side effects.

http://codereview.chromium.org/7321004/diff/1/src/v8natives.js
File src/v8natives.js (right):

http://codereview.chromium.org/7321004/diff/1/src/v8natives.js#newcode315
src/v8natives.js:315: var names = keys.call(handler);
On 2011/07/13 10:11:52, rossberg wrote:
> On 2011/07/12 13:28:19, Mads Ager wrote:
> > Do you want to rely on Function.prototype.call here or do you want to use
> > %_CallFunction(handler, keys)?
> 
> Done, here and in a few other places. (Btw, who picked the argument order of
> that built-in??)

I don't remember. I would have preferred having the function first... :-)

Powered by Google App Engine
This is Rietveld 408576698