Remove on-by-default flag --harmony-object
authoradamk <adamk@chromium.org>
Fri, 18 Sep 2015 18:37:44 +0000 (11:37 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 18 Sep 2015 18:37:57 +0000 (18:37 +0000)
It's been enabled since M45, which is now well into its stable period,
with no problems reported.

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

Cr-Commit-Position: refs/heads/master@{#30835}

BUILD.gn
src/bootstrapper.cc
src/flag-definitions.h
src/harmony-object.js [deleted file]
src/v8natives.js
test/js-perf-test/JSTests.json
test/mjsunit/es6/object-assign.js [new file with mode: 0644]
test/mjsunit/harmony/object-assign.js [deleted file]
test/simdjs/SimdJs.json
test/simdjs/generate.py
tools/gyp/v8.gyp

index c2ca0b91993d2a1bb5df27dfe36c6818206dc320..5cecc41b25ab9b627b8c69bdf5282a628a0cf0d1 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -321,7 +321,6 @@ action("js2c_experimental") {
     "src/harmony-regexp.js",
     "src/harmony-reflect.js",
     "src/harmony-spread.js",
-    "src/harmony-object.js",
     "src/harmony-object-observe.js",
     "src/harmony-sharedarraybuffer.js",
     "src/harmony-simd.js"
index 5bd2bc7b3583dda3171c5c910afaadd6bec402e2..386d8cafebcb430ebdab73ccc1113aa75808d35a 100644 (file)
@@ -1859,7 +1859,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spreadcalls)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring)
-EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spread_arrays)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_new_target)
@@ -2556,8 +2555,6 @@ bool Genesis::InstallExperimentalNatives() {
   static const char* harmony_spreadcalls_natives[] = {
       "native harmony-spread.js", nullptr};
   static const char* harmony_destructuring_natives[] = {nullptr};
-  static const char* harmony_object_natives[] = {"native harmony-object.js",
-                                                 NULL};
   static const char* harmony_object_observe_natives[] = {
       "native harmony-object-observe.js", nullptr};
   static const char* harmony_spread_arrays_natives[] = {nullptr};
index 63b573871f190bbcf43ffc4f083df1228818b6ca..bac581b49ecbf0bc233b6c7aca63c413f4d13d82 100644 (file)
@@ -216,8 +216,7 @@ DEFINE_BOOL(legacy_const, true, "legacy semantics for const in sloppy mode")
   V(harmony_new_target, "harmony new.target")                   \
   V(harmony_object_observe, "harmony Object.observe")           \
   V(harmony_spreadcalls, "harmony spread-calls")                \
-  V(harmony_spread_arrays, "harmony spread in array literals")  \
-  V(harmony_object, "harmony Object methods")
+  V(harmony_spread_arrays, "harmony spread in array literals")
 
 // Once a shipping feature has proved stable in the wild, it will be dropped
 // from HARMONY_SHIPPING, all occurrences of the FLAG_ variable are removed,
diff --git a/src/harmony-object.js b/src/harmony-object.js
deleted file mode 100644 (file)
index 12f2555..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-(function(global, utils) {
-
-"use strict";
-
-%CheckIsBootstrapping();
-
-// -------------------------------------------------------------------
-// Imports
-
-var GlobalObject = global.Object;
-var OwnPropertyKeys;
-
-utils.Import(function(from) {
-  OwnPropertyKeys = from.OwnPropertyKeys;
-});
-
-// -------------------------------------------------------------------
-
-// ES6, draft 04-03-15, section 19.1.2.1
-function ObjectAssign(target, sources) {
-  var to = TO_OBJECT(target);
-  var argsLen = %_ArgumentsLength();
-  if (argsLen < 2) return to;
-
-  for (var i = 1; i < argsLen; ++i) {
-    var nextSource = %_Arguments(i);
-    if (IS_NULL_OR_UNDEFINED(nextSource)) {
-      continue;
-    }
-
-    var from = TO_OBJECT(nextSource);
-    var keys = OwnPropertyKeys(from);
-    var len = keys.length;
-
-    for (var j = 0; j < len; ++j) {
-      var key = keys[j];
-      if (%IsPropertyEnumerable(from, key)) {
-        var propValue = from[key];
-        to[key] = propValue;
-      }
-    }
-  }
-  return to;
-}
-
-// Set up non-enumerable functions on the Object object.
-utils.InstallFunctions(GlobalObject, DONT_ENUM, [
-  "assign", ObjectAssign
-]);
-
-})
index f267ce1177ccc56ea6eadb19d5ff01bcd1280794..63cf0a0a37a3b2c27d1a0b159ae5a800759db7b3 100644 (file)
@@ -1262,6 +1262,36 @@ function ObjectIs(obj1, obj2) {
 }
 
 
+// ECMA-262, Edition 6, section 19.1.2.1
+function ObjectAssign(target, sources) {
+  // TODO(bmeurer): Move this to toplevel.
+  "use strict";
+  var to = TO_OBJECT(target);
+  var argsLen = %_ArgumentsLength();
+  if (argsLen < 2) return to;
+
+  for (var i = 1; i < argsLen; ++i) {
+    var nextSource = %_Arguments(i);
+    if (IS_NULL_OR_UNDEFINED(nextSource)) {
+      continue;
+    }
+
+    var from = TO_OBJECT(nextSource);
+    var keys = OwnPropertyKeys(from);
+    var len = keys.length;
+
+    for (var j = 0; j < len; ++j) {
+      var key = keys[j];
+      if (%IsPropertyEnumerable(from, key)) {
+        var propValue = from[key];
+        to[key] = propValue;
+      }
+    }
+  }
+  return to;
+}
+
+
 // ECMA-262, Edition 6, section B.2.2.1.1
 function ObjectGetProto() {
   return %_GetPrototype(TO_OBJECT(this));
@@ -1316,6 +1346,7 @@ utils.InstallGetterSetter(GlobalObject.prototype, "__proto__", ObjectGetProto,
 
 // Set up non-enumerable functions in the Object object.
 utils.InstallFunctions(GlobalObject, DONT_ENUM, [
+  "assign", ObjectAssign,
   "keys", ObjectKeys,
   "create", ObjectCreate,
   "defineProperty", ObjectDefineProperty,
@@ -1808,7 +1839,6 @@ utils.Export(function(to) {
   to.ObjectIsFrozen = ObjectIsFrozen;
   to.ObjectIsSealed = ObjectIsSealed;
   to.ObjectToString = ObjectToString;
-  to.OwnPropertyKeys = OwnPropertyKeys;
   to.ToNameArray = ToNameArray;
 });
 
index 7d750360cdd2953c6c08b91fad12ed9e7c8621df..4e238a90f9b1330bf54268cc5ba09ea94d2f6c43 100644 (file)
       "path": ["Object"],
       "main": "run.js",
       "resources": ["assign.js"],
-      "flags": ["--harmony-object"],
       "results_regexp": "^%s\\-Object\\(Score\\): (.+)$",
       "tests": [
         {"name": "Assign"}
diff --git a/test/mjsunit/es6/object-assign.js b/test/mjsunit/es6/object-assign.js
new file mode 100644 (file)
index 0000000..d56cb0d
--- /dev/null
@@ -0,0 +1,140 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Based on Mozilla Object.assign() tests
+
+function checkDataProperty(object, propertyKey, value, writable, enumerable, configurable) {
+  var desc = Object.getOwnPropertyDescriptor(object, propertyKey);
+  assertFalse(desc === undefined);
+  assertTrue('value' in desc);
+  assertEquals(desc.value, value);
+  assertEquals(desc.writable, writable);
+  assertEquals(desc.enumerable, enumerable);
+  assertEquals(desc.configurable, configurable);
+}
+
+// 19.1.2.1 Object.assign ( target, ...sources )
+assertEquals(Object.assign.length, 2);
+
+// Basic functionality works with multiple sources
+(function basicMultipleSources() {
+  var a = {};
+  var b = { bProp: 1 };
+  var c = { cProp: 2 };
+  Object.assign(a, b, c);
+  assertEquals(a, {
+    bProp: 1,
+    cProp: 2
+  });
+})();
+
+// Basic functionality works with symbols
+(function basicSymbols() {
+  var a = {};
+  var b = { bProp: 1 };
+  var aSymbol = Symbol("aSymbol");
+  b[aSymbol] = 2;
+  Object.assign(a, b);
+  assertEquals(1, a.bProp);
+  assertEquals(2, a[aSymbol]);
+})();
+
+// Dies if target is null or undefined
+assertThrows(function() { return Object.assign(null, null); }, TypeError);
+assertThrows(function() { return Object.assign(null, {}); }, TypeError);
+assertThrows(function() { return Object.assign(undefined); }, TypeError);
+assertThrows(function() { return Object.assign(); }, TypeError);
+
+// Calls ToObject for target
+assertTrue(Object.assign(true, {}) instanceof Boolean);
+assertTrue(Object.assign(1, {}) instanceof Number);
+assertTrue(Object.assign("string", {}) instanceof String);
+var o = {};
+assertSame(Object.assign(o, {}), o);
+
+// Only [[Enumerable]] properties are assigned to target
+(function onlyEnumerablePropertiesAssigned() {
+  var source = Object.defineProperties({}, {
+    a: {value: 1, enumerable: true},
+    b: {value: 2, enumerable: false},
+  });
+  var target = Object.assign({}, source);
+  assertTrue("a" in target);
+  assertFalse("b" in target);
+})();
+
+// Properties are retrieved through Get()
+// Properties are assigned through Put()
+(function testPropertiesAssignedThroughPut() {
+  var setterCalled = false;
+  Object.assign({set a(v) { setterCalled = v }}, {a: true});
+  assertTrue(setterCalled);
+})();
+
+// Properties are retrieved through Get()
+// Properties are assigned through Put(): Existing property attributes are not altered
+(function propertiesAssignedExistingNotAltered() {
+  var source = {a: 1, b: 2, c: 3};
+  var target = {a: 0, b: 0, c: 0};
+  Object.defineProperty(target, "a", {enumerable: false});
+  Object.defineProperty(target, "b", {configurable: false});
+  Object.defineProperty(target, "c", {enumerable: false, configurable: false});
+  Object.assign(target, source);
+  checkDataProperty(target, "a", 1, true, false, true);
+  checkDataProperty(target, "b", 2, true, true, false);
+  checkDataProperty(target, "c", 3, true, false, false);
+})();
+
+// Properties are retrieved through Get()
+// Properties are assigned through Put(): Throws TypeError if non-writable
+(function propertiesAssignedTypeErrorNonWritable() {
+  var source = {a: 1};
+  var target = {a: 0};
+  Object.defineProperty(target, "a", {writable: false});
+  assertThrows(function() { return Object.assign(target, source); }, TypeError);
+  checkDataProperty(target, "a", 0, false, true, true);
+})();
+
+// Properties are retrieved through Get()
+// Put() creates standard properties; Property attributes from source are
+// ignored
+(function createsStandardProperties() {
+  var source = {a: 1, b: 2, c: 3, get d() { return 4 }};
+  Object.defineProperty(source, "b", {writable: false});
+  Object.defineProperty(source, "c", {configurable: false});
+  var target = Object.assign({}, source);
+  checkDataProperty(target, "a", 1, true, true, true);
+  checkDataProperty(target, "b", 2, true, true, true);
+  checkDataProperty(target, "c", 3, true, true, true);
+  checkDataProperty(target, "d", 4, true, true, true);
+})();
+
+// Properties created during traversal are not copied
+(function propertiesCreatedDuringTraversalNotCopied() {
+  var source = {get a() { this.b = 2 }};
+  var target = Object.assign({}, source);
+  assertTrue("a" in target);
+  assertFalse("b" in target);
+})();
+
+// String and Symbol valued properties are copied
+(function testStringAndSymbolPropertiesCopied() {
+  var keyA = "str-prop";
+  var source = {"str-prop": 1};
+  var target = Object.assign({}, source);
+  checkDataProperty(target, keyA, 1, true, true, true);
+})();
+
+(function testExceptionsStopFirstException() {
+  var ErrorA = function ErrorA() {};
+  var ErrorB = function ErrorB() {};
+  var log = "";
+  var source = { b: 1, a: 1 };
+  var target = {
+      set a(v) { log += "a"; throw new ErrorA },
+      set b(v) { log += "b"; throw new ErrorB },
+  };
+  assertThrows(function() { return Object.assign(target, source); }, ErrorB);
+  assertEquals(log, "b");
+})();
diff --git a/test/mjsunit/harmony/object-assign.js b/test/mjsunit/harmony/object-assign.js
deleted file mode 100644 (file)
index 448ce9a..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-object
-
-// Based on Mozilla Object.assign() tests
-
-function checkDataProperty(object, propertyKey, value, writable, enumerable, configurable) {
-  var desc = Object.getOwnPropertyDescriptor(object, propertyKey);
-  assertFalse(desc === undefined);
-  assertTrue('value' in desc);
-  assertEquals(desc.value, value);
-  assertEquals(desc.writable, writable);
-  assertEquals(desc.enumerable, enumerable);
-  assertEquals(desc.configurable, configurable);
-}
-
-// 19.1.2.1 Object.assign ( target, ...sources )
-assertEquals(Object.assign.length, 2);
-
-// Basic functionality works with multiple sources
-(function basicMultipleSources() {
-  var a = {};
-  var b = { bProp: 1 };
-  var c = { cProp: 2 };
-  Object.assign(a, b, c);
-  assertEquals(a, {
-    bProp: 1,
-    cProp: 2
-  });
-})();
-
-// Basic functionality works with symbols
-(function basicSymbols() {
-  var a = {};
-  var b = { bProp: 1 };
-  var aSymbol = Symbol("aSymbol");
-  b[aSymbol] = 2;
-  Object.assign(a, b);
-  assertEquals(1, a.bProp);
-  assertEquals(2, a[aSymbol]);
-})();
-
-// Dies if target is null or undefined
-assertThrows(function() { return Object.assign(null, null); }, TypeError);
-assertThrows(function() { return Object.assign(null, {}); }, TypeError);
-assertThrows(function() { return Object.assign(undefined); }, TypeError);
-assertThrows(function() { return Object.assign(); }, TypeError);
-
-// Calls ToObject for target
-assertTrue(Object.assign(true, {}) instanceof Boolean);
-assertTrue(Object.assign(1, {}) instanceof Number);
-assertTrue(Object.assign("string", {}) instanceof String);
-var o = {};
-assertSame(Object.assign(o, {}), o);
-
-// Only [[Enumerable]] properties are assigned to target
-(function onlyEnumerablePropertiesAssigned() {
-  var source = Object.defineProperties({}, {
-    a: {value: 1, enumerable: true},
-    b: {value: 2, enumerable: false},
-  });
-  var target = Object.assign({}, source);
-  assertTrue("a" in target);
-  assertFalse("b" in target);
-})();
-
-// Properties are retrieved through Get()
-// Properties are assigned through Put()
-(function testPropertiesAssignedThroughPut() {
-  var setterCalled = false;
-  Object.assign({set a(v) { setterCalled = v }}, {a: true});
-  assertTrue(setterCalled);
-})();
-
-// Properties are retrieved through Get()
-// Properties are assigned through Put(): Existing property attributes are not altered
-(function propertiesAssignedExistingNotAltered() {
-  var source = {a: 1, b: 2, c: 3};
-  var target = {a: 0, b: 0, c: 0};
-  Object.defineProperty(target, "a", {enumerable: false});
-  Object.defineProperty(target, "b", {configurable: false});
-  Object.defineProperty(target, "c", {enumerable: false, configurable: false});
-  Object.assign(target, source);
-  checkDataProperty(target, "a", 1, true, false, true);
-  checkDataProperty(target, "b", 2, true, true, false);
-  checkDataProperty(target, "c", 3, true, false, false);
-})();
-
-// Properties are retrieved through Get()
-// Properties are assigned through Put(): Throws TypeError if non-writable
-(function propertiesAssignedTypeErrorNonWritable() {
-  var source = {a: 1};
-  var target = {a: 0};
-  Object.defineProperty(target, "a", {writable: false});
-  assertThrows(function() { return Object.assign(target, source); }, TypeError);
-  checkDataProperty(target, "a", 0, false, true, true);
-})();
-
-// Properties are retrieved through Get()
-// Put() creates standard properties; Property attributes from source are
-// ignored
-(function createsStandardProperties() {
-  var source = {a: 1, b: 2, c: 3, get d() { return 4 }};
-  Object.defineProperty(source, "b", {writable: false});
-  Object.defineProperty(source, "c", {configurable: false});
-  var target = Object.assign({}, source);
-  checkDataProperty(target, "a", 1, true, true, true);
-  checkDataProperty(target, "b", 2, true, true, true);
-  checkDataProperty(target, "c", 3, true, true, true);
-  checkDataProperty(target, "d", 4, true, true, true);
-})();
-
-// Properties created during traversal are not copied
-(function propertiesCreatedDuringTraversalNotCopied() {
-  var source = {get a() { this.b = 2 }};
-  var target = Object.assign({}, source);
-  assertTrue("a" in target);
-  assertFalse("b" in target);
-})();
-
-// String and Symbol valued properties are copied
-(function testStringAndSymbolPropertiesCopied() {
-  var keyA = "str-prop";
-  var source = {"str-prop": 1};
-  var target = Object.assign({}, source);
-  checkDataProperty(target, keyA, 1, true, true, true);
-})();
-
-(function testExceptionsStopFirstException() {
-  var ErrorA = function ErrorA() {};
-  var ErrorB = function ErrorB() {};
-  var log = "";
-  var source = { b: 1, a: 1 };
-  var target = {
-      set a(v) { log += "a"; throw new ErrorA },
-      set b(v) { log += "b"; throw new ErrorB },
-  };
-  assertThrows(function() { return Object.assign(target, source); }, ErrorB);
-  assertEquals(log, "b");
-})();
index 878ef383465dc50f82ccdb79126d548a1462614e..e0683226d4c8ce7ec329aff686239c0b33358a41 100644 (file)
@@ -1,6 +1,5 @@
 {
   "flags": [
-    "--harmony-object",
     "--harmony-simd",
     "test/simdjs/harness-adapt.js"
   ],
index 49a3f639674a2ec981c03522f1da998bb50675c9..2ddd6d82ab38d2359540e2173b5b95d2476c069c 100755 (executable)
@@ -40,7 +40,7 @@ output = {
     'test/simdjs/harness-adapt.js',
     'test/simdjs/harness-finish.js'
   ] + ['test/simdjs/data/src/benchmarks/%s.js' % t for t in tests],
-  'flags': ['--harmony-object', 'test/simdjs/harness-adapt.js'],
+  'flags': ['test/simdjs/harness-adapt.js'],
   'path': ['../../'],
   'tests': [
     {
index 98e8e46807aa20a32347728a7dd0ec0b2b99672c..c8abd433a4a83a03f454c87d3fea1c0cfea5ab3a 100644 (file)
           '../../src/harmony-regexp.js',
           '../../src/harmony-reflect.js',
           '../../src/harmony-spread.js',
-          '../../src/harmony-object.js',
           '../../src/harmony-object-observe.js',
           '../../src/harmony-sharedarraybuffer.js',
           '../../src/harmony-simd.js',