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

Issue 12296026: ES6 symbols: Implement Symbol intrinsic and basic functionality (Closed)

Created:
7 years, 10 months ago by rossberg
Modified:
7 years, 9 months ago
Reviewers:
Michael Starzinger
CC:
v8-dev, danno
Visibility:
Public.

Description

ES6 symbols: Implement Symbol intrinsic and basic functionality - Add --harmony-symbols flag. - Add Symbol constructor; allow symbols as (unreplaced) return value from constructors. - Introduce %CreateSymbol and %_IsSymbol natives and respective instructions. - Extend 'typeof' code generation to handle symbols. - Extend CompareIC with a UNIQUE_NAMES state that (uniformly) handles internalized strings and symbols. - Property lookup delegates to SymbolDelegate object for symbols, which only carries the toString method. - Extend Object.prototype.toString to recognise symbols. Per the current draft spec, symbols are actually pseudo objects that are frozen with a null prototype and only one property (toString). For simplicity, we do not treat them as proper objects for now, although typeof will return "object". Only property access works as if they were (frozen) objects (via the internal delegate object). (Baseline CL: https://codereview.chromium.org/12223071/) R=mstarzinger@chromium.org BUG=v8:2158 Committed: http://code.google.com/p/v8/source/detail?r=13786

Patch Set 1 #

Patch Set 2 : Added test for map keys #

Patch Set 3 : Addressed comment #

Total comments: 10

Patch Set 4 : Addressed more comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+562 lines, -49 lines) Patch
M src/SConscript View 1 chunk +1 line, -0 lines 0 comments Download
M src/arm/builtins-arm.cc View 1 chunk +5 lines, -1 line 0 comments Download
M src/arm/code-stubs-arm.cc View 1 chunk +51 lines, -0 lines 0 comments Download
M src/arm/full-codegen-arm.cc View 2 chunks +26 lines, -0 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 chunk +9 lines, -2 lines 0 comments Download
M src/arm/stub-cache-arm.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M src/bootstrapper.cc View 2 chunks +8 lines, -0 lines 0 comments Download
M src/code-stubs.h View 2 chunks +4 lines, -3 lines 0 comments Download
M src/code-stubs.cc View 1 chunk +3 lines, -0 lines 0 comments Download
M src/contexts.h View 2 chunks +2 lines, -0 lines 0 comments Download
M src/flag-definitions.h View 2 chunks +3 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 2 chunks +23 lines, -1 line 0 comments Download
M src/ia32/builtins-ia32.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 chunk +57 lines, -0 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 3 chunks +27 lines, -0 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 chunk +7 lines, -1 line 0 comments Download
M src/ia32/stub-cache-ia32.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M src/ic.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/ic.cc View 6 chunks +19 lines, -10 lines 0 comments Download
M src/ic-inl.h View 2 chunks +5 lines, -4 lines 0 comments Download
M src/macros.py View 1 chunk +1 line, -0 lines 0 comments Download
M src/objects.h View 3 chunks +7 lines, -0 lines 0 comments Download
M src/objects.cc View 1 2 3 5 chunks +17 lines, -3 lines 0 comments Download
M src/objects-inl.h View 1 2 3 2 chunks +10 lines, -5 lines 0 comments Download
M src/runtime.h View 3 chunks +5 lines, -1 line 0 comments Download
M src/runtime.cc View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
M src/stub-cache.cc View 3 chunks +6 lines, -2 lines 0 comments Download
A + src/symbol.js View 1 chunk +9 lines, -10 lines 0 comments Download
M src/type-info.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M src/v8globals.h View 2 chunks +2 lines, -1 line 0 comments Download
M src/v8natives.js View 1 chunk +3 lines, -4 lines 0 comments Download
M src/x64/builtins-x64.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M src/x64/code-stubs-x64.cc View 1 chunk +55 lines, -0 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 2 chunks +26 lines, -0 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 chunk +7 lines, -1 line 0 comments Download
M src/x64/stub-cache-x64.cc View 1 chunk +6 lines, -0 lines 0 comments Download
A test/mjsunit/harmony/symbols.js View 1 2 3 1 chunk +127 lines, -0 lines 0 comments Download
M tools/gyp/v8.gyp View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
rossberg
7 years, 10 months ago (2013-02-19 12:46:39 UTC) #1
Michael Starzinger
This is already looking good. Just one high-level comment: There is code missing to also ...
7 years, 10 months ago (2013-02-25 13:25:22 UTC) #2
rossberg
On 2013/02/25 13:25:22, Michael Starzinger wrote: > This is already looking good. Just one high-level ...
7 years, 10 months ago (2013-02-26 10:00:01 UTC) #3
Michael Starzinger
LGTM with a few nits. Just one real comment in the hydrogen.cc file. Also I ...
7 years, 10 months ago (2013-02-26 20:41:49 UTC) #4
rossberg
7 years, 9 months ago (2013-02-27 13:12:23 UTC) #5
https://codereview.chromium.org/12296026/diff/9001/src/hydrogen.cc
File src/hydrogen.cc (right):

https://codereview.chromium.org/12296026/diff/9001/src/hydrogen.cc#newcode4638
src/hydrogen.cc:4638: HHasInstanceTypeAndBranch* symbolcheck =
On 2013/02/26 20:41:49, Michael Starzinger wrote:
> For the inlining in Crankshaft we only need this part of the change when
> FLAG_harmony_symbols is set. Could you measure the performance impact of this
> additional check? If it has an impact we should hide it behind the flag.

Done.

https://codereview.chromium.org/12296026/diff/9001/src/runtime.cc
File src/runtime.cc (right):

https://codereview.chromium.org/12296026/diff/9001/src/runtime.cc#newcode682
src/runtime.cc:682: RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) {
On 2013/02/26 20:41:49, Michael Starzinger wrote:
> Let's play it safe and add "NoHandleAllocation ha;" to the top of this
function.
> IMHO, all runtime functions should have either that or their own HandleScope.

Done.

https://codereview.chromium.org/12296026/diff/9001/test/mjsunit/harmony/symbo...
File test/mjsunit/harmony/symbols.js (right):

https://codereview.chromium.org/12296026/diff/9001/test/mjsunit/harmony/symbo...
test/mjsunit/harmony/symbols.js:1: // Copyright 2012 the V8 project authors. All
rights reserved.
On 2013/02/26 20:41:49, Michael Starzinger wrote:
> The copyright header should say 2013 here.

Done.

https://codereview.chromium.org/12296026/diff/9001/test/mjsunit/harmony/symbo...
test/mjsunit/harmony/symbols.js:44: indirect()
On 2013/02/26 20:41:49, Michael Starzinger wrote:
> Could you add a comment like "// Call once before GC to preserve type
feedback."
> to the end of this line which explains why indirect() is called here?

Done.

https://codereview.chromium.org/12296026/diff/9001/test/mjsunit/harmony/symbo...
test/mjsunit/harmony/symbols.js:122: for (var i in symbols) {
On 2013/02/26 20:41:49, Michael Starzinger wrote:
> Could you also add a assertTrue(map.has(symbols[i])) check here?

Done.

Powered by Google App Engine
This is Rietveld 408576698