Bug 68328

Summary: The generator and intrinsic fields in HashTableValue/HashEntry and associated structures and methods are redundant
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, gustavo, sam, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Fix ggaren: review+, webkit-ews: commit-queue-

Filip Pizlo
Reported 2011-09-18 15:40:50 PDT
The old JIT optimizes intrinsics with ThunkGenerators, which are functions that when called generate JIT code that implements the intrinsic. The DFG JIT optimizes intrinsics by weaving them through the optimizing compiler, and only exposes an enum (DFG::Intrinsic) for declaring whether or not an ExecutableBase is intrinsic, and if so, which intrinsic it is. These two mechanism require some redundancy in runtime/Lookup.h, and various scripts for creating JS bindings. A good solution would be to have one enum (say, in jit/JITIntrinsic.h). The DFG would simply switch to using this intrinsic, while the old JIT would abandon passing function pointers and simply select the thunk generator by switching on the intrinsic enum.
Attachments
Fix (34.56 KB, patch)
2011-12-06 00:02 PST, Gavin Barraclough
ggaren: review+
webkit-ews: commit-queue-
Sam Weinig
Comment 1 2011-09-18 16:16:59 PDT
If you are going to make this change, it might also be a good opportunity to remove the special casing from the generation script and put it in the lookup definitions.
Gavin Barraclough
Comment 2 2011-09-19 13:23:18 PDT
It may even be that we don't want the enum to be in either JIT - we may with to make use of the intrinsic from the interpreter, in environments where we don't have the JIT enabled. Maybe an enum in JSFunction?
Filip Pizlo
Comment 3 2011-09-19 13:24:31 PDT
(In reply to comment #2) > It may even be that we don't want the enum to be in either JIT - we may with to make use of the intrinsic from the interpreter, in environments where we don't have the JIT enabled. Maybe an enum in JSFunction? How about runtime/Intrinsic.h? The benefit of a separate file is that: 1) JSFunction and pretty much everything else in runtime/ is cluttered. 2) If we do our jobs correctly then this enum will get big. ;-)
Gavin Barraclough
Comment 4 2011-09-21 15:52:47 PDT
Agreed, that sounds even better.
Gavin Barraclough
Comment 5 2011-12-06 00:02:03 PST
Geoffrey Garen
Comment 6 2011-12-06 00:14:04 PST
Comment on attachment 117999 [details] Fix r=me
Early Warning System Bot
Comment 7 2011-12-06 00:20:26 PST
Gyuyoung Kim
Comment 8 2011-12-06 00:29:04 PST
Gustavo Noronha (kov)
Comment 9 2011-12-06 00:42:21 PST
Sam Weinig
Comment 10 2011-12-06 07:31:26 PST
Comment on attachment 117999 [details] Fix View in context: https://bugs.webkit.org/attachment.cgi?id=117999&action=review > Source/JavaScriptCore/create_hash_table:276 > if ($key eq "charCodeAt") { > $thunkGenerator = "charCodeAtThunkGenerator"; > - $intrinsic = "DFG::CharCodeAtIntrinsic"; > + $intrinsic = "CharCodeAtIntrinsic"; Do we really need this specialized check? Can't we just write CharCodeAtIntrinsic at the definition site? > Source/JavaScriptCore/create_hash_table:323 > $thunkGenerator = "logThunkGenerator"; > + $intrinsic = "LogIntrinsic"; Is $thunkGenerator still being used?
Gavin Barraclough
Comment 11 2011-12-06 11:51:30 PST
(In reply to comment #10) > (From update of attachment 117999 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=117999&action=review > > > Source/JavaScriptCore/create_hash_table:276 > > if ($key eq "charCodeAt") { > > $thunkGenerator = "charCodeAtThunkGenerator"; > > - $intrinsic = "DFG::CharCodeAtIntrinsic"; > > + $intrinsic = "CharCodeAtIntrinsic"; > > Do we really need this specialized check? Can't we just write CharCodeAtIntrinsic at the definition site? I definitely agree with you that we should do this, but I don't think it's a part of this change. This patch changes the data in the table output by the create_hash_table script, you're proposing changing the data in the tables parsed in by create_hash_table, these two changes are completely independent of each other. > > Source/JavaScriptCore/create_hash_table:323 > > $thunkGenerator = "logThunkGenerator"; > > + $intrinsic = "LogIntrinsic"; > > Is $thunkGenerator still being used? Ooops - meant to remove them - thanks! - will do.
Gavin Barraclough
Comment 12 2011-12-06 12:47:17 PST
Fixed in r102167
Note You need to log in before you can comment on or make changes to this bug.