2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
authorcwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jun 2008 09:33:26 +0000 (09:33 +0000)
committercwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jun 2008 09:33:26 +0000 (09:33 +0000)
        Reviewed by Oliver.

        Reduce code duplication in emitReadModifyAssignment().

        * kjs/nodes.cpp:
        (KJS::emitReadModifyAssignment):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34620 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/nodes.cpp

index d669e2b..3790de2 100644 (file)
@@ -2,6 +2,15 @@
 
         Reviewed by Oliver.
 
+        Reduce code duplication in emitReadModifyAssignment().
+
+        * kjs/nodes.cpp:
+        (KJS::emitReadModifyAssignment):
+
+2008-06-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Oliver.
+
         Sort includes alphabetically.
 
         * kjs/nodes.cpp:
index 6066c16..02536b7 100644 (file)
@@ -814,34 +814,47 @@ RegisterID* ConditionalNode::emitCode(CodeGenerator& generator, RegisterID* dst)
 // FIXME: should this be moved to be a method on CodeGenerator?
 static ALWAYS_INLINE RegisterID* emitReadModifyAssignment(CodeGenerator& generator, RegisterID* dst, RegisterID* src1, RegisterID* src2, Operator oper)
 {
+    OpcodeID opcode;
     switch (oper) {
         case OpMultEq:
-            return generator.emitBinaryOp(op_mul, dst, src1, src2);
+            opcode = op_mul;
+            break;
         case OpDivEq:
-            return generator.emitBinaryOp(op_div, dst, src1, src2);
+            opcode = op_div;
+            break;
         case OpPlusEq:
-            return generator.emitBinaryOp(op_add, dst, src1, src2);
+            opcode = op_add;
+            break;
         case OpMinusEq:
-            return generator.emitBinaryOp(op_sub, dst, src1, src2);
+            opcode = op_sub;
+            break;
         case OpLShift:
-            return generator.emitBinaryOp(op_lshift, dst, src1, src2);
+            opcode = op_lshift;
+            break;
         case OpRShift:
-            return generator.emitBinaryOp(op_rshift, dst, src1, src2);
+            opcode = op_rshift;
+            break;
         case OpURShift:
-            return generator.emitBinaryOp(op_urshift, dst, src1, src2);
+            opcode = op_urshift;
+            break;
         case OpAndEq:
-            return generator.emitBinaryOp(op_bitand, dst, src1, src2);
+            opcode = op_bitand;
+            break;
         case OpXOrEq:
-            return generator.emitBinaryOp(op_bitxor, dst, src1, src2);
+            opcode = op_bitxor;
+            break;
         case OpOrEq:
-            return generator.emitBinaryOp(op_bitor, dst, src1, src2);
+            opcode = op_bitor;
+            break;
         case OpModEq:
-            return generator.emitBinaryOp(op_mod, dst, src1, src2);
+            opcode = op_mod;
+            break;
         default:
             ASSERT_NOT_REACHED();
+            return dst;
     }
-
-    return dst;
+    
+    return generator.emitBinaryOp(opcode, dst, src1, src2);
 }
 
 RegisterID* ReadModifyResolveNode::emitCode(CodeGenerator& generator, RegisterID* dst)