Changeset 204358 in webkit


Ignore:
Timestamp:
Aug 10, 2016 3:32:48 PM (8 years ago)
Author:
gskachkov@gmail.com
Message:

[ES2016] Implement Object.values
https://bugs.webkit.org/show_bug.cgi?id=160410

Reviewed by Saam Baraty, Yusuke Suzuki.

This patch adds values function to Object that return list of
own values of the object. Patch did according to the point of
spec http://tc39.github.io/ecma262/#sec-object.values

Also patch adds generic builtin intrinsic constants:
@IterationKindKey/@IterationKindValue/@IterationKindKeyValue
that is used in EnumerableOwnProperties to set Kind of operation
and replace own IterationKind enums in following iterators:
ArrayIterator, MapIterator, and SetIterator

Source/JavaScriptCore:

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • builtins/ObjectConstructor.js:

(globalPrivate.enumerableOwnProperties):
(values):

  • bytecode/BytecodeIntrinsicRegistry.cpp:

(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):

  • bytecode/BytecodeIntrinsicRegistry.h:
  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::getInternalProperties):

  • runtime/ArrayIteratorPrototype.h:
  • runtime/IterationKind.h: Copied from Source/JavaScriptCore/builtins/ObjectConstructor.js.
  • runtime/JSMapIterator.h:

(JSC::JSMapIterator::create):
(JSC::JSMapIterator::next):
(JSC::JSMapIterator::kind):
(JSC::JSMapIterator::JSMapIterator):

  • runtime/JSSetIterator.h:

(JSC::JSSetIterator::create):
(JSC::JSSetIterator::next):
(JSC::JSSetIterator::kind):
(JSC::JSSetIterator::JSSetIterator):

  • runtime/MapPrototype.cpp:

(JSC::mapProtoFuncValues):
(JSC::mapProtoFuncEntries):
(JSC::mapProtoFuncKeys):
(JSC::privateFuncMapIterator):

  • runtime/ObjectConstructor.cpp:
  • runtime/SetPrototype.cpp:

(JSC::setProtoFuncValues):
(JSC::setProtoFuncEntries):
(JSC::privateFuncSetIterator):

Source/WebCore:

  • ForwardingHeaders/runtime/IterationKind.h: Added.
  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneSerializer::serialize):

JSTests:

  • stress/object-values.js: Added.

(compare):
(string_appeared_here.forEach):
(const.getInvokedFunctions.):
(const.getInvokedFunctions):
(Array.prototype.push):

LayoutTests:

  • js/Object-getOwnPropertyNames-expected.txt:
  • js/script-tests/Object-getOwnPropertyNames.js:
Location:
trunk
Files:
2 added
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r204321 r204358  
     12016-08-09  Skachkov Oleksandr  <gskachkov@gmail.com>
     2
     3        [ES2016] Implement Object.values
     4        https://bugs.webkit.org/show_bug.cgi?id=160410
     5
     6        Reviewed by Saam Barati, Yusuke Suzuki.
     7
     8        * stress/object-values.js: Added.
     9        (compare):
     10        (string_appeared_here.forEach):
     11        (const.getInvokedFunctions.):
     12        (const.getInvokedFunctions):
     13        (Array.prototype.push):
     14
    1152016-08-09  Saam Barati  <sbarati@apple.com>
    216
  • trunk/LayoutTests/ChangeLog

    r204353 r204358  
     12016-08-09  Skachkov Oleksandr  <gskachkov@gmail.com>
     2
     3        [ES2016] Implement Object.values
     4        https://bugs.webkit.org/show_bug.cgi?id=160410
     5
     6        Reviewed by Saam Barati, Yusuke Suzuki.
     7
     8        * js/Object-getOwnPropertyNames-expected.txt:
     9        * js/script-tests/Object-getOwnPropertyNames.js:
     10
    1112016-08-10  Saam Barati  <sbarati@apple.com>
    212
  • trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt

    r202125 r204358  
    4242PASS getSortedOwnPropertyNames(encodeURI) is ['length', 'name']
    4343PASS getSortedOwnPropertyNames(encodeURIComponent) is ['length', 'name']
    44 PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyDescriptors', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']
     44PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyDescriptors', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf', 'values']
    4545PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']
    4646PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype']
  • trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js

    r202125 r204358  
    5151    "encodeURIComponent": "['length', 'name']",
    5252// Built-in ECMA objects
    53     "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyDescriptors', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']",
     53    "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyDescriptors', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf', 'values']",
    5454    "Object.prototype": "['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']",
    5555    "Function": "['length', 'name', 'prototype']",
  • trunk/Source/JavaScriptCore/ChangeLog

    r204355 r204358  
     12016-08-09  Skachkov Oleksandr  <gskachkov@gmail.com>
     2
     3        [ES2016] Implement Object.values
     4        https://bugs.webkit.org/show_bug.cgi?id=160410
     5
     6        Reviewed by Saam Barati, Yusuke Suzuki.
     7
     8        This patch adds values function to Object that return list of
     9        own values of the object. Patch did according to the point of
     10        spec http://tc39.github.io/ecma262/#sec-object.values
     11       
     12        Also patch adds generic builtin intrinsic constants:
     13        @IterationKindKey/@IterationKindValue/@IterationKindKeyValue
     14        that is used in  EnumerableOwnProperties to set Kind of operation 
     15        and replace own IterationKind enums in following iterators:
     16        ArrayIterator, MapIterator, and SetIterator
     17
     18        * JavaScriptCore.xcodeproj/project.pbxproj:
     19        * builtins/ObjectConstructor.js:
     20        (globalPrivate.enumerableOwnProperties):
     21        (values):
     22        * bytecode/BytecodeIntrinsicRegistry.cpp:
     23        (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
     24        * bytecode/BytecodeIntrinsicRegistry.h:
     25        * inspector/JSInjectedScriptHost.cpp:
     26        (Inspector::JSInjectedScriptHost::getInternalProperties):
     27        * runtime/ArrayIteratorPrototype.h:
     28        * runtime/IterationKind.h: Copied from Source/JavaScriptCore/builtins/ObjectConstructor.js.
     29        * runtime/JSMapIterator.h:
     30        (JSC::JSMapIterator::create):
     31        (JSC::JSMapIterator::next):
     32        (JSC::JSMapIterator::kind):
     33        (JSC::JSMapIterator::JSMapIterator):
     34        * runtime/JSSetIterator.h:
     35        (JSC::JSSetIterator::create):
     36        (JSC::JSSetIterator::next):
     37        (JSC::JSSetIterator::kind):
     38        (JSC::JSSetIterator::JSSetIterator):
     39        * runtime/MapPrototype.cpp:
     40        (JSC::mapProtoFuncValues):
     41        (JSC::mapProtoFuncEntries):
     42        (JSC::mapProtoFuncKeys):
     43        (JSC::privateFuncMapIterator):
     44        * runtime/ObjectConstructor.cpp:
     45        * runtime/SetPrototype.cpp:
     46        (JSC::setProtoFuncValues):
     47        (JSC::setProtoFuncEntries):
     48        (JSC::privateFuncSetIterator):
     49
    1502016-08-10  Benjamin Poulain  <bpoulain@apple.com>
    251
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r204330 r204358  
    14121412                86FA9E91142BBB2E001773B7 /* JSBoundFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86FA9E8F142BBB2D001773B7 /* JSBoundFunction.cpp */; };
    14131413                86FA9E92142BBB2E001773B7 /* JSBoundFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 86FA9E90142BBB2E001773B7 /* JSBoundFunction.h */; };
     1414                8B9F6D561D5912FA001C739F /* IterationKind.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B9F6D551D5912FA001C739F /* IterationKind.h */; settings = {ATTRIBUTES = (Private, ); }; };
    14141415                90213E3D123A40C200D422F3 /* MemoryStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */; };
    14151416                90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 90213E3C123A40C200D422F3 /* MemoryStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    36473648                86FA9E8F142BBB2D001773B7 /* JSBoundFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBoundFunction.cpp; sourceTree = "<group>"; };
    36483649                86FA9E90142BBB2E001773B7 /* JSBoundFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBoundFunction.h; sourceTree = "<group>"; };
     3650                8B9F6D551D5912FA001C739F /* IterationKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IterationKind.h; sourceTree = "<group>"; };
    36493651                90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryStatistics.cpp; sourceTree = "<group>"; };
    36503652                90213E3C123A40C200D422F3 /* MemoryStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryStatistics.h; sourceTree = "<group>"; };
     
    57675769                                708EBE231CE8F35000453146 /* IntlObjectInlines.h */,
    57685770                                86BF642A148DB2B5004DE36A /* Intrinsic.h */,
     5771                                8B9F6D551D5912FA001C739F /* IterationKind.h */,
    57695772                                FE4D55B71AE716CA0052E459 /* IterationStatus.h */,
    57705773                                70113D491A8DB093003848C4 /* IteratorOperations.cpp */,
     
    73467349                                0F2FC77316E12F740038D976 /* DFGDCEPhase.h in Headers */,
    73477350                                0F8F2B9A172F0501007DBDA5 /* DFGDesiredIdentifiers.h in Headers */,
     7351                                8B9F6D561D5912FA001C739F /* IterationKind.h in Headers */,
    73487352                                0FFC92141B94E83E0071DD66 /* DFGDesiredInferredType.h in Headers */,
    73497353                                C2C0F7CE17BBFC5B00464FE4 /* DFGDesiredTransitions.h in Headers */,
  • trunk/Source/JavaScriptCore/builtins/ObjectConstructor.js

    r198192 r204358  
    11/*
     2 * Copyright (C) 2016 Oleksandr Skachkov <gskachkov@gmail.com>.
    23 * Copyright (C) 2015 Jordan Harband. All rights reserved.
    34 *
     
    2425 */
    2526
     27@globalPrivate
     28function enumerableOwnProperties(object, kind)
     29{
     30    "use strict";
     31
     32    const obj = @Object(object);
     33    const ownKeys = @Reflect.@ownKeys(obj);
     34    const properties = [];
     35    for (let i = 0, keysLength = ownKeys.length; i < keysLength; ++i) {
     36        let nextKey = ownKeys[i];
     37        if (typeof nextKey === 'string') {
     38            let descriptor = @Reflect.@getOwnPropertyDescriptor(obj, nextKey);
     39            if (descriptor !== @undefined && descriptor.enumerable) {
     40                if (kind === @iterationKindValue)
     41                    properties.@push(obj[nextKey]);
     42            // FIXME: Implement 'key+value' and 'key' cases
     43            }
     44        }
     45    }
     46   
     47    return properties;
     48}
     49
     50function values(object)
     51{
     52    "use strict";
     53   
     54    if (object == null)
     55        throw new @TypeError("Object.values requires that input parameter not be null or undefined");
     56
     57    return @enumerableOwnProperties(object, @iterationKindValue);
     58}
     59
    2660function assign(target/*[*/, /*...*/sources/*] */)
    2761{
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp

    r204330 r204358  
    5151    m_undefined.set(m_vm, jsUndefined());
    5252    m_Infinity.set(m_vm, jsDoubleNumber(std::numeric_limits<double>::infinity()));
    53     m_arrayIterationKindKey.set(m_vm, jsNumber(ArrayIterateKey));
    54     m_arrayIterationKindValue.set(m_vm, jsNumber(ArrayIterateValue));
    55     m_arrayIterationKindKeyValue.set(m_vm, jsNumber(ArrayIterateKeyValue));
     53    m_iterationKindKey.set(m_vm, jsNumber(IterateKey));
     54    m_iterationKindValue.set(m_vm, jsNumber(IterateValue));
     55    m_iterationKindKeyValue.set(m_vm, jsNumber(IterateKeyValue));
    5656    m_MAX_STRING_LENGTH.set(m_vm, jsNumber(JSString::MaxLength));
    5757    m_MAX_SAFE_INTEGER.set(m_vm, jsDoubleNumber(maxSafeInteger()));
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h

    r202680 r204358  
    5454    macro(undefined) \
    5555    macro(Infinity) \
    56     macro(arrayIterationKindKey) \
    57     macro(arrayIterationKindValue) \
    58     macro(arrayIterationKindKeyValue) \
     56    macro(iterationKindKey) \
     57    macro(iterationKindValue) \
     58    macro(iterationKindKeyValue) \
    5959    macro(MAX_STRING_LENGTH) \
    6060    macro(MAX_SAFE_INTEGER) \
  • trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp

    r202890 r204358  
    321321        String kind;
    322322        switch (mapIterator->kind()) {
    323         case MapIterateKey:
     323        case IterateKey:
    324324            kind = ASCIILiteral("key");
    325325            break;
    326         case MapIterateValue:
     326        case IterateValue:
    327327            kind = ASCIILiteral("value");
    328328            break;
    329         case MapIterateKeyValue:
     329        case IterateKeyValue:
    330330            kind = ASCIILiteral("key+value");
    331331            break;
     
    343343        String kind;
    344344        switch (setIterator->kind()) {
    345         case SetIterateKey:
     345        case IterateKey:
    346346            kind = ASCIILiteral("key");
    347347            break;
    348         case SetIterateValue:
     348        case IterateValue:
    349349            kind = ASCIILiteral("value");
    350350            break;
    351         case SetIterateKeyValue:
     351        case IterateKeyValue:
    352352            kind = ASCIILiteral("key+value");
    353353            break;
  • trunk/Source/JavaScriptCore/runtime/ArrayIteratorPrototype.h

    r202280 r204358  
    2727#define ArrayIteratorPrototype_h
    2828
     29#include "IterationKind.h"
    2930#include "JSObject.h"
    3031
    3132namespace JSC {
    32 
    33 enum ArrayIterationKind : uint32_t {
    34     ArrayIterateKey,
    35     ArrayIterateValue,
    36     ArrayIterateKeyValue
    37 };
    3833
    3934class ArrayIteratorPrototype : public JSNonFinalObject {
  • trunk/Source/JavaScriptCore/runtime/IterationKind.h

    r204357 r204358  
    11/*
    2  * Copyright (C) 2015 Jordan Harband. All rights reserved.
     2 *  Copyright (C) 2016 Oleksandr Skachkov (gskachkov@gmail.com)
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 function assign(target/*[*/, /*...*/sources/*] */)
    27 {
    28     "use strict";
     26#pragma once
    2927
    30     if (target == null)
    31         throw new @TypeError("can't convert " + target + " to object");
     28namespace JSC {
     29   
     30enum IterationKind : uint32_t {
     31    IterateKey,
     32    IterateValue,
     33    IterateKeyValue,
     34};
    3235
    33     let objTarget = @Object(target);
    34     for (let s = 1, argumentsLength = arguments.length; s < argumentsLength; ++s) {
    35         let nextSource = arguments[s];
    36         if (nextSource != null) {
    37             let from = @Object(nextSource);
    38             let keys = @Reflect.@ownKeys(from);
    39             for (let i = 0, keysLength = keys.length; i < keysLength; ++i) {
    40                 let nextKey = keys[i];
    41                 let descriptor = @Reflect.@getOwnPropertyDescriptor(from, nextKey);
    42                 if (descriptor !== @undefined && descriptor.enumerable)
    43                     objTarget[nextKey] = from[nextKey];
    44             }
    45         }
    46     }
    47     return objTarget;
    48 }
     36   
     37} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSMapIterator.h

    r196108 r204358  
    2727#define JSMapIterator_h
    2828
     29#include "IterationKind.h"
    2930#include "JSMap.h"
    3031#include "JSObject.h"
     
    3233
    3334namespace JSC {
    34 enum MapIterationKind : uint32_t {
    35     MapIterateKey,
    36     MapIterateValue,
    37     MapIterateKeyValue,
    38 };
    3935
    4036class JSMapIterator : public JSNonFinalObject {
     
    4945    }
    5046
    51     static JSMapIterator* create(VM& vm, Structure* structure, JSMap* iteratedObject, MapIterationKind kind)
     47    static JSMapIterator* create(VM& vm, Structure* structure, JSMap* iteratedObject, IterationKind kind)
    5248    {
    5349        JSMapIterator* instance = new (NotNull, allocateCell<JSMapIterator>(vm.heap)) JSMapIterator(vm, structure, iteratedObject, kind);
     
    6258            return false;
    6359
    64         if (m_kind == MapIterateValue)
     60        if (m_kind == IterateValue)
    6561            value = pair.value;
    66         else if (m_kind == MapIterateKey)
     62        else if (m_kind == IterateKey)
    6763            value = pair.key;
    6864        else
     
    8783    }
    8884
    89     MapIterationKind kind() const { return m_kind; }
     85    IterationKind kind() const { return m_kind; }
    9086    JSValue iteratedValue() const { return m_map.get(); }
    9187    JSMapIterator* clone(ExecState*);
     
    9793
    9894private:
    99     JSMapIterator(VM& vm, Structure* structure, JSMap* iteratedObject, MapIterationKind kind)
     95    JSMapIterator(VM& vm, Structure* structure, JSMap* iteratedObject, IterationKind kind)
    10096        : Base(vm, structure)
    10197        , m_iterator(iteratedObject->m_mapData.createIteratorData(this))
     
    110106    WriteBarrier<JSMap> m_map;
    111107    JSMap::MapData::IteratorData m_iterator;
    112     MapIterationKind m_kind;
     108    IterationKind m_kind;
    113109};
    114110STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSMapIterator);
  • trunk/Source/JavaScriptCore/runtime/JSSetIterator.h

    r196108 r204358  
    2727#define JSSetIterator_h
    2828
     29#include "IterationKind.h"
    2930#include "JSObject.h"
    3031#include "JSSet.h"
     
    3334
    3435namespace JSC {
    35 enum SetIterationKind : uint32_t {
    36     SetIterateKey,
    37     SetIterateValue,
    38     SetIterateKeyValue,
    39 };
    4036
    4137class JSSetIterator : public JSNonFinalObject {
     
    5046    }
    5147
    52     static JSSetIterator* create(VM& vm, Structure* structure, JSSet* iteratedObject, SetIterationKind kind)
     48    static JSSetIterator* create(VM& vm, Structure* structure, JSSet* iteratedObject, IterationKind kind)
    5349    {
    5450        JSSetIterator* instance = new (NotNull, allocateCell<JSSetIterator>(vm.heap)) JSSetIterator(vm, structure, iteratedObject, kind);
     
    6258        if (!m_iterator.next(pair))
    6359            return false;
    64         if (m_kind == SetIterateValue || m_kind == SetIterateKey)
     60        if (m_kind == IterateValue || m_kind == IterateKey)
    6561            value = pair.key;
    6662        else
     
    7470    }
    7571
    76     SetIterationKind kind() const { return m_kind; }
     72    IterationKind kind() const { return m_kind; }
    7773    JSValue iteratedValue() const { return m_set.get(); }
    7874    JSSetIterator* clone(ExecState*);
     
    8480
    8581private:
    86     JSSetIterator(VM& vm, Structure* structure, JSSet* iteratedObject, SetIterationKind kind)
     82    JSSetIterator(VM& vm, Structure* structure, JSSet* iteratedObject, IterationKind kind)
    8783        : Base(vm, structure)
    8884        , m_iterator(iteratedObject->m_setData.createIteratorData(this))
     
    9793    WriteBarrier<JSSet> m_set;
    9894    JSSet::SetData::IteratorData m_iterator;
    99     SetIterationKind m_kind;
     95    IterationKind m_kind;
    10096};
    10197STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSSetIterator);
  • trunk/Source/JavaScriptCore/runtime/MapPrototype.cpp

    r202844 r204358  
    159159    if (!thisObj)
    160160        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Map value iterator for a non-Map object.")));
    161     return JSValue::encode(JSMapIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->mapIteratorStructure(), thisObj, MapIterateValue));
     161    return JSValue::encode(JSMapIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->mapIteratorStructure(), thisObj, IterateValue));
    162162}
    163163
     
    167167    if (!thisObj)
    168168        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Map entry iterator for a non-Map object.")));
    169     return JSValue::encode(JSMapIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->mapIteratorStructure(), thisObj, MapIterateKeyValue));
     169    return JSValue::encode(JSMapIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->mapIteratorStructure(), thisObj, IterateKeyValue));
    170170}
    171171
     
    175175    if (!thisObj)
    176176        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Map key iterator for a non-Map object.")));
    177     return JSValue::encode(JSMapIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->mapIteratorStructure(), thisObj, MapIterateKey));
     177    return JSValue::encode(JSMapIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->mapIteratorStructure(), thisObj, IterateKey));
    178178}
    179179
     
    187187    ASSERT(jsDynamicCast<JSMap*>(exec->uncheckedArgument(0)));
    188188    JSMap* map = jsCast<JSMap*>(exec->uncheckedArgument(0));
    189     return JSValue::encode(JSMapIterator::create(exec->vm(), exec->callee()->globalObject()->mapIteratorStructure(), map, MapIterateKeyValue));
     189    return JSValue::encode(JSMapIterator::create(exec->vm(), exec->callee()->globalObject()->mapIteratorStructure(), map, IterateKeyValue));
    190190}
    191191
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp

    r203747 r204358  
    8585  is                        objectConstructorIs                         DontEnum|Function 2
    8686  assign                    JSBuiltin                                   DontEnum|Function 2
     87  values                    JSBuiltin                                   DontEnum|Function 1
    8788@end
    8889*/
  • trunk/Source/JavaScriptCore/runtime/SetPrototype.cpp

    r202844 r204358  
    145145    if (!thisObj)
    146146        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Set value iterator for a non-Set object.")));
    147     return JSValue::encode(JSSetIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, SetIterateValue));
     147    return JSValue::encode(JSSetIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, IterateValue));
    148148}
    149149
     
    153153    if (!thisObj)
    154154        return JSValue::encode(throwTypeError(callFrame, ASCIILiteral("Cannot create a Set entry iterator for a non-Set object.")));
    155     return JSValue::encode(JSSetIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, SetIterateKeyValue));
     155    return JSValue::encode(JSSetIterator::create(callFrame->vm(), callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, IterateKeyValue));
    156156}
    157157
     
    165165    ASSERT(jsDynamicCast<JSSet*>(exec->uncheckedArgument(0)));
    166166    JSSet* set = jsCast<JSSet*>(exec->uncheckedArgument(0));
    167     return JSValue::encode(JSSetIterator::create(exec->vm(), exec->callee()->globalObject()->setIteratorStructure(), set, SetIterateKey));
     167    return JSValue::encode(JSSetIterator::create(exec->vm(), exec->callee()->globalObject()->setIteratorStructure(), set, IterateKey));
    168168}
    169169
  • trunk/Source/WebCore/ChangeLog

    r204357 r204358  
     12016-08-09  Skachkov Oleksandr  <gskachkov@gmail.com>
     2
     3        [ES2016] Implement Object.values
     4        https://bugs.webkit.org/show_bug.cgi?id=160410
     5
     6        Reviewed by Saam Barati, Yusuke Suzuki.
     7
     8        No new tests because all tests are implemented in JavaScriptCore
     9        and there is no behavior change.
     10
     11        * ForwardingHeaders/runtime/IterationKind.h: Added.
     12        * bindings/js/SerializedScriptValue.cpp:
     13        (WebCore::CloneSerializer::serialize):
     14
    1152016-08-10  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp

    r202890 r204358  
    6161#include <runtime/Exception.h>
    6262#include <runtime/ExceptionHelpers.h>
     63#include <runtime/IterationKind.h>
    6364#include <runtime/JSArrayBuffer.h>
    6465#include <runtime/JSArrayBufferView.h>
     
    13551356                if (!startMap(inMap))
    13561357                    break;
    1357                 JSMapIterator* iterator = JSMapIterator::create(m_exec->vm(), m_exec->lexicalGlobalObject()->mapIteratorStructure(), inMap, MapIterateKeyValue);
     1358                JSMapIterator* iterator = JSMapIterator::create(m_exec->vm(), m_exec->lexicalGlobalObject()->mapIteratorStructure(), inMap, IterateKeyValue);
    13581359                m_gcBuffer.append(inMap);
    13591360                m_gcBuffer.append(iterator);
     
    13991400                if (!startSet(inSet))
    14001401                    break;
    1401                 JSSetIterator* iterator = JSSetIterator::create(m_exec->vm(), m_exec->lexicalGlobalObject()->setIteratorStructure(), inSet, SetIterateKey);
     1402                JSSetIterator* iterator = JSSetIterator::create(m_exec->vm(), m_exec->lexicalGlobalObject()->setIteratorStructure(), inSet, IterateKey);
    14021403                m_gcBuffer.append(inSet);
    14031404                m_gcBuffer.append(iterator);
Note: See TracChangeset for help on using the changeset viewer.