Enable ES6 Symbols by default
authoradamk@chromium.org <adamk@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 4 Aug 2014 18:17:54 +0000 (18:17 +0000)
committeradamk@chromium.org <adamk@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 4 Aug 2014 18:17:54 +0000 (18:17 +0000)
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

18 files changed:
src/bootstrapper.cc
src/d8.js
src/flag-definitions.h
src/v8natives.js
test/cctest/test-api.cc
test/cctest/test-heap-profiler.cc
test/mjsunit/debug-script.js
test/mjsunit/es6/mirror-symbols.js
test/mjsunit/es6/regress/regress-crbug-346141.js
test/mjsunit/es6/symbols.js
test/mjsunit/es7/object-observe.js
test/mjsunit/harmony/iteration-semantics.js
test/mjsunit/harmony/private.js
test/mjsunit/harmony/proxies-symbols.js
test/mjsunit/harmony/set-prototype-of.js
test/mjsunit/proto-accessor.js
test/mjsunit/regress/regress-crbug-350864.js
tools/gyp/v8.gyp

index c3dcb50..545d015 100644 (file)
@@ -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")
index 1e64b3c..2b927af 100644 (file)
--- a/src/d8.js
+++ b/src/d8.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);
index cf07b9b..19a04e4 100644 (file)
@@ -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)
 
index d885823..8484150 100644 (file)
@@ -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) {
index b6fef58..887add6 100644 (file)
@@ -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();");
index 186814e..8925f39 100644 (file)
@@ -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();
index 80d423e..449d2c9 100644 (file)
@@ -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
index 0f43491..f218332 100644 (file)
@@ -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) {
index 798b770..2b9655e 100644 (file)
@@ -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
index 7c211ca..a57c9b2 100644 (file)
@@ -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 = []
index 6b18ce7..0daa742 100644 (file)
@@ -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() {
index cc3cea8..de4719e 100644 (file)
@@ -27,7 +27,6 @@
 
 // Flags: --harmony-iteration
 // Flags: --harmony-generators --harmony-scoping --harmony-proxies
-// Flags: --harmony-symbols
 
 // Test for-of semantics.
 
index c4b0ed2..d3ed482 100644 (file)
@@ -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 = []
index 8920e39..52353c0 100644 (file)
@@ -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.
index 02bd5e2..810220d 100644 (file)
@@ -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() {}
index b2e7d34..513a044 100644 (file)
@@ -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;
 
index 8a793cb..510834b 100644 (file)
@@ -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);
index c5782c1..96dcb6d 100644 (file)
           '../../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',