Changeset 196243 in webkit


Ignore:
Timestamp:
Feb 7, 2016 3:16:20 PM (8 years ago)
Author:
sbarati@apple.com
Message:

Source/JavaScriptCore:
Follow up patch to: [ES6] bound functions .name property should be "bound " + the target function's name
https://bugs.webkit.org/show_bug.cgi?id=153796

Reviewed by Darin Adler.

This follow-up patch addresses some comments/suggestions by
Ryosuke, Darin, and Joe. It simplifies JSBoundFunction::toStringName
and adds some tests for bound names.

  • runtime/JSBoundFunction.cpp:

(JSC::hasInstanceBoundFunction):
(JSC::JSBoundFunction::create):
(JSC::JSBoundFunction::toStringName):

LayoutTests:
[ES6] bound functions .name property should be "bound " + the target function's name
https://bugs.webkit.org/show_bug.cgi?id=153796

Reviewed by Darin Adler.

  • js/bound-function-name-expected.txt: Added.
  • js/bound-function-name.html: Added.
  • js/script-tests/bound-function-name.js: Added.

(assert):
(assert.foo):
(bar):

Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196242 r196243  
     12016-02-07  Saam barati  <sbarati@apple.com>
     2
     3        [ES6] bound functions .name property should be "bound " + the target function's name
     4        https://bugs.webkit.org/show_bug.cgi?id=153796
     5
     6        Reviewed by Darin Adler.
     7
     8        * js/bound-function-name-expected.txt: Added.
     9        * js/bound-function-name.html: Added.
     10        * js/script-tests/bound-function-name.js: Added.
     11        (assert):
     12        (assert.foo):
     13        (bar):
     14
    1152016-02-07  Daniel Bates  <dabates@apple.com>
    216
  • trunk/Source/JavaScriptCore/ChangeLog

    r196240 r196243  
     12016-02-07  Saam barati  <sbarati@apple.com>
     2
     3        Follow up patch to: [ES6] bound functions .name property should be "bound " + the target function's name
     4        https://bugs.webkit.org/show_bug.cgi?id=153796
     5
     6        Reviewed by Darin Adler.
     7
     8        This follow-up patch addresses some comments/suggestions by
     9        Ryosuke, Darin, and Joe. It simplifies JSBoundFunction::toStringName
     10        and adds some tests for bound names.
     11
     12        * runtime/JSBoundFunction.cpp:
     13        (JSC::hasInstanceBoundFunction):
     14        (JSC::JSBoundFunction::create):
     15        (JSC::JSBoundFunction::toStringName):
     16
    1172016-02-07  Filip Pizlo  <fpizlo@apple.com>
    218
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp

    r196033 r196243  
    8888}
    8989
    90 static const char* const boundPrefix = "bound ";
    91 
    9290JSBoundFunction* JSBoundFunction::create(VM& vm, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name)
    9391{
     
    9896    JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(vm, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
    9997
    100     function->finishCreation(vm, executable, length, makeString(ASCIILiteral(boundPrefix), name));
     98    function->finishCreation(vm, executable, length, makeString("bound ", name));
    10199    return function;
    102100}
     
    137135String JSBoundFunction::toStringName(ExecState* exec)
    138136{
    139     String result = name(exec);
    140     ASSERT(result.find(ASCIILiteral(boundPrefix)) == 0);
    141     static const size_t boundPrefixLength = 6;
    142     return result.substring(boundPrefixLength);
     137    return m_targetFunction->get(exec, exec->vm().propertyNames->name).toWTFString(exec);
    143138}
    144139
Note: See TracChangeset for help on using the changeset viewer.