Ignore:
Timestamp:
Feb 4, 2021, 2:42:19 AM (5 years ago)
Author:
[email protected]
Message:

[JSC] Implement Object.entries in C++
https://bugs.webkit.org/show_bug.cgi?id=221380

Reviewed by Alexey Shvayka.

This patch implements Object.entries in C++ because it is more efficient.
It is not using dynamic feature (like, calling a callback). And in C++,
we can avoid JSArray allocations for @Object.@getOwnPropertyNames.

This patch also removes unnecessary JS private functions, @propertyIsEnumerable,
and @getOwnPropertyNames.

  • builtins/BuiltinNames.h:
  • builtins/ObjectConstructor.js:

(entries): Deleted.

  • bytecode/LinkTimeConstant.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/JSGlobalObjectFunctions.cpp:
  • runtime/JSGlobalObjectFunctions.h:
  • runtime/ObjectConstructor.cpp:

(JSC::ObjectConstructor::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r272187 r272364  
    816816}
    817817
    818 JSC_DEFINE_HOST_FUNCTION(globalFuncPropertyIsEnumerable, (JSGlobalObject* globalObject, CallFrame* callFrame))
    819 {
    820     VM& vm = globalObject->vm();
    821     auto scope = DECLARE_THROW_SCOPE(vm);
    822 
    823     RELEASE_ASSERT(callFrame->argumentCount() == 2);
    824     JSObject* object = jsCast<JSObject*>(callFrame->uncheckedArgument(0));
    825     auto propertyName = callFrame->uncheckedArgument(1).toPropertyKey(globalObject);
    826     RETURN_IF_EXCEPTION(scope, encodedJSValue());
    827 
    828     scope.release();
    829     PropertyDescriptor descriptor;
    830     bool enumerable = object->getOwnPropertyDescriptor(globalObject, propertyName, descriptor) && descriptor.enumerable();
    831     return JSValue::encode(jsBoolean(enumerable));
    832 }
    833 
    834818static bool canPerformFastPropertyEnumerationForCopyDataProperties(Structure* structure)
    835819{
Note: See TracChangeset for help on using the changeset viewer.