Fast-path for casting JS wrappers to JSNode.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Apr 2014 02:29:15 +0000 (02:29 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Apr 2014 02:29:15 +0000 (02:29 +0000)
commit89fc244de2b93d1e696957ebd741c38aa0487817
treea83a02407970e67d6cb8d9411f18b51eeddef681
parent6ba634fcf2fe6dd698c5c1eb5c3edf3c3307cc75
Fast-path for casting JS wrappers to JSNode.
<https://webkit.org/b/131196>

Source/JavaScriptCore:

Allow code outside of JSC (well, WebCore) to extend the JSType spectrum
a little bit. We do this by exposing a LastJSCObjectType constant so
WebCore can encode its own wrapper types after that.

Reviewed by Mark Hahnenberg and Geoff Garen.

* runtime/JSType.h:

    Added LastJSCObjectType for use by WebCore.

* runtime/JSObject.h:
(JSC::JSObject::isVariableObject):

    Updated since this can no longer assume that types >= VariableObjectType
    are all variable objects.

Source/WebCore:

Add a way to quickly determine that a given JSObject is a JSNode.
This lets us avoid walking the ClassInfo chain in the DOM bindings
for WebCore::Node.

Reviewed by Mark Hahnenberg and Geoff Garen.

* bindings/js/JSDOMWrapper.h:

    Added a JSNodeType constant that extends beyond JSC::JSType.

* bindings/js/JSNodeCustom.h:
(WebCore::jsNodeCast):

    Added. Fast cast from JSValue to JSNode.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):

    Generate code that uses jsNodeCast in Node interfaces.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSObject.h
Source/JavaScriptCore/runtime/JSType.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMWrapper.h
Source/WebCore/bindings/js/JSNodeCustom.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm