"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"
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)
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};
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,
+++ /dev/null
-// 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
-]);
-
-})
}
+// 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));
// Set up non-enumerable functions in the Object object.
utils.InstallFunctions(GlobalObject, DONT_ENUM, [
+ "assign", ObjectAssign,
"keys", ObjectKeys,
"create", ObjectCreate,
"defineProperty", ObjectDefineProperty,
to.ObjectIsFrozen = ObjectIsFrozen;
to.ObjectIsSealed = ObjectIsSealed;
to.ObjectToString = ObjectToString;
- to.OwnPropertyKeys = OwnPropertyKeys;
to.ToNameArray = ToNameArray;
});
"path": ["Object"],
"main": "run.js",
"resources": ["assign.js"],
- "flags": ["--harmony-object"],
"results_regexp": "^%s\\-Object\\(Score\\): (.+)$",
"tests": [
{"name": "Assign"}
--- /dev/null
+// 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");
+})();
+++ /dev/null
-// 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");
-})();
{
"flags": [
- "--harmony-object",
"--harmony-simd",
"test/simdjs/harness-adapt.js"
],
'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': [
{
'../../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',