Ignore:
Timestamp:
Jun 15, 2017, 12:37:21 PM (8 years ago)
Author:
Yusuke Suzuki
Message:

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

Reviewed by Saam Barati.

JSTests:

  • stress/object-assign-string-first.js: Added.

(shouldBe):
(source.get Symbol):
(source.get 1):
(source.get cocoa):

Source/JavaScriptCore:

Implementing Object.assign in JS is not so good compared to C++ version because,

  1. JS version allocates JS array for object own keys. And we allocate JSString / Symbol for each key.

But basically, they can be handled as UniquedStringImpl in C++. Allocating these cells are wasteful.

  1. While implementing builtins in JS offers some good type speculation chances, Object.assign is inherently super polymorphic.

So JS's type profile doesn't help well.

  1. We have a chance to introduce various fast path for Object.assign in C++.

This patch moves implementation from JS to C++. It achieves the above (1) and (2). (3) is filed in [1].

We can see 1.65x improvement in SixSpeed object-assign.es6.

baseline patched

object-assign.es6 643.3253+-8.0521 389.1075+-8.8840 definitely 1.6533x faster

[1]: https://bugs.webkit.org/show_bug.cgi?id=173416

  • builtins/ObjectConstructor.js:

(entries):
(assign): Deleted.

  • runtime/JSCJSValueInlines.h:

(JSC::JSValue::putInline):

  • runtime/JSCell.h:
  • runtime/JSCellInlines.h:

(JSC::JSCell::putInline):

  • runtime/JSObject.cpp:

(JSC::JSObject::put):

  • runtime/JSObject.h:
  • runtime/JSObjectInlines.h:

(JSC::JSObject::putInlineForJSObject):
(JSC::JSObject::putInline): Deleted.

  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorAssign):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h

    r216309 r218348  
    195195
    196196// ECMA 8.6.2.2
    197 ALWAYS_INLINE bool JSObject::putInline(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
     197ALWAYS_INLINE bool JSObject::putInlineForJSObject(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
    198198{
    199199    VM& vm = exec->vm();
Note: See TracChangeset for help on using the changeset viewer.