Commit 5c8d0d18 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Include symbol properties in Object.{create,defineProperties}

R=mstarzinger@chromium.org
BUG=v8:3440
LOG=Y

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22370 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 71295754
......@@ -1171,13 +1171,21 @@ function ObjectDefineProperty(obj, p, attributes) {
}
function GetOwnEnumerablePropertyNames(properties) {
function GetOwnEnumerablePropertyNames(object) {
var names = new InternalArray();
for (var key in properties) {
if (%HasOwnProperty(properties, key)) {
for (var key in object) {
if (%HasOwnProperty(object, key)) {
names.push(key);
}
}
// FLAG_harmony_symbols may be on, but symbols aren't included by for-in.
var symbols = ObjectGetOwnPropertyKeys(object, true);
for (var i in symbols) {
var symbol = symbols[i];
if (ObjectGetOwnPropertyDescriptor(object, symbol).enumerable) {
names.push(symbol);
}
}
return names;
}
......
......@@ -367,6 +367,34 @@ for (var i in objs) {
}
function TestDefineProperties() {
var properties = {}
for (var i in symbols) {
Object.defineProperty(
properties, symbols[i], {value: {value: i}, enumerable: i % 2 === 0})
}
var o = Object.defineProperties({}, properties)
for (var i in symbols) {
assertEquals(i % 2 === 0, symbols[i] in o)
}
}
TestDefineProperties()
function TestCreate() {
var properties = {}
for (var i in symbols) {
Object.defineProperty(
properties, symbols[i], {value: {value: i}, enumerable: i % 2 === 0})
}
var o = Object.create(Object.prototype, properties)
for (var i in symbols) {
assertEquals(i % 2 === 0, symbols[i] in o)
}
}
TestCreate()
function TestCachedKeyAfterScavenge() {
gc();
// Keyed property lookup are cached. Hereby we assume that the keys are
......
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