Title: [232048] trunk/Source/_javascript_Core
Revision
232048
Author
[email protected]
Date
2018-05-21 22:46:27 -0700 (Mon, 21 May 2018)

Log Message

[JSC] Remove duplicate methods in JSInterfaceJIT
https://bugs.webkit.org/show_bug.cgi?id=185813

Reviewed by Saam Barati.

Some methods of JSInterfaceJIT are duplicate with AssemblyHelpers' ones.
This patch removes these ones and use AssemblyHelpers' ones instead.

This patch also a bit cleans up ThunkGenerators' unnecessary ifdefs.

* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::tagFor):
(JSC::AssemblyHelpers::payloadFor):
* jit/JIT.h:
* jit/JITArithmetic.cpp:
(JSC::JIT::emit_op_unsigned):
(JSC::JIT::emit_compareUnsigned):
(JSC::JIT::emit_op_inc):
(JSC::JIT::emit_op_dec):
(JSC::JIT::emit_op_mod):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileOpCall):
* jit/JITInlines.h:
(JSC::JIT::emitPutIntToCallFrameHeader):
(JSC::JIT::updateTopCallFrame):
(JSC::JIT::emitInitRegister):
(JSC::JIT::emitLoad):
(JSC::JIT::emitStore):
(JSC::JIT::emitStoreInt32):
(JSC::JIT::emitStoreCell):
(JSC::JIT::emitStoreBool):
(JSC::JIT::emitGetVirtualRegister):
(JSC::JIT::emitPutVirtualRegister):
(JSC::JIT::emitTagBool): Deleted.
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_overrides_has_instance):
(JSC::JIT::emit_op_is_empty):
(JSC::JIT::emit_op_is_undefined):
(JSC::JIT::emit_op_is_boolean):
(JSC::JIT::emit_op_is_number):
(JSC::JIT::emit_op_is_cell_with_type):
(JSC::JIT::emit_op_is_object):
(JSC::JIT::emit_op_eq):
(JSC::JIT::emit_op_neq):
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::emit_op_eq_null):
(JSC::JIT::emit_op_neq_null):
(JSC::JIT::emitSlow_op_eq):
(JSC::JIT::emitSlow_op_neq):
(JSC::JIT::emitSlow_op_instanceof_custom):
(JSC::JIT::emitNewFuncExprCommon):
* jit/JSInterfaceJIT.h:
(JSC::JSInterfaceJIT::emitLoadInt32):
(JSC::JSInterfaceJIT::emitLoadDouble):
(JSC::JSInterfaceJIT::emitPutToCallFrameHeader):
(JSC::JSInterfaceJIT::emitPutCellToCallFrameHeader):
(JSC::JSInterfaceJIT::tagFor): Deleted.
(JSC::JSInterfaceJIT::payloadFor): Deleted.
(JSC::JSInterfaceJIT::intPayloadFor): Deleted.
(JSC::JSInterfaceJIT::intTagFor): Deleted.
(JSC::JSInterfaceJIT::emitTagInt): Deleted.
(JSC::JSInterfaceJIT::addressFor): Deleted.
* jit/SpecializedThunkJIT.h:
(JSC::SpecializedThunkJIT::returnDouble):
* jit/ThunkGenerators.cpp:
(JSC::nativeForGenerator):
(JSC::arityFixupGenerator):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (232047 => 232048)


--- trunk/Source/_javascript_Core/ChangeLog	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-05-22 05:46:27 UTC (rev 232048)
@@ -1,5 +1,75 @@
 2018-05-21  Yusuke Suzuki  <[email protected]>
 
+        [JSC] Remove duplicate methods in JSInterfaceJIT
+        https://bugs.webkit.org/show_bug.cgi?id=185813
+
+        Reviewed by Saam Barati.
+
+        Some methods of JSInterfaceJIT are duplicate with AssemblyHelpers' ones.
+        This patch removes these ones and use AssemblyHelpers' ones instead.
+
+        This patch also a bit cleans up ThunkGenerators' unnecessary ifdefs.
+
+        * jit/AssemblyHelpers.h:
+        (JSC::AssemblyHelpers::tagFor):
+        (JSC::AssemblyHelpers::payloadFor):
+        * jit/JIT.h:
+        * jit/JITArithmetic.cpp:
+        (JSC::JIT::emit_op_unsigned):
+        (JSC::JIT::emit_compareUnsigned):
+        (JSC::JIT::emit_op_inc):
+        (JSC::JIT::emit_op_dec):
+        (JSC::JIT::emit_op_mod):
+        * jit/JITCall32_64.cpp:
+        (JSC::JIT::compileOpCall):
+        * jit/JITInlines.h:
+        (JSC::JIT::emitPutIntToCallFrameHeader):
+        (JSC::JIT::updateTopCallFrame):
+        (JSC::JIT::emitInitRegister):
+        (JSC::JIT::emitLoad):
+        (JSC::JIT::emitStore):
+        (JSC::JIT::emitStoreInt32):
+        (JSC::JIT::emitStoreCell):
+        (JSC::JIT::emitStoreBool):
+        (JSC::JIT::emitGetVirtualRegister):
+        (JSC::JIT::emitPutVirtualRegister):
+        (JSC::JIT::emitTagBool): Deleted.
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_overrides_has_instance):
+        (JSC::JIT::emit_op_is_empty):
+        (JSC::JIT::emit_op_is_undefined):
+        (JSC::JIT::emit_op_is_boolean):
+        (JSC::JIT::emit_op_is_number):
+        (JSC::JIT::emit_op_is_cell_with_type):
+        (JSC::JIT::emit_op_is_object):
+        (JSC::JIT::emit_op_eq):
+        (JSC::JIT::emit_op_neq):
+        (JSC::JIT::compileOpStrictEq):
+        (JSC::JIT::emit_op_eq_null):
+        (JSC::JIT::emit_op_neq_null):
+        (JSC::JIT::emitSlow_op_eq):
+        (JSC::JIT::emitSlow_op_neq):
+        (JSC::JIT::emitSlow_op_instanceof_custom):
+        (JSC::JIT::emitNewFuncExprCommon):
+        * jit/JSInterfaceJIT.h:
+        (JSC::JSInterfaceJIT::emitLoadInt32):
+        (JSC::JSInterfaceJIT::emitLoadDouble):
+        (JSC::JSInterfaceJIT::emitPutToCallFrameHeader):
+        (JSC::JSInterfaceJIT::emitPutCellToCallFrameHeader):
+        (JSC::JSInterfaceJIT::tagFor): Deleted.
+        (JSC::JSInterfaceJIT::payloadFor): Deleted.
+        (JSC::JSInterfaceJIT::intPayloadFor): Deleted.
+        (JSC::JSInterfaceJIT::intTagFor): Deleted.
+        (JSC::JSInterfaceJIT::emitTagInt): Deleted.
+        (JSC::JSInterfaceJIT::addressFor): Deleted.
+        * jit/SpecializedThunkJIT.h:
+        (JSC::SpecializedThunkJIT::returnDouble):
+        * jit/ThunkGenerators.cpp:
+        (JSC::nativeForGenerator):
+        (JSC::arityFixupGenerator):
+
+2018-05-21  Yusuke Suzuki  <[email protected]>
+
         Unreviewed, reland InById cache
         https://bugs.webkit.org/show_bug.cgi?id=185682
 

Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.h (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.h	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.h	2018-05-22 05:46:27 UTC (rev 232048)
@@ -1091,6 +1091,11 @@
         return addressFor(static_cast<VirtualRegister>(operand));
     }
 
+    static Address tagFor(VirtualRegister virtualRegister, GPRReg baseGPR)
+    {
+        ASSERT(virtualRegister.isValid());
+        return Address(baseGPR, virtualRegister.offset() * sizeof(Register) + TagOffset);
+    }
     static Address tagFor(VirtualRegister virtualRegister)
     {
         ASSERT(virtualRegister.isValid());
@@ -1101,6 +1106,11 @@
         return tagFor(static_cast<VirtualRegister>(operand));
     }
 
+    static Address payloadFor(VirtualRegister virtualRegister, GPRReg baseGPR)
+    {
+        ASSERT(virtualRegister.isValid());
+        return Address(baseGPR, virtualRegister.offset() * sizeof(Register) + PayloadOffset);
+    }
     static Address payloadFor(VirtualRegister virtualRegister)
     {
         ASSERT(virtualRegister.isValid());

Modified: trunk/Source/_javascript_Core/jit/JIT.h (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/JIT.h	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2018-05-22 05:46:27 UTC (rev 232048)
@@ -449,8 +449,6 @@
         void emitJumpSlowCaseIfNotNumber(RegisterID);
         void emitJumpSlowCaseIfNotInt(RegisterID, RegisterID, RegisterID scratch);
 
-        void emitTagBool(RegisterID);
-
         void compileGetByIdHotPath(int baseVReg, const Identifier*);
 
 #endif // USE(JSVALUE32_64)

Modified: trunk/Source/_javascript_Core/jit/JITArithmetic.cpp (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/JITArithmetic.cpp	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/JITArithmetic.cpp	2018-05-22 05:46:27 UTC (rev 232048)
@@ -241,7 +241,7 @@
     emitGetVirtualRegister(op1, regT0);
     emitJumpSlowCaseIfNotInt(regT0);
     addSlowCase(branch32(LessThan, regT0, TrustedImm32(0)));
-    emitTagInt(regT0, regT0);
+    boxInt32(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(result, regT0);
 }
 
@@ -322,7 +322,7 @@
         emitGetVirtualRegisters(op1, regT0, op2, regT1);
         compare32(condition, regT0, regT1, regT0);
     }
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(dst);
 }
 
@@ -434,7 +434,7 @@
     emitGetVirtualRegister(srcDst, regT0);
     emitJumpSlowCaseIfNotInt(regT0);
     addSlowCase(branchAdd32(Overflow, TrustedImm32(1), regT0));
-    emitTagInt(regT0, regT0);
+    boxInt32(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(srcDst);
 }
 
@@ -445,7 +445,7 @@
     emitGetVirtualRegister(srcDst, regT0);
     emitJumpSlowCaseIfNotInt(regT0);
     addSlowCase(branchSub32(Overflow, TrustedImm32(1), regT0));
-    emitTagInt(regT0, regT0);
+    boxInt32(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(srcDst);
 }
 
@@ -480,7 +480,7 @@
     Jump numeratorPositive = branch32(GreaterThanOrEqual, regT4, TrustedImm32(0));
     addSlowCase(branchTest32(Zero, edx));
     numeratorPositive.link(this);
-    emitTagInt(edx, regT0);
+    boxInt32(edx, JSValueRegs { regT0 });
     emitPutVirtualRegister(result);
 }
 

Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2018-05-22 05:46:27 UTC (rev 232048)
@@ -261,7 +261,7 @@
     } // SP holds newCallFrame + sizeof(CallerFrameAndPC), with ArgumentCount initialized.
     
     uint32_t locationBits = CallSiteIndex(instruction).bits();
-    store32(TrustedImm32(locationBits), tagFor(CallFrameSlot::argumentCount, callFrameRegister));
+    store32(TrustedImm32(locationBits), tagFor(CallFrameSlot::argumentCount));
     emitLoad(callee, regT1, regT0); // regT1, regT0 holds callee.
 
     store32(regT0, Address(stackPointerRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC)));

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2018-05-22 05:46:27 UTC (rev 232048)
@@ -90,10 +90,10 @@
 ALWAYS_INLINE void JIT::emitPutIntToCallFrameHeader(RegisterID from, int entry)
 {
 #if USE(JSVALUE32_64)
-    store32(TrustedImm32(Int32Tag), intTagFor(entry, callFrameRegister));
-    store32(from, intPayloadFor(entry, callFrameRegister));
+    store32(TrustedImm32(JSValue::Int32Tag), tagFor(entry));
+    store32(from, payloadFor(entry));
 #else
-    store64(from, addressFor(entry, callFrameRegister));
+    store64(from, addressFor(entry));
 #endif
 }
 
@@ -141,7 +141,7 @@
 #else
     uint32_t locationBits = CallSiteIndex(m_bytecodeOffset).bits();
 #endif
-    store32(TrustedImm32(locationBits), intTagFor(CallFrameSlot::argumentCount));
+    store32(TrustedImm32(locationBits), tagFor(CallFrameSlot::argumentCount));
     
     // FIXME: It's not clear that this is needed. JITOperations tend to update the top call frame on
     // the C++ side.
@@ -396,6 +396,11 @@
     return getConstantOperand(src).asDouble();
 }
 
+ALWAYS_INLINE void JIT::emitInitRegister(int dst)
+{
+    storeTrustedValue(jsUndefined(), addressFor(dst));
+}
+
 #if USE(JSVALUE32_64)
 
 inline void JIT::emitLoadTag(int index, RegisterID tag)
@@ -445,14 +450,15 @@
         return;
     }
 
+    VirtualRegister target { index };
     if (payload == base) { // avoid stomping base
-        load32(tagFor(index, base), tag);
-        load32(payloadFor(index, base), payload);
+        load32(tagFor(target, base), tag);
+        load32(payloadFor(target, base), payload);
         return;
     }
 
-    load32(payloadFor(index, base), payload);
-    load32(tagFor(index, base), tag);
+    load32(payloadFor(target, base), payload);
+    load32(tagFor(target, base), tag);
 }
 
 inline void JIT::emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2)
@@ -482,36 +488,37 @@
 
 inline void JIT::emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base)
 {
-    store32(payload, payloadFor(index, base));
-    store32(tag, tagFor(index, base));
+    VirtualRegister target { index };
+    store32(payload, payloadFor(target, base));
+    store32(tag, tagFor(target, base));
 }
 
 inline void JIT::emitStoreInt32(int index, RegisterID payload, bool indexIsInt32)
 {
-    store32(payload, payloadFor(index, callFrameRegister));
+    store32(payload, payloadFor(index));
     if (!indexIsInt32)
-        store32(TrustedImm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
+        store32(TrustedImm32(JSValue::Int32Tag), tagFor(index));
 }
 
 inline void JIT::emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32)
 {
-    store32(payload, payloadFor(index, callFrameRegister));
+    store32(payload, payloadFor(index));
     if (!indexIsInt32)
-        store32(TrustedImm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
+        store32(TrustedImm32(JSValue::Int32Tag), tagFor(index));
 }
 
 inline void JIT::emitStoreCell(int index, RegisterID payload, bool indexIsCell)
 {
-    store32(payload, payloadFor(index, callFrameRegister));
+    store32(payload, payloadFor(index));
     if (!indexIsCell)
-        store32(TrustedImm32(JSValue::CellTag), tagFor(index, callFrameRegister));
+        store32(TrustedImm32(JSValue::CellTag), tagFor(index));
 }
 
 inline void JIT::emitStoreBool(int index, RegisterID payload, bool indexIsBool)
 {
-    store32(payload, payloadFor(index, callFrameRegister));
+    store32(payload, payloadFor(index));
     if (!indexIsBool)
-        store32(TrustedImm32(JSValue::BooleanTag), tagFor(index, callFrameRegister));
+        store32(TrustedImm32(JSValue::BooleanTag), tagFor(index));
 }
 
 inline void JIT::emitStoreDouble(int index, FPRegisterID value)
@@ -521,15 +528,11 @@
 
 inline void JIT::emitStore(int index, const JSValue constant, RegisterID base)
 {
-    store32(Imm32(constant.payload()), payloadFor(index, base));
-    store32(Imm32(constant.tag()), tagFor(index, base));
+    VirtualRegister target { index };
+    store32(Imm32(constant.payload()), payloadFor(target, base));
+    store32(Imm32(constant.tag()), tagFor(target, base));
 }
 
-ALWAYS_INLINE void JIT::emitInitRegister(int dst)
-{
-    emitStore(dst, jsUndefined());
-}
-
 inline void JIT::emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex)
 {
     if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
@@ -589,7 +592,7 @@
         return;
     }
 
-    load64(Address(callFrameRegister, src * sizeof(Register)), dst);
+    load64(addressFor(src), dst);
 }
 
 ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, JSValueRegs dst)
@@ -620,7 +623,7 @@
 
 ALWAYS_INLINE void JIT::emitPutVirtualRegister(int dst, RegisterID from)
 {
-    store64(from, Address(callFrameRegister, dst * sizeof(Register)));
+    store64(from, addressFor(dst));
 }
 
 ALWAYS_INLINE void JIT::emitPutVirtualRegister(int dst, JSValueRegs from)
@@ -633,11 +636,6 @@
     emitPutVirtualRegister(dst.offset(), from);
 }
 
-ALWAYS_INLINE void JIT::emitInitRegister(int dst)
-{
-    store64(TrustedImm64(JSValue::encode(jsUndefined())), Address(callFrameRegister, dst * sizeof(Register)));
-}
-
 ALWAYS_INLINE JIT::Jump JIT::emitJumpIfBothJSCells(RegisterID reg1, RegisterID reg2, RegisterID scratch)
 {
     move(reg1, scratch);
@@ -706,11 +704,6 @@
     addSlowCase(branchIfNotNumber(reg));
 }
 
-ALWAYS_INLINE void JIT::emitTagBool(RegisterID reg)
-{
-    or32(TrustedImm32(static_cast<int32_t>(ValueFalse)), reg);
-}
-
 inline Instruction* JIT::copiedInstruction(Instruction* inst)
 {
     return &m_instructions[m_codeBlock->bytecodeOffset(inst)];

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2018-05-22 05:46:27 UTC (rev 232048)
@@ -125,7 +125,7 @@
 
     // Check that constructor 'ImplementsDefaultHasInstance' i.e. the object is not a C-API user nor a bound function.
     test8(Zero, Address(regT0, JSCell::typeInfoFlagsOffset()), TrustedImm32(ImplementsDefaultHasInstance), regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     Jump done = jump();
 
     customhasInstanceValue.link(this);
@@ -191,7 +191,7 @@
     emitGetVirtualRegister(value, regT0);
     compare64(Equal, regT0, TrustedImm32(JSValue::encode(JSValue())), regT0);
 
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(dst);
 }
 
@@ -219,7 +219,7 @@
 
     notMasqueradesAsUndefined.link(this);
     done.link(this);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(dst);
 }
 
@@ -231,7 +231,7 @@
     emitGetVirtualRegister(value, regT0);
     xor64(TrustedImm32(static_cast<int32_t>(ValueFalse)), regT0);
     test64(Zero, regT0, TrustedImm32(static_cast<int32_t>(~1)), regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(dst);
 }
 
@@ -242,7 +242,7 @@
     
     emitGetVirtualRegister(value, regT0);
     test64(NonZero, regT0, tagTypeNumberRegister, regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(dst);
 }
 
@@ -256,7 +256,7 @@
     Jump isNotCell = branchIfNotCell(regT0);
 
     compare8(Equal, Address(regT0, JSCell::typeInfoTypeOffset()), TrustedImm32(type), regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     Jump done = jump();
 
     isNotCell.link(this);
@@ -275,7 +275,7 @@
     Jump isNotCell = branchIfNotCell(regT0);
 
     compare8(AboveOrEqual, Address(regT0, JSCell::typeInfoTypeOffset()), TrustedImm32(ObjectType), regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     Jump done = jump();
 
     isNotCell.link(this);
@@ -416,7 +416,7 @@
     emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
     emitJumpSlowCaseIfNotInt(regT0, regT1, regT2);
     compare32(Equal, regT1, regT0, regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(currentInstruction[1].u.operand);
 }
 
@@ -446,7 +446,7 @@
     emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
     emitJumpSlowCaseIfNotInt(regT0, regT1, regT2);
     compare32(NotEqual, regT1, regT0, regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
 
     emitPutVirtualRegister(currentInstruction[1].u.operand);
 }
@@ -494,7 +494,7 @@
         compare64(Equal, regT1, regT0, regT0);
     else
         compare64(NotEqual, regT1, regT0, regT0);
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
 
     emitPutVirtualRegister(dst);
 }
@@ -745,7 +745,7 @@
     wasNotImmediate.link(this);
     wasNotMasqueradesAsUndefined.link(this);
 
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(dst);
 
 }
@@ -777,7 +777,7 @@
     wasNotImmediate.link(this);
     wasNotMasqueradesAsUndefined.link(this);
 
-    emitTagBool(regT0);
+    boxBoolean(regT0, JSValueRegs { regT0 });
     emitPutVirtualRegister(dst);
 }
 
@@ -869,7 +869,7 @@
     linkAllSlowCases(iter);
 
     callOperation(operationCompareEq, regT0, regT1);
-    emitTagBool(returnValueGPR);
+    boxBoolean(returnValueGPR, JSValueRegs { returnValueGPR });
     emitPutVirtualRegister(currentInstruction[1].u.operand, returnValueGPR);
 }
 
@@ -879,7 +879,7 @@
 
     callOperation(operationCompareEq, regT0, regT1);
     xor32(TrustedImm32(0x1), regT0);
-    emitTagBool(returnValueGPR);
+    boxBoolean(returnValueGPR, JSValueRegs { returnValueGPR });
     emitPutVirtualRegister(currentInstruction[1].u.operand, returnValueGPR);
 }
 
@@ -915,7 +915,7 @@
     emitGetVirtualRegister(constructor, regT1);
     emitGetVirtualRegister(hasInstanceValue, regT2);
     callOperation(operationInstanceOfCustom, regT0, regT1, regT2);
-    emitTagBool(returnValueGPR);
+    boxBoolean(returnValueGPR, JSValueRegs { returnValueGPR });
     emitPutVirtualRegister(dst, returnValueGPR);
 }
 
@@ -1041,12 +1041,12 @@
 #if USE(JSVALUE64)
     emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
     notUndefinedScope = branchIfNotUndefined(regT0);
-    store64(TrustedImm64(JSValue::encode(jsUndefined())), Address(callFrameRegister, sizeof(Register) * dst));
 #else
     emitLoadPayload(currentInstruction[2].u.operand, regT0);
     notUndefinedScope = branch32(NotEqual, tagFor(currentInstruction[2].u.operand), TrustedImm32(JSValue::UndefinedTag));
-    emitStore(dst, jsUndefined());
 #endif
+    storeTrustedValue(jsUndefined(), addressFor(dst));
+
     Jump done = jump();
     notUndefinedScope.link(this);
         

Modified: trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h	2018-05-22 05:46:27 UTC (rev 232048)
@@ -44,11 +44,6 @@
         {
         }
 
-#if USE(JSVALUE32_64)
-        static const unsigned Int32Tag = static_cast<unsigned>(JSValue::Int32Tag);
-#else
-        static const unsigned Int32Tag = static_cast<unsigned>(TagTypeNumber >> 32);
-#endif
         inline Jump emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID payload);
         inline Jump emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst);
         inline Jump emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch);
@@ -55,23 +50,13 @@
 
 #if USE(JSVALUE32_64)
         inline Jump emitJumpIfNotJSCell(unsigned virtualRegisterIndex);
-        inline Address tagFor(int index, RegisterID base = callFrameRegister);
 #endif
 
-#if USE(JSVALUE64)
-        void emitTagInt(RegisterID src, RegisterID dest);
-#endif
-
         void emitGetFromCallFrameHeaderPtr(int entry, RegisterID to, RegisterID from = callFrameRegister);
         void emitPutToCallFrameHeader(RegisterID from, int entry);
         void emitPutToCallFrameHeader(void* value, int entry);
         void emitPutCellToCallFrameHeader(RegisterID from, int entry);
 
-        inline Address payloadFor(int index, RegisterID base = callFrameRegister);
-        inline Address intPayloadFor(int index, RegisterID base = callFrameRegister);
-        inline Address intTagFor(int index, RegisterID base = callFrameRegister);
-        inline Address addressFor(int index, RegisterID base = callFrameRegister);
-
         VM* vm() const { return m_vm; }
 
         VM* m_vm;
@@ -101,29 +86,7 @@
         loadPtr(payloadFor(virtualRegisterIndex), dst);
         return branch32(NotEqual, tagFor(static_cast<int>(virtualRegisterIndex)), TrustedImm32(JSValue::Int32Tag));
     }
-    
-    inline JSInterfaceJIT::Address JSInterfaceJIT::tagFor(int virtualRegisterIndex, RegisterID base)
-    {
-        ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
-        return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
-    }
-    
-    inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(int virtualRegisterIndex, RegisterID base)
-    {
-        ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
-        return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
-    }
 
-    inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(int virtualRegisterIndex, RegisterID base)
-    {
-        return payloadFor(virtualRegisterIndex, base);
-    }
-
-    inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(int virtualRegisterIndex, RegisterID base)
-    {
-        return tagFor(virtualRegisterIndex, base);
-    }
-
     inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch)
     {
         ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
@@ -168,35 +131,8 @@
         done.link(this);
         return notNumber;
     }
-
-    // operand is int32_t, must have been zero-extended if register is 64-bit.
-    ALWAYS_INLINE void JSInterfaceJIT::emitTagInt(RegisterID src, RegisterID dest)
-    {
-        if (src != dest)
-            move(src, dest);
-        or64(tagTypeNumberRegister, dest);
-    }
 #endif
 
-#if USE(JSVALUE64)
-    inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(int virtualRegisterIndex, RegisterID base)
-    {
-        ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
-        return addressFor(virtualRegisterIndex, base);
-    }
-
-    inline JSInterfaceJIT::Address JSInterfaceJIT::intPayloadFor(int virtualRegisterIndex, RegisterID base)
-    {
-        ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
-        return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
-    }
-    inline JSInterfaceJIT::Address JSInterfaceJIT::intTagFor(int virtualRegisterIndex, RegisterID base)
-    {
-        ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
-        return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
-    }
-#endif
-
     ALWAYS_INLINE void JSInterfaceJIT::emitGetFromCallFrameHeaderPtr(int entry, RegisterID to, RegisterID from)
     {
         loadPtr(Address(from, entry * sizeof(Register)), to);
@@ -205,33 +141,27 @@
     ALWAYS_INLINE void JSInterfaceJIT::emitPutToCallFrameHeader(RegisterID from, int entry)
     {
 #if USE(JSVALUE32_64)
-        storePtr(from, payloadFor(entry, callFrameRegister));
+        storePtr(from, payloadFor(entry));
 #else
-        store64(from, addressFor(entry, callFrameRegister));
+        store64(from, addressFor(entry));
 #endif
     }
 
     ALWAYS_INLINE void JSInterfaceJIT::emitPutToCallFrameHeader(void* value, int entry)
     {
-        storePtr(TrustedImmPtr(value), Address(callFrameRegister, entry * sizeof(Register)));
+        storePtr(TrustedImmPtr(value), addressFor(entry));
     }
 
     ALWAYS_INLINE void JSInterfaceJIT::emitPutCellToCallFrameHeader(RegisterID from, int entry)
     {
 #if USE(JSVALUE32_64)
-        store32(TrustedImm32(JSValue::CellTag), tagFor(entry, callFrameRegister));
-        store32(from, payloadFor(entry, callFrameRegister));
+        store32(TrustedImm32(JSValue::CellTag), tagFor(entry));
+        store32(from, payloadFor(entry));
 #else
-        store64(from, addressFor(entry, callFrameRegister));
+        store64(from, addressFor(entry));
 #endif
     }
 
-    inline JSInterfaceJIT::Address JSInterfaceJIT::addressFor(int virtualRegisterIndex, RegisterID base)
-    {
-        ASSERT(virtualRegisterIndex < FirstConstantRegisterIndex);
-        return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)));
-    }
-
 } // namespace JSC
 
 #endif // ENABLE(JIT)

Modified: trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h	2018-05-22 05:46:27 UTC (rev 232048)
@@ -135,7 +135,7 @@
             Jump lowNonZero = branchTestPtr(NonZero, regT1);
             Jump highNonZero = branchTestPtr(NonZero, regT0);
             move(TrustedImm32(0), regT0);
-            move(TrustedImm32(Int32Tag), regT1);
+            move(TrustedImm32(JSValue::Int32Tag), regT1);
             lowNonZero.link(this);
             highNonZero.link(this);
 #endif

Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (232047 => 232048)


--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp	2018-05-22 04:54:31 UTC (rev 232047)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp	2018-05-22 05:46:27 UTC (rev 232048)
@@ -265,13 +265,8 @@
 #if USE(JSVALUE64)
         // We're coming from a specialized thunk that has saved the prior tag registers' contents.
         // Restore them now.
-#if CPU(ARM64)
         jit.popPair(JSInterfaceJIT::tagTypeNumberRegister, JSInterfaceJIT::tagMaskRegister);
-#else
-        jit.pop(JSInterfaceJIT::tagMaskRegister);
-        jit.pop(JSInterfaceJIT::tagTypeNumberRegister);
 #endif
-#endif
         break;
     case EnterViaJumpWithoutSavedTags:
         jit.move(JSInterfaceJIT::framePointerRegister, JSInterfaceJIT::stackPointerRegister);
@@ -485,7 +480,7 @@
     jit.storePtr(GPRInfo::regT3, JSInterfaceJIT::Address(GPRInfo::callFrameRegister, CallFrame::returnPCOffset()));
 #endif
     jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
-    jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, CallFrameSlot::argumentCount * sizeof(Register)), JSInterfaceJIT::argumentGPR2);
+    jit.load32(JSInterfaceJIT::addressFor(CallFrameSlot::argumentCount), JSInterfaceJIT::argumentGPR2);
     jit.add32(JSInterfaceJIT::TrustedImm32(CallFrame::headerSizeInRegisters), JSInterfaceJIT::argumentGPR2);
 
     // Check to see if we have extra slots we can use
@@ -549,7 +544,7 @@
     jit.pop(JSInterfaceJIT::regT4);
 #  endif
     jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
-    jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, CallFrameSlot::argumentCount * sizeof(Register)), JSInterfaceJIT::argumentGPR2);
+    jit.load32(JSInterfaceJIT::addressFor(CallFrameSlot::argumentCount), JSInterfaceJIT::argumentGPR2);
     jit.add32(JSInterfaceJIT::TrustedImm32(CallFrame::headerSizeInRegisters), JSInterfaceJIT::argumentGPR2);
 
     // Check to see if we have extra slots we can use
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to