Ignore:
Timestamp:
Jan 14, 2016, 12:45:48 PM (9 years ago)
Author:
[email protected]
Message:

[ES6] Support subclassing Function.
https://bugs.webkit.org/show_bug.cgi?id=153081

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

This patch enables subclassing the Function object. It also fixes an existing
bug that prevented users from subclassing functions that have a function in
the superclass's prototype property.

  • bytecompiler/NodesCodegen.cpp:

(JSC::ClassExprNode::emitBytecode):

  • runtime/FunctionConstructor.cpp:

(JSC::constructWithFunctionConstructor):
(JSC::constructFunction):
(JSC::constructFunctionSkippingEvalEnabledCheck):

  • runtime/FunctionConstructor.h:
  • runtime/JSFunction.cpp:

(JSC::JSFunction::create):

  • runtime/JSFunction.h:

(JSC::JSFunction::createImpl):

  • runtime/JSFunctionInlines.h:

(JSC::JSFunction::createWithInvalidatedReallocationWatchpoint):
(JSC::JSFunction::JSFunction): Deleted.

  • tests/stress/class-subclassing-function.js: Added.

LayoutTests:

Rebasline tests with the new clearer error message.

  • js/class-syntax-extends-expected.txt:
  • js/script-tests/class-syntax-extends.js:
File:
1 edited

Legend:

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

    r195000 r195070  
    6464JSFunction* JSFunction::create(VM& vm, FunctionExecutable* executable, JSScope* scope)
    6565{
    66     JSFunction* result = createImpl(vm, executable, scope);
     66    return create(vm, executable, scope, scope->globalObject()->functionStructure());
     67}
     68
     69JSFunction* JSFunction::create(VM& vm, FunctionExecutable* executable, JSScope* scope, Structure* structure)
     70{
     71    JSFunction* result = createImpl(vm, executable, scope, structure);
    6772    executable->singletonFunction()->notifyWrite(vm, result, "Allocating a function");
    6873    return result;
Note: See TracChangeset for help on using the changeset viewer.