Expose Array.prototype.values behind a flag and stage it
BUG=v8:4247 LOG=y Review URL: https://codereview.chromium.org/1781573003 Cr-Commit-Position: refs/heads/master@{#34640}
This commit is contained in:
parent
29cd25be1d
commit
c48c1736c7
@ -2527,6 +2527,26 @@ void Genesis::InitializeGlobal_harmony_proxies() {
|
||||
InstallFunction(global, name, proxy_function, factory->Object_string());
|
||||
}
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_array_prototype_values() {
|
||||
if (!FLAG_harmony_array_prototype_values) return;
|
||||
Handle<JSFunction> array_constructor(native_context()->array_function());
|
||||
Handle<JSObject> array_prototype(
|
||||
JSObject::cast(array_constructor->instance_prototype()));
|
||||
Handle<Object> values_iterator =
|
||||
JSObject::GetProperty(array_prototype, factory()->iterator_symbol())
|
||||
.ToHandleChecked();
|
||||
DCHECK(values_iterator->IsJSFunction());
|
||||
JSObject::AddProperty(array_prototype, factory()->values_string(),
|
||||
values_iterator, DONT_ENUM);
|
||||
|
||||
Handle<Object> unscopables =
|
||||
JSObject::GetProperty(array_prototype, factory()->unscopables_symbol())
|
||||
.ToHandleChecked();
|
||||
DCHECK(unscopables->IsJSObject());
|
||||
JSObject::AddProperty(Handle<JSObject>::cast(unscopables),
|
||||
factory()->values_string(), factory()->true_value(),
|
||||
NONE);
|
||||
}
|
||||
|
||||
Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target,
|
||||
const char* name) {
|
||||
@ -2967,6 +2987,7 @@ bool Genesis::InstallExperimentalNatives() {
|
||||
static const char* harmony_object_values_entries_natives[] = {nullptr};
|
||||
static const char* harmony_object_own_property_descriptors_natives[] = {
|
||||
nullptr};
|
||||
static const char* harmony_array_prototype_values_natives[] = {nullptr};
|
||||
|
||||
for (int i = ExperimentalNatives::GetDebuggerCount();
|
||||
i < ExperimentalNatives::GetBuiltinsCount(); i++) {
|
||||
|
@ -218,6 +218,7 @@ DEFINE_IMPLICATION(es_staging, harmony_tailcalls)
|
||||
|
||||
// Features that are complete (but still behind --harmony/es-staging flag).
|
||||
#define HARMONY_STAGED(V) \
|
||||
V(harmony_array_prototype_values, "harmony Array.prototype.values") \
|
||||
V(harmony_regexp_lookbehind, "harmony regexp lookbehind") \
|
||||
V(harmony_instanceof, "harmony instanceof support") \
|
||||
V(harmony_object_values_entries, "harmony Object.values / Object.entries") \
|
||||
|
15
test/mjsunit/es6/array-prototype-values.js
Normal file
15
test/mjsunit/es6/array-prototype-values.js
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2016 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-array-prototype-values
|
||||
|
||||
// Functionality of the values iterator is tested elsewhere; this test
|
||||
// merely verifies that the 'values' property is set up correctly.
|
||||
var valuesDesc = Object.getOwnPropertyDescriptor(Array.prototype, 'values');
|
||||
assertEquals('object', typeof valuesDesc);
|
||||
assertSame(Array.prototype[Symbol.iterator], valuesDesc.value);
|
||||
assertTrue(valuesDesc.configurable);
|
||||
assertTrue(valuesDesc.writable);
|
||||
assertFalse(valuesDesc.enumerable);
|
||||
assertTrue(Array.prototype[Symbol.unscopables].values);
|
@ -59,18 +59,6 @@
|
||||
'language/computed-property-names/class/static/method-symbol': [FAIL, FAIL_SLOPPY],
|
||||
'language/computed-property-names/class/static/method-string': [FAIL, FAIL_SLOPPY],
|
||||
|
||||
# We do not expose Array.prototype.values
|
||||
# https://code.google.com/p/v8/issues/detail?id=4247
|
||||
'built-ins/Array/prototype/Symbol.iterator': [FAIL],
|
||||
'built-ins/Array/prototype/values/returns-iterator': [FAIL],
|
||||
'built-ins/Array/prototype/values/returns-iterator-from-object': [FAIL],
|
||||
'built-ins/Array/prototype/values/prop-desc': [FAIL],
|
||||
'built-ins/Array/prototype/values/name': [FAIL],
|
||||
'built-ins/Array/prototype/values/length': [FAIL],
|
||||
'built-ins/Array/prototype/values/iteration': [FAIL],
|
||||
'built-ins/Array/prototype/values/iteration-mutable': [FAIL],
|
||||
'built-ins/Array/prototype/Symbol.unscopables/value': [FAIL],
|
||||
|
||||
# https://code.google.com/p/v8/issues/detail?id=4248
|
||||
'language/expressions/compound-assignment/S11.13.2_A5.*': [FAIL],
|
||||
'language/expressions/compound-assignment/S11.13.2_A6.*': [FAIL],
|
||||
|
Loading…
Reference in New Issue
Block a user