[JAEGER] Implement Travis Fisher's xor-based loadValueAsComponents(). b=586240, r=dvander.
authorSean Stangl <sstangl@mozilla.com>
Sat, 14 Aug 2010 18:07:00 -0700
changeset 53427 89b775191b9d0beeece8ea895cd803a557ec6c86
parent 53426 6502af9885d5dcfcf2389ef68aad724facbc553c
child 53428 141dd8d48b1d10aa12d4c5547994c8b11a7a93eb
push idunknown
push userunknown
push dateunknown
reviewersdvander
bugs586240
milestone2.0b4pre
[JAEGER] Implement Travis Fisher's xor-based loadValueAsComponents(). b=586240, r=dvander. Thanks to Travis Fisher <traviswfisher@gmail.com>.
js/src/methodjit/PunboxAssembler.h
--- a/js/src/methodjit/PunboxAssembler.h
+++ b/js/src/methodjit/PunboxAssembler.h
@@ -117,29 +117,22 @@ class Assembler : public BaseAssembler
     }
 
     void convertValueToPayload(RegisterID val) {
         andPtr(Imm64(JSVAL_PAYLOAD_MASK), val);
     }
 
     /* Returns a label after the one Value load. */
     Label loadValueAsComponents(Address address, RegisterID type, RegisterID payload) {
-        /*
-         * Loading into the ValueRegister is better than loading directly into type:
-         * with this code, there are no interdependencies between type and payload,
-         * allowing the instructions to be better pipelined. This is X64-specific.
-         */
-        loadValue(address, Registers::ValueReg);
+        loadValue(address, type);
         Label l = label();
-        
+
         move(Imm64(JSVAL_PAYLOAD_MASK), payload);
-        move(Imm64(JSVAL_TAG_MASK), type);
-
-        andPtr(Registers::ValueReg, payload);
-        andPtr(Registers::ValueReg, type);
+        andPtr(type, payload);
+        xorPtr(payload, type);
 
         return l;
     }
 
     void loadTypeTag(Address address, RegisterID reg) {
         loadValue(address, reg);
         convertValueToType(reg);
     }
@@ -164,17 +157,16 @@ class Assembler : public BaseAssembler
     }
 
     void storeTypeTag(RegisterID reg, Address address) {
         /* The type tag must be stored in shifted format. */
         loadValue(address, Registers::ValueReg);
         convertValueToPayload(Registers::ValueReg);
         orPtr(reg, Registers::ValueReg);
         storePtr(Registers::ValueReg, valueOf(address));
-
     }
 
     void storeTypeTag(RegisterID reg, BaseIndex address) {
         /* The type tag must be stored in shifted format. */
         loadValue(address, Registers::ValueReg);
         convertValueToPayload(Registers::ValueReg);
         orPtr(reg, Registers::ValueReg);
         storePtr(Registers::ValueReg, valueOf(address));