Bug 68851

Summary: De-virtualize JSCell::getPrimitiveNumber
Product: WebKit Reporter: Mark Hahnenberg <mhahnenberg>
Component: JavaScriptCoreAssignee: Mark Hahnenberg <mhahnenberg>
Status: RESOLVED FIXED    
Severity: Normal CC: ggaren
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 67690    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
darin: review+
Benchmark results (without inlining)
none
Benchmark results (with inlining) none

Mark Hahnenberg
Reported 2011-09-26 16:51:29 PDT
Part of the larger process of de-virtualizing JSCell.
Attachments
Patch (10.77 KB, patch)
2011-09-26 17:27 PDT, Mark Hahnenberg
no flags
Patch (10.77 KB, patch)
2011-09-26 17:33 PDT, Mark Hahnenberg
no flags
Patch (10.78 KB, patch)
2011-09-26 18:04 PDT, Mark Hahnenberg
darin: review+
Benchmark results (without inlining) (6.32 KB, text/plain)
2011-09-27 10:47 PDT, Mark Hahnenberg
no flags
Benchmark results (with inlining) (6.40 KB, text/plain)
2011-09-27 12:36 PDT, Mark Hahnenberg
no flags
Mark Hahnenberg
Comment 1 2011-09-26 17:27:46 PDT
Mark Hahnenberg
Comment 2 2011-09-26 17:33:42 PDT
Mark Hahnenberg
Comment 3 2011-09-26 18:04:20 PDT
Darin Adler
Comment 4 2011-09-27 10:16:49 PDT
Comment on attachment 108770 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=108770&action=review > Source/JavaScriptCore/runtime/JSCell.cpp:135 > -bool JSCell::getPrimitiveNumber(ExecState*, double&, JSValue&) > +bool JSCell::getPrimitiveNumber(ExecState* exec, double& number, JSValue& value) const > { > - ASSERT_NOT_REACHED(); > - return false; > + if (isString()) > + return static_cast<const JSString*>(this)->getPrimitiveNumber(exec, number, value); > + return static_cast<const JSObject*>(this)->getPrimitiveNumber(exec, number, value); > } This turns a single virtual function call into two levels of non-virtual function call. Did you do speed testing? Does this function need to be inlined in JSString.h?
Mark Hahnenberg
Comment 5 2011-09-27 10:47:44 PDT
Created attachment 108866 [details] Benchmark results (without inlining)
Mark Hahnenberg
Comment 6 2011-09-27 12:36:09 PDT
Created attachment 108882 [details] Benchmark results (with inlining)
Mark Hahnenberg
Comment 7 2011-09-27 12:38:47 PDT
Overall, negligible difference between inlining and not inlining, so I think we should stick with JSCell::getPrimitiveNumber remaining in JSCell.cpp.
Mark Hahnenberg
Comment 8 2011-09-27 12:53:13 PDT
Note You need to log in before you can comment on or make changes to this bug.