We have a global value numbering (GVN) pass over the Hydrogen language. It eliminates Hydrogen values if there is an available value (already computed on all paths with no intervening side effects) that is "equal" to the given value.
The equality comparison for Hydrogen values checks that they have the same opcode and that all their input operands are equal. For hydrogen values that depend on other data (e.g., the name in a named property load or the operation in an inlined unary math op), there is a virtual HValue::DataEquals function that must be overridden. Global value numbering can be enabled for a hydrogen value by setting the flag kUseGVN (the default is normally not to use GVN). IMPORTANT: if you add an instruction and set kUseGVN, please make sure to override DataEquals if necessary. Also if you add an instruction, please be aware if any superclass has set kUseGVN. If you review code with new Hydrogen instructions, check that they're safe for GVN. Mads just fixed a handful of places where we were doing the wrong thing. -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
