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

Issue 118553003: Upgrade Symbol implementation to match current ES6 behavior. (Closed)

Created:
6 years, 11 months ago by sof
Modified:
6 years, 10 months ago
CC:
v8-dev
Base URL:
git://github.com/v8/v8.git@bleeding_edge
Visibility:
Public.

Description

Upgrade Symbol implementation to match current ES6 behavior. Refresh the implementation of Symbols to catch up with what the specification now mandates: * The global Symbol() function manufactures new Symbol values, optionally with a string description attached. * Invoking Symbol() as a constructor will now throw. * ToString() over Symbol values still throws, and Object.prototype.toString() stringifies like before. * A Symbol value is wrapped in a Symbol object either implicitly if it is the receiver, or explicitly done via Object(symbolValue) or (new Object(symbolValue).) * The Symbol.prototype.toString() method no longer throws on Symbol wrapper objects (nor Symbol values.) Ditto for Symbol.prototype.valueOf(). * Symbol.prototype.toString() stringifies as "Symbol("<description>"), valueOf() returns the wrapper's Symbol value. * ToPrimitive() over Symbol wrapper objects now throws. Overall, this provides a stricter separation between Symbol values and wrapper objects than before, and the explicit fetching out of the description (nee name) via the "name" property is no longer supported (by the spec nor the implementation.) Adjusted existing Symbol test files to fit current, adding some extra tests for new/changed behavior. LOG=N R=arv@chromium.org, rossberg@chromium.org, arv, rossberg BUG=v8:3053 Committed: https://code.google.com/p/v8/source/detail?r=19490

Patch Set 1 #

Total comments: 43

Patch Set 2 : Fix fundamental issues surrounding Symbol values vs (wrapper) objects #

Total comments: 7

Patch Set 3 : Rebased + adapted valueOf/toString autoboxing to work post-CallICs. #

Patch Set 4 : Remove uninteresting equality test #

Total comments: 8

Patch Set 5 : Allow valueOf()/toString() to be called over Symbol values. #

Total comments: 31

Patch Set 6 : EQUALS(): add missing Symbol checks #

Total comments: 9

Patch Set 7 : Some test improvements. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -84 lines) Patch
M src/messages.js View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M src/objects.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M src/runtime.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/runtime.cc View 1 2 3 4 1 chunk +8 lines, -1 line 0 comments Download
M src/runtime.js View 1 2 3 4 5 6 chunks +7 lines, -7 lines 0 comments Download
M src/symbol.js View 1 2 3 4 2 chunks +13 lines, -20 lines 0 comments Download
M test/cctest/test-api.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M test/mjsunit/harmony/private.js View 1 2 3 4 5 6 chunks +26 lines, -20 lines 0 comments Download
M test/mjsunit/harmony/symbols.js View 1 2 3 4 5 6 10 chunks +54 lines, -33 lines 0 comments Download

Messages

Total messages: 35 (0 generated)
sof
Please take a look when you next have a moment. The encoding/representation of the Symbol ...
6 years, 11 months ago (2014-01-03 20:12:36 UTC) #1
rossberg
Hmmmm... I'm really confused about this change. I only looked at the diffs to the ...
6 years, 11 months ago (2014-01-08 17:52:24 UTC) #2
sof
Commented on some of them; I think we're not in sync here somehow on spec ...
6 years, 11 months ago (2014-01-08 18:13:43 UTC) #3
arv (Not doing code reviews)
This does not look correct to me. Symbol should behave like Number, String and Boolean ...
6 years, 11 months ago (2014-01-08 18:54:43 UTC) #4
sof
On 2014/01/08 18:54:43, arv wrote: > This does not look correct to me. Symbol should ...
6 years, 11 months ago (2014-01-08 18:58:01 UTC) #5
arv (Not doing code reviews)
On 2014/01/08 18:58:01, sof wrote: > On 2014/01/08 18:54:43, arv wrote: > > This does ...
6 years, 11 months ago (2014-01-08 19:01:55 UTC) #6
rossberg
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode75 test/mjsunit/harmony/symbols.js:75: assertSame(Function.prototype, Symbol.prototype) On 2014/01/08 18:13:43, sof wrote: > On ...
6 years, 11 months ago (2014-01-09 10:35:53 UTC) #7
sof
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode75 test/mjsunit/harmony/symbols.js:75: assertSame(Function.prototype, Symbol.prototype) On 2014/01/09 10:35:53, rossberg wrote: > On ...
6 years, 11 months ago (2014-01-09 13:17:12 UTC) #8
rossberg
On 2014/01/09 13:17:12, sof wrote: > I will need to sit down and change the ...
6 years, 11 months ago (2014-01-09 13:42:40 UTC) #9
sof
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode205 test/mjsunit/harmony/symbols.js:205: assertEquals(symbols[i], Object(symbols[i]).valueOf()) On 2014/01/09 10:35:53, rossberg wrote: > On ...
6 years, 11 months ago (2014-01-10 10:53:52 UTC) #10
rossberg
On 2014/01/10 10:53:52, sof wrote: > https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js > File test/mjsunit/harmony/symbols.js (right): > > https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode205 > ...
6 years, 11 months ago (2014-01-10 11:32:30 UTC) #11
sof
On 2014/01/10 11:32:30, rossberg wrote: > On 2014/01/10 10:53:52, sof wrote: > > > https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js ...
6 years, 11 months ago (2014-01-12 16:29:23 UTC) #12
sof
With TC39 meeting having come & gone (?), might this possibly be looked at again ...
6 years, 10 months ago (2014-01-31 12:27:43 UTC) #13
arv (Not doing code reviews)
I think there are still some misunderstandings. I think the equality is wrong. https://codereview.chromium.org/118553003/diff/170001/src/messages.js File ...
6 years, 10 months ago (2014-02-01 01:33:10 UTC) #14
sof
https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js#newcode172 test/mjsunit/harmony/symbols.js:172: assertEquals(Object(symbols[i]), Object(symbols[i])) On 2014/02/01 01:33:10, arv wrote: > This ...
6 years, 10 months ago (2014-02-01 13:58:10 UTC) #15
sof
The removal of CallICs that just landed voided the autoboxing of Symbol values needed here. ...
6 years, 10 months ago (2014-02-02 14:28:49 UTC) #16
arv (Not doing code reviews)
https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js#newcode172 test/mjsunit/harmony/symbols.js:172: assertEquals(Object(symbols[i]), Object(symbols[i])) On 2014/02/01 13:58:10, sof wrote: > On ...
6 years, 10 months ago (2014-02-02 19:49:34 UTC) #17
sof
https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js#newcode172 test/mjsunit/harmony/symbols.js:172: assertEquals(Object(symbols[i]), Object(symbols[i])) On 2014/02/02 19:49:35, arv wrote: > On ...
6 years, 10 months ago (2014-02-02 19:59:56 UTC) #18
arv (Not doing code reviews)
On 2014/02/02 19:59:56, sof wrote: > https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js > File test/mjsunit/harmony/symbols.js (right): > > https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js#newcode172 > ...
6 years, 10 months ago (2014-02-02 20:08:59 UTC) #19
sof
On 2014/02/02 20:08:59, arv wrote: > On 2014/02/02 19:59:56, sof wrote: > > > https://codereview.chromium.org/118553003/diff/170001/test/mjsunit/harmony/symbols.js ...
6 years, 10 months ago (2014-02-02 20:29:01 UTC) #20
rossberg
https://codereview.chromium.org/118553003/diff/400001/src/symbol.js File src/symbol.js (right): https://codereview.chromium.org/118553003/diff/400001/src/symbol.js#newcode59 src/symbol.js:59: throw MakeTypeError('symbol_to_value', []); We should leave this out for ...
6 years, 10 months ago (2014-02-04 15:16:24 UTC) #21
sof
https://codereview.chromium.org/118553003/diff/400001/src/symbol.js File src/symbol.js (right): https://codereview.chromium.org/118553003/diff/400001/src/symbol.js#newcode59 src/symbol.js:59: throw MakeTypeError('symbol_to_value', []); On 2014/02/04 15:16:25, rossberg wrote: > ...
6 years, 10 months ago (2014-02-04 15:40:58 UTC) #22
rossberg
On 2014/02/04 15:40:58, sof wrote: > https://codereview.chromium.org/118553003/diff/400001/src/symbol.js > File src/symbol.js (right): > > https://codereview.chromium.org/118553003/diff/400001/src/symbol.js#newcode59 > ...
6 years, 10 months ago (2014-02-04 15:58:31 UTC) #23
rossberg
On 2014/02/04 15:58:31, rossberg wrote: > > Defining away what was the main part of ...
6 years, 10 months ago (2014-02-04 15:59:49 UTC) #24
rossberg
Filed a bug: https://bugs.ecmascript.org/show_bug.cgi?id=2498
6 years, 10 months ago (2014-02-04 16:09:00 UTC) #25
sof
On 2014/02/04 16:09:00, rossberg wrote: > Filed a bug: > > https://bugs.ecmascript.org/show_bug.cgi?id=2498 Thanks, I'll await ...
6 years, 10 months ago (2014-02-05 08:29:29 UTC) #26
rossberg
On 2014/02/05 08:29:29, sof wrote: > On 2014/02/04 16:09:00, rossberg wrote: > > Filed a ...
6 years, 10 months ago (2014-02-12 10:42:49 UTC) #27
sof
On 2014/02/12 10:42:49, rossberg wrote: > On 2014/02/05 08:29:29, sof wrote: > > On 2014/02/04 ...
6 years, 10 months ago (2014-02-12 12:05:11 UTC) #28
sof
On 2014/02/12 10:42:49, rossberg wrote: .. > > Yes, both toString and valueOf should work ...
6 years, 10 months ago (2014-02-14 08:57:33 UTC) #29
rossberg
Great, thanks for all the work. Mostly cosmetics remaining. https://codereview.chromium.org/118553003/diff/550001/src/runtime.h File src/runtime.h (right): https://codereview.chromium.org/118553003/diff/550001/src/runtime.h#newcode317 src/runtime.h:317: ...
6 years, 10 months ago (2014-02-14 10:55:29 UTC) #30
sof
Thanks for the detailed feedback; hopefully addressed. https://codereview.chromium.org/118553003/diff/550001/src/runtime.h File src/runtime.h (right): https://codereview.chromium.org/118553003/diff/550001/src/runtime.h#newcode317 src/runtime.h:317: F(NewSymbolWrapper, 1, ...
6 years, 10 months ago (2014-02-14 14:20:02 UTC) #31
arv (Not doing code reviews)
LGTM Thanks for taking care of this. https://codereview.chromium.org/118553003/diff/620001/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/620001/test/mjsunit/harmony/symbols.js#newcode55 test/mjsunit/harmony/symbols.js:55: assertThrows(function () ...
6 years, 10 months ago (2014-02-14 15:30:10 UTC) #32
sof
https://codereview.chromium.org/118553003/diff/620001/test/mjsunit/harmony/symbols.js File test/mjsunit/harmony/symbols.js (right): https://codereview.chromium.org/118553003/diff/620001/test/mjsunit/harmony/symbols.js#newcode55 test/mjsunit/harmony/symbols.js:55: assertThrows(function () { Symbol(Symbol()) }, TypeError) On 2014/02/14 15:30:11, ...
6 years, 10 months ago (2014-02-14 15:43:42 UTC) #33
rossberg
LGTM, will land tomorrow https://codereview.chromium.org/118553003/diff/550001/src/runtime.h File src/runtime.h (right): https://codereview.chromium.org/118553003/diff/550001/src/runtime.h#newcode317 src/runtime.h:317: F(NewSymbolWrapper, 1, 1) \ On ...
6 years, 10 months ago (2014-02-18 17:05:57 UTC) #34
rossberg
6 years, 10 months ago (2014-02-19 14:19:54 UTC) #35
Message was sent while issue was closed.
Committed patchset #7 manually as r19490 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698