Changeset 166760 in webkit
- Timestamp:
- Apr 3, 2014 7:29:15 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r166759 r166760 1 2014-04-03 Andreas Kling <akling@apple.com> 2 3 Fast-path for casting JS wrappers to JSNode. 4 <https://webkit.org/b/131196> 5 6 Allow code outside of JSC (well, WebCore) to extend the JSType spectrum 7 a little bit. We do this by exposing a LastJSCObjectType constant so 8 WebCore can encode its own wrapper types after that. 9 10 Reviewed by Mark Hahnenberg and Geoff Garen. 11 12 * runtime/JSType.h: 13 14 Added LastJSCObjectType for use by WebCore. 15 16 * runtime/JSObject.h: 17 (JSC::JSObject::isVariableObject): 18 19 Updated since this can no longer assume that types >= VariableObjectType 20 are all variable objects. 21 1 22 2014-04-03 Mark Hahnenberg <mhahnenberg@apple.com> 2 23 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r166397 r166760 1123 1123 inline bool JSObject::isVariableObject() const 1124 1124 { 1125 return type() >= VariableObjectType; 1126 } 1127 1125 return type() == GlobalObjectType || type() == ActivationObjectType; 1126 } 1128 1127 1129 1128 inline bool JSObject::isStaticScopeObject() const -
trunk/Source/JavaScriptCore/runtime/JSType.h
r164764 r166760 70 70 71 71 NameScopeObjectType, 72 // VariableObjectType must be less than MOST of the types of its subclasses and only its subclasses. 73 // We use >=VariableObjectType checks to test for Global & Activation objects, but exclude NameScopes. 74 VariableObjectType, 72 75 73 GlobalObjectType, 76 74 ActivationObjectType, 75 76 LastJSCObjectType = ActivationObjectType, 77 77 }; 78 78 -
trunk/Source/WebCore/ChangeLog
r166752 r166760 1 2014-04-03 Andreas Kling <akling@apple.com> 2 3 Fast-path for casting JS wrappers to JSNode. 4 <https://webkit.org/b/131196> 5 6 Add a way to quickly determine that a given JSObject is a JSNode. 7 This lets us avoid walking the ClassInfo chain in the DOM bindings 8 for WebCore::Node. 9 10 Reviewed by Mark Hahnenberg and Geoff Garen. 11 12 * bindings/js/JSDOMWrapper.h: 13 14 Added a JSNodeType constant that extends beyond JSC::JSType. 15 16 * bindings/js/JSNodeCustom.h: 17 (WebCore::jsNodeCast): 18 19 Added. Fast cast from JSValue to JSNode. 20 21 * bindings/scripts/CodeGeneratorJS.pm: 22 (GenerateHeader): 23 (GenerateImplementation): 24 25 Generate code that uses jsNodeCast in Node interfaces. 26 1 27 2014-04-03 Bem Jones-Bey <bjonesbe@adobe.com> 2 28 -
trunk/Source/WebCore/bindings/js/JSDOMWrapper.h
r148696 r166760 30 30 class ScriptExecutionContext; 31 31 32 static const uint8_t JSNodeType = JSC::LastJSCObjectType + 1; 33 32 34 class JSDOMWrapper : public JSC::JSDestructibleObject { 33 35 public: -
trunk/Source/WebCore/bindings/js/JSNodeCustom.h
r165914 r166760 79 79 } 80 80 81 ALWAYS_INLINE JSNode* jsNodeCast(JSC::JSValue value) 82 { 83 if (UNLIKELY(!value.isCell())) 84 return nullptr; 85 return value.asCell()->type() == JSNodeType ? JSC::jsCast<JSNode*>(value) : nullptr; 86 } 87 81 88 } // namespace WebCore 82 89 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r166493 r166760 960 960 if (IsDOMGlobalObject($interface)) { 961 961 push(@headerContent, " return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), info());\n"); 962 } elsif ($codeGenerator->InheritsInterface($interface, "Node")) { 963 push(@headerContent, " return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::JSType(JSNodeType), StructureFlags), info());\n"); 962 964 } else { 963 965 push(@headerContent, " return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());\n"); … … 2131 2133 push(@implContent, " UNUSED_PARAM(slotBase);\n"); 2132 2134 } else { 2133 push(@implContent, " ${className}* castedThis = jsDynamicCast<$className*>(JSValue::decode(thisValue));\n"); 2135 if ($interfaceName eq "Node") { 2136 push(@implContent, " JSNode* castedThis = jsNodeCast(JSValue::decode(thisValue));\n"); 2137 } else { 2138 push(@implContent, " ${className}* castedThis = jsDynamicCast<$className*>(JSValue::decode(thisValue));\n"); 2139 } 2134 2140 push(@implContent, " UNUSED_PARAM(slotBase);\n"); 2135 2141 }
Note: See TracChangeset
for help on using the changeset viewer.