Reviewers: rossberg,

Description:
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

Please review this at https://codereview.chromium.org/421313004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

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


Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index e58bf5abdb43b79699b32fea96f7fc6f340dfd08..a8381c6234c8695629be073775f5a3192a319080 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1177,6 +1177,14 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
     ASSERT(IsFastObjectElementsKind(map->elements_kind()));
   }

+  {
+    // --- 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);
+  }
+
   {  // --- aliased arguments map
     Handle<Map> map = Map::Copy(isolate->sloppy_arguments_map());
     map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
@@ -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,
@@ -1583,6 +1583,7 @@ void Genesis::InstallNativeFunctions() {
                  native_object_get_notifier);
   INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange",
                  native_object_notifier_perform_change);
+  INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol);
 }


@@ -1593,10 +1594,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
@@ -2013,7 +2010,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: src/d8.js
diff --git a/src/d8.js b/src/d8.js
index 1e64b3c50dfd38f8318bcf7f233f570665c912c4..2b927aface10e732a2bdf7e1dee8c090ec9c417f 100644
--- 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: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 3fc16fbef392c220a762c873bfa074c9056336ae..552256194b2ac8a57131e6ef94c37004a43c6aca 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -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: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index d885823fed7418cf68e26a2d8fd75b309ddbe61b..8484150248a13a2ef01467da31603fab1db88b0c 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -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: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 95ec47963416f1d25a2a1fbadd6bfedbe99a329f..51b7d251e4f895dd9195fb32152a42265fc04135 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -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);
@@ -21396,7 +21392,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: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc index 33528fbb03c29020309e294521829c30bb4312bc..322d4663feb7f54c3a3833a431cefa497c4f19f3 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -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: test/mjsunit/debug-script.js
diff --git a/test/mjsunit/debug-script.js b/test/mjsunit/debug-script.js
index 80d423e10bf5806fb7bb2079ce675b18541f29e8..449d2c9b8f75359890568c31bb212691d25cdcff 100644
--- a/test/mjsunit/debug-script.js
+++ b/test/mjsunit/debug-script.js
@@ -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: test/mjsunit/es6/mirror-symbols.js
diff --git a/test/mjsunit/es6/mirror-symbols.js b/test/mjsunit/es6/mirror-symbols.js index 0f43491e858301f7d40e4b166d92b6f4c55ee8a1..f218332abf1f8151a03b94bdaca52e78f1918ce0 100644
--- a/test/mjsunit/es6/mirror-symbols.js
+++ b/test/mjsunit/es6/mirror-symbols.js
@@ -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: test/mjsunit/es6/regress/regress-crbug-346141.js
diff --git a/test/mjsunit/es6/regress/regress-crbug-346141.js b/test/mjsunit/es6/regress/regress-crbug-346141.js index 798b7704ec2cc0eb928966fdfe9f979d0fe51f94..2b9655e174459088401996b884c4a5d7e02eb919 100644
--- a/test/mjsunit/es6/regress/regress-crbug-346141.js
+++ b/test/mjsunit/es6/regress/regress-crbug-346141.js
@@ -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: test/mjsunit/es6/symbols.js
diff --git a/test/mjsunit/es6/symbols.js b/test/mjsunit/es6/symbols.js
index 7c211ca3f71e443448cd12fb37faa8eb5c9742e0..a57c9b2ec42d9b1ccd75c453244944ca78eee7f2 100644
--- a/test/mjsunit/es6/symbols.js
+++ b/test/mjsunit/es6/symbols.js
@@ -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: test/mjsunit/es7/object-observe.js
diff --git a/test/mjsunit/es7/object-observe.js b/test/mjsunit/es7/object-observe.js index 6b18ce74d025378761bc3696bb47184538a08d5d..0daa7423295b122005b3568f97e3ec3769272dec 100644
--- a/test/mjsunit/es7/object-observe.js
+++ b/test/mjsunit/es7/object-observe.js
@@ -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: test/mjsunit/harmony/iteration-semantics.js
diff --git a/test/mjsunit/harmony/iteration-semantics.js b/test/mjsunit/harmony/iteration-semantics.js index cc3cea809224096ec5b485726e88c0bb6b8302ca..de4719e46f29988987ecbcf3b3eada274edf7087 100644
--- a/test/mjsunit/harmony/iteration-semantics.js
+++ b/test/mjsunit/harmony/iteration-semantics.js
@@ -27,7 +27,6 @@

 // Flags: --harmony-iteration
 // Flags: --harmony-generators --harmony-scoping --harmony-proxies
-// Flags: --harmony-symbols

 // Test for-of semantics.

Index: test/mjsunit/harmony/private.js
diff --git a/test/mjsunit/harmony/private.js b/test/mjsunit/harmony/private.js index c4b0ed2b2bccc31737bc4f499955d9fd60434a8c..d3ed482c9c1fb7f2206975b98dad533f47e086cd 100644
--- a/test/mjsunit/harmony/private.js
+++ b/test/mjsunit/harmony/private.js
@@ -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: test/mjsunit/harmony/proxies-symbols.js
diff --git a/test/mjsunit/harmony/proxies-symbols.js b/test/mjsunit/harmony/proxies-symbols.js index 8920e39968de829876125b154992252630a5f545..52353c036d4a4c25b6b47b52df8f82dde0f3d1f3 100644
--- a/test/mjsunit/harmony/proxies-symbols.js
+++ b/test/mjsunit/harmony/proxies-symbols.js
@@ -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: test/mjsunit/harmony/set-prototype-of.js
diff --git a/test/mjsunit/harmony/set-prototype-of.js b/test/mjsunit/harmony/set-prototype-of.js index 02bd5e2ee62272b1acc22e31abffdf82e9fa5ebf..810220d1a8f217a773c3c31da10bea9ca3ef4d8e 100644
--- a/test/mjsunit/harmony/set-prototype-of.js
+++ b/test/mjsunit/harmony/set-prototype-of.js
@@ -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: test/mjsunit/proto-accessor.js
diff --git a/test/mjsunit/proto-accessor.js b/test/mjsunit/proto-accessor.js
index b2e7d34669049e1732244aea3d0d5be506e6d3c0..513a044023e9db5d74449f5f4d46fb02a74ff571 100644
--- a/test/mjsunit/proto-accessor.js
+++ b/test/mjsunit/proto-accessor.js
@@ -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: test/mjsunit/regress/regress-crbug-350864.js
diff --git a/test/mjsunit/regress/regress-crbug-350864.js b/test/mjsunit/regress/regress-crbug-350864.js index 8a793cb0a00612185ac5e6fe325725ca34e1f30c..510834be3e43071aef0e857c9d755be66d1b3c16 100644
--- a/test/mjsunit/regress/regress-crbug-350864.js
+++ b/test/mjsunit/regress/regress-crbug-350864.js
@@ -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: tools/gyp/v8.gyp
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index d7afa3be4005be300eff1c434d24f86c7177ad4d..f07cb2020a044000d1bf2b964f341cb3acd4e10e 100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -1325,11 +1325,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',


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to