Bug 61544

Summary: Overload resolution in generated JSC bindings could be more efficient.
Product: WebKit Reporter: Andreas Kling <kling>
Component: WebCore JavaScriptAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Proposed patch none

Andreas Kling
Reported 2011-05-26 11:00:04 PDT
The overload resolution code generated by CodeGeneratorJS.pm currently looks like this: EncodedJSValue JSC_HOST_CALL jsWebGLRenderingContextPrototypeFunctionBufferSubData(ExecState* exec) { if ((exec->argumentCount() == 3 && (exec->argument(2).isNull() || (exec->argument(2).isObject() && asObject(exec->argument(2))->inherits(&JSArrayBuffer::s_info))))) return jsWebGLRenderingContextPrototypeFunctionBufferSubData1(exec); if ((exec->argumentCount() == 3 && (exec->argument(2).isNull() || (exec->argument(2).isObject() && asObject(exec->argument(2))->inherits(&JSArrayBufferView::s_info))))) return jsWebGLRenderingContextPrototypeFunctionBufferSubData2(exec); return throwVMTypeError(exec); } This could be a lot more efficient (no need for all those calls to argumentCount() and argument().)
Attachments
Proposed patch (7.10 KB, patch)
2011-05-26 11:04 PDT, Andreas Kling
no flags
Andreas Kling
Comment 1 2011-05-26 11:04:22 PDT
Created attachment 95006 [details] Proposed patch
Andreas Kling
Comment 2 2011-05-26 11:05:29 PDT
For reference, same function after this patch: EncodedJSValue JSC_HOST_CALL jsWebGLRenderingContextPrototypeFunctionBufferSubData(ExecState* exec) { size_t argsCount = exec->argumentCount(); JSValue arg2(exec->argument(2)); if ((argsCount == 3 && (arg2.isNull() || (arg2.isObject() && asObject(arg2)->inherits(&JSArrayBuffer::s_info))))) return jsWebGLRenderingContextPrototypeFunctionBufferSubData1(exec); if ((argsCount == 3 && (arg2.isNull() || (arg2.isObject() && asObject(arg2)->inherits(&JSArrayBufferView::s_info))))) return jsWebGLRenderingContextPrototypeFunctionBufferSubData2(exec); return throwVMTypeError(exec); }
Geoffrey Garen
Comment 3 2011-05-26 11:08:48 PDT
Comment on attachment 95006 [details] Proposed patch r=me
Andreas Kling
Comment 4 2011-05-26 12:25:13 PDT
Comment on attachment 95006 [details] Proposed patch Clearing flags on attachment: 95006 Committed r87412: <http://trac.webkit.org/changeset/87412>
Andreas Kling
Comment 5 2011-05-26 12:25:21 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.