Commit d8c30bd8 authored by adamk@chromium.org's avatar adamk@chromium.org

Enable ES6 Symbols by default

In doing so also remove all references to the --harmony-symbols flag.
Due to the way context snapshotting works, it's not possible to simply enable
the flag by default.

BUG=v8:2158
LOG=Y
R=dslomov@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22831 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 10881d87
......@@ -1134,6 +1134,14 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
isolate->initial_object_prototype(), Builtins::kIllegal);
{
// --- S y m b o l ---
Handle<JSFunction> symbol_fun = InstallFunction(
global, "Symbol", JS_VALUE_TYPE, JSValue::kSize,
isolate->initial_object_prototype(), Builtins::kIllegal);
native_context()->set_symbol_function(*symbol_fun);
}
{ // --- sloppy arguments map
// Make sure we can recognize argument objects at runtime.
// This is done by introducing an anonymous function with
......@@ -1308,14 +1316,6 @@ void Genesis::InitializeExperimentalGlobal() {
// TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
// longer need to live behind flags, so functions get added to the snapshot.
if (FLAG_harmony_symbols) {
// --- S y m b o l ---
Handle<JSFunction> symbol_fun = InstallFunction(
global, "Symbol", JS_VALUE_TYPE, JSValue::kSize,
isolate()->initial_object_prototype(), Builtins::kIllegal);
native_context()->set_symbol_function(*symbol_fun);
}
if (FLAG_harmony_collections) {
// -- M a p
InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize,
......@@ -1621,6 +1621,7 @@ void Genesis::InstallNativeFunctions() {
native_object_get_notifier);
INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange",
native_object_notifier_perform_change);
INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol);
INSTALL_NATIVE_MATH(abs)
INSTALL_NATIVE_MATH(acos)
......@@ -1651,10 +1652,6 @@ void Genesis::InstallExperimentalNativeFunctions() {
INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
}
if (FLAG_harmony_symbols) {
INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol);
}
}
#undef INSTALL_NATIVE
......@@ -2071,7 +2068,6 @@ bool Genesis::InstallExperimentalNatives() {
for (int i = ExperimentalNatives::GetDebuggerCount();
i < ExperimentalNatives::GetBuiltinsCount();
i++) {
INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js")
INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js")
INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection-iterator.js")
......
......@@ -1997,10 +1997,7 @@ function Stringify(x, depth) {
} catch(e) {}
var props = [];
var names = Object.getOwnPropertyNames(x);
if (Object.getOwnPropertySymbols) {
// FLAG_harmony_symbols is turned on.
names = names.concat(Object.getOwnPropertySymbols(x));
}
names = names.concat(Object.getOwnPropertySymbols(x));
for (var i in names) {
var name = names[i];
var desc = Object.getOwnPropertyDescriptor(x, name);
......
......@@ -153,7 +153,6 @@ DEFINE_BOOL(es_staging, false, "enable upcoming ES6+ features")
DEFINE_BOOL(harmony_scoping, false, "enable harmony block scoping")
DEFINE_BOOL(harmony_modules, false,
"enable harmony modules (implies block scoping)")
DEFINE_BOOL(harmony_symbols, false, "enable harmony symbols")
DEFINE_BOOL(harmony_proxies, false, "enable harmony proxies")
DEFINE_BOOL(harmony_collections, false,
"enable harmony collections (sets, maps)")
......@@ -176,12 +175,8 @@ DEFINE_IMPLICATION(harmony, harmony_strings)
DEFINE_IMPLICATION(harmony, harmony_arrays)
DEFINE_IMPLICATION(harmony, harmony_arrow_functions)
DEFINE_IMPLICATION(harmony_modules, harmony_scoping)
DEFINE_IMPLICATION(harmony_collections, harmony_symbols)
DEFINE_IMPLICATION(harmony_generators, harmony_symbols)
DEFINE_IMPLICATION(harmony_iteration, harmony_symbols)
DEFINE_IMPLICATION(harmony, es_staging)
DEFINE_IMPLICATION(es_staging, harmony_symbols)
DEFINE_IMPLICATION(es_staging, harmony_collections)
DEFINE_IMPLICATION(es_staging, harmony_iteration)
......
......@@ -1180,7 +1180,6 @@ function GetOwnEnumerablePropertyNames(object) {
}
}
// FLAG_harmony_symbols may be on, but symbols aren't included by for-in.
var filter = PROPERTY_ATTRIBUTES_STRING | PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL;
var symbols = %GetOwnPropertyNames(object, filter);
for (var i = 0; i < symbols.length; ++i) {
......
......@@ -2737,8 +2737,6 @@ THREADED_TEST(GlobalProxyIdentityHash) {
THREADED_TEST(SymbolProperties) {
i::FLAG_harmony_symbols = true;
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
......@@ -2887,8 +2885,6 @@ THREADED_TEST(PrivateProperties) {
THREADED_TEST(GlobalSymbols) {
i::FLAG_harmony_symbols = true;
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
......@@ -21411,7 +21407,6 @@ THREADED_TEST(Regress157124) {
THREADED_TEST(Regress2535) {
i::FLAG_harmony_collections = true;
i::FLAG_harmony_symbols = true;
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
Local<Value> set_value = CompileRun("new Set();");
......
......@@ -472,8 +472,6 @@ TEST(HeapSnapshotConsString) {
TEST(HeapSnapshotSymbol) {
i::FLAG_harmony_symbols = true;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
......
......@@ -59,7 +59,7 @@ for (i = 0; i < scripts.length; i++) {
}
// This has to be updated if the number of native scripts change.
assertTrue(named_native_count == 19 || named_native_count == 20);
assertEquals(21, named_native_count);
// Only the 'gc' extension is loaded.
assertEquals(1, extension_count);
// This script and mjsunit.js has been loaded. If using d8, d8 loads
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --harmony-symbols
// Flags: --expose-debug-as debug
// Test the mirror object for symbols.
function testSymbolMirror(symbol, description) {
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-symbols
var s = Symbol()
var o = {}
o[s] = 2
......
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-symbols --harmony-collections
// Flags: --harmony-collections
// Flags: --expose-gc --allow-natives-syntax
var symbols = []
......
......@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-proxies --harmony-collections
// Flags: --harmony-symbols --allow-natives-syntax
// Flags: --allow-natives-syntax
var allObservers = [];
function reset() {
......
......@@ -27,7 +27,6 @@
// Flags: --harmony-iteration
// Flags: --harmony-generators --harmony-scoping --harmony-proxies
// Flags: --harmony-symbols
// Test for-of semantics.
......
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-symbols --harmony-collections
// Flags: --harmony-collections
// Flags: --expose-gc --allow-natives-syntax
var symbols = []
......
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-proxies --harmony-symbols
// Flags: --harmony-proxies
// Helper.
......
......@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-symbols
function getObjects() {
function func() {}
......
......@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-symbols
// Fake Symbol if undefined, allowing test to run in non-Harmony mode as well.
this.Symbol = typeof Symbol != 'undefined' ? Symbol : String;
......
......@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-symbols
var v0 = new WeakMap;
var v1 = {};
v0.set(v1, 1);
......
......@@ -1431,11 +1431,11 @@
'../../src/weak_collection.js',
'../../src/promise.js',
'../../src/object-observe.js',
'../../src/symbol.js',
'../../src/macros.py',
],
'experimental_library_files': [
'../../src/macros.py',
'../../src/symbol.js',
'../../src/proxy.js',
'../../src/collection.js',
'../../src/collection-iterator.js',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment