[Baseline] Store constant directly in emit_op_mov
[WebKit-https.git] / Source / JavaScriptCore / jit / JITOpcodes.cpp
index 38621d886e70c4158ecd7a8eaa9f6dc1105cb829..459d1a2db5a1dc1ad0c1b12203ee71fda2bca276 100644 (file)
@@ -57,8 +57,17 @@ void JIT::emit_op_mov(Instruction* currentInstruction)
     int dst = currentInstruction[1].u.operand;
     int src = currentInstruction[2].u.operand;
 
-    emitGetVirtualRegister(src, regT0);
-    emitPutVirtualRegister(dst);
+    if (m_codeBlock->isConstantRegisterIndex(src)) {
+        JSValue value = m_codeBlock->getConstant(src);
+        if (!value.isNumber())
+            store64(TrustedImm64(JSValue::encode(value)), addressFor(dst));
+        else
+            store64(Imm64(JSValue::encode(value)), addressFor(dst));
+        return;
+    }
+
+    load64(addressFor(src), regT0);
+    store64(regT0, addressFor(dst));
 }