ES6 symbols: Introduce Symbol class, along with abstract Name class
authorrossberg@chromium.org <rossberg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 1 Mar 2013 10:34:31 +0000 (10:34 +0000)
committerrossberg@chromium.org <rossberg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 1 Mar 2013 10:34:31 +0000 (10:34 +0000)
commit764e1a0fcf7dd10616e86b09cbbb87d8e503393f
tree1f5a8e02bf89fd6d8bc9efcb157137f711b6af22
parent922efe43ed98e0e7117918ba102405c36e25a428
ES6 symbols: Introduce Symbol class, along with abstract Name class

The new instance type 'Symbol' represents ES6 symbols (a.k.a. private/unique names). Currently, symbols are simple data objects that only carry a hash code, random-generated upon allocation.

The new type 'Name' now serves as the common super class for strings and symbols, and is supposed to represent property names. We will eventually migrate APIs from String to Name for the standard key type.

Strings and symbols share the same hash field representation, via the Name class. This way, we should be able to use the same code paths for symbols and internalized strings in most cases. Also, Symbol's instance type code is allocated adjacent to internalized string codes in the enum, allowing a simple range check for the common case.

Baseline CL: https://codereview.chromium.org/12210083/

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/12223071

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13783 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
14 files changed:
include/v8.h
src/factory.cc
src/factory.h
src/heap.cc
src/heap.h
src/objects-debug.cc
src/objects-inl.h
src/objects-printer.cc
src/objects-visiting.cc
src/objects.cc
src/objects.h
test/cctest/SConscript
test/cctest/cctest.gyp
test/cctest/test-symbols.cc [new file with mode: 0644]