Title: [94688] trunk/Source/_javascript_Core
Revision
94688
Author
[email protected]
Date
2011-09-07 10:55:50 -0700 (Wed, 07 Sep 2011)

Log Message

Refactor JIT checks for ObjectType into helper functions.

Rubber stamped by Sam Weinig.

* dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::branchIfNotObject):
* dfg/DFGNonSpeculativeJIT.cpp:
(JSC::DFG::NonSpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* jit/JIT.h:
* jit/JITCall32_64.cpp:
(JSC::JIT::emit_op_ret_object_or_this):
* jit/JITInlineMethods.h:
(JSC::JIT::emitJumpIfNotObject):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emit_op_ret_object_or_this):
(JSC::JIT::emit_op_get_pnames):
(JSC::JIT::emit_op_create_this):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emit_op_get_pnames):
(JSC::JIT::emit_op_create_this):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (94687 => 94688)


--- trunk/Source/_javascript_Core/ChangeLog	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-09-07 17:55:50 UTC (rev 94688)
@@ -1,3 +1,30 @@
+2011-09-07  Gavin Barraclough  <[email protected]>
+
+        Refactor JIT checks for ObjectType into helper functions.
+
+        Rubber stamped by Sam Weinig.
+
+        * dfg/DFGJITCompiler.h:
+        (JSC::DFG::JITCompiler::branchIfNotObject):
+        * dfg/DFGNonSpeculativeJIT.cpp:
+        (JSC::DFG::NonSpeculativeJIT::compile):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * jit/JIT.h:
+        * jit/JITCall32_64.cpp:
+        (JSC::JIT::emit_op_ret_object_or_this):
+        * jit/JITInlineMethods.h:
+        (JSC::JIT::emitJumpIfNotObject):
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_instanceof):
+        (JSC::JIT::emit_op_ret_object_or_this):
+        (JSC::JIT::emit_op_get_pnames):
+        (JSC::JIT::emit_op_create_this):
+        * jit/JITOpcodes32_64.cpp:
+        (JSC::JIT::emit_op_instanceof):
+        (JSC::JIT::emit_op_get_pnames):
+        (JSC::JIT::emit_op_create_this):
+
 2011-09-07  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r94627 and r94632.

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (94687 => 94688)


--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h	2011-09-07 17:55:50 UTC (rev 94688)
@@ -185,7 +185,12 @@
     {
         return Address(GPRInfo::callFrameRegister, virtualRegister * sizeof(Register) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
     }
-    
+
+    Jump branchIfNotObject(GPRReg structureReg)
+    {
+        return branch8(NotEqual, Address(structureReg, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+    }
+
     // Notify the JIT of a call that does not require linking.
     void notifyCall(Call call, unsigned exceptionInfo)
     {

Modified: trunk/Source/_javascript_Core/dfg/DFGNonSpeculativeJIT.cpp (94687 => 94688)


--- trunk/Source/_javascript_Core/dfg/DFGNonSpeculativeJIT.cpp	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/dfg/DFGNonSpeculativeJIT.cpp	2011-09-07 17:55:50 UTC (rev 94688)
@@ -1161,7 +1161,7 @@
 
         // Check that prototype is an object
         m_jit.loadPtr(MacroAssembler::Address(prototypeReg, JSCell::structureOffset()), scratchReg);
-        MacroAssembler::Jump protoNotObject = m_jit.branch8(MacroAssembler::NotEqual, MacroAssembler::Address(scratchReg, Structure::typeInfoTypeOffset()), MacroAssembler::TrustedImm32(ObjectType));
+        MacroAssembler::Jump protoNotObject = m_jit.branchIfNotObject(scratchReg);
 
         // Initialize scratchReg with the value being checked.
         m_jit.move(valueReg, scratchReg);

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (94687 => 94688)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2011-09-07 17:55:50 UTC (rev 94688)
@@ -1303,7 +1303,7 @@
 
         // Check that prototype is an object.
         m_jit.loadPtr(MacroAssembler::Address(prototypeReg, JSCell::structureOffset()), scratchReg);
-        speculationCheck(m_jit.branch8(MacroAssembler::NotEqual, MacroAssembler::Address(scratchReg, Structure::typeInfoTypeOffset()), MacroAssembler::TrustedImm32(ObjectType)));
+        speculationCheck(m_jit.branchIfNotObject(scratchReg));
 
         // Initialize scratchReg with the value being checked.
         m_jit.move(valueReg, scratchReg);

Modified: trunk/Source/_javascript_Core/jit/JIT.h (94687 => 94688)


--- trunk/Source/_javascript_Core/jit/JIT.h	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2011-09-07 17:55:50 UTC (rev 94688)
@@ -296,6 +296,7 @@
         
         void emitLoadDouble(unsigned index, FPRegisterID value);
         void emitLoadInt32ToDouble(unsigned index, FPRegisterID value);
+        Jump emitJumpIfNotObject(RegisterID structureReg);
 
         void testPrototype(JSValue, JumpList& failureCases);
 
@@ -565,9 +566,9 @@
             return emitJumpIfNotImmediateInteger(reg);
         }
 #endif
-        JIT::Jump emitJumpIfImmediateInteger(RegisterID);
-        JIT::Jump emitJumpIfNotImmediateInteger(RegisterID);
-        JIT::Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
+        Jump emitJumpIfImmediateInteger(RegisterID);
+        Jump emitJumpIfNotImmediateInteger(RegisterID);
+        Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
         void emitJumpSlowCaseIfNotImmediateInteger(RegisterID);
         void emitJumpSlowCaseIfNotImmediateNumber(RegisterID);
         void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);

Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (94687 => 94688)


--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2011-09-07 17:55:50 UTC (rev 94688)
@@ -128,7 +128,7 @@
     emitLoad(result, regT1, regT0);
     Jump notJSCell = branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag));
     loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
-    Jump notObject = branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+    Jump notObject = emitJumpIfNotObject(regT2);
 
     emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
     emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);

Modified: trunk/Source/_javascript_Core/jit/JITInlineMethods.h (94687 => 94688)


--- trunk/Source/_javascript_Core/jit/JITInlineMethods.h	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/jit/JITInlineMethods.h	2011-09-07 17:55:50 UTC (rev 94688)
@@ -313,6 +313,11 @@
     jump.linkTo(m_labels[m_bytecodeOffset + relativeOffset], this);
 }
 
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotObject(RegisterID structureReg)
+{
+    return branch8(NotEqual, Address(structureReg, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+}
+
 #if ENABLE(SAMPLING_FLAGS)
 ALWAYS_INLINE void JIT::setSamplingFlag(int32_t flag)
 {

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (94687 => 94688)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2011-09-07 17:55:50 UTC (rev 94688)
@@ -377,7 +377,7 @@
 
     // Check that prototype is an object
     loadPtr(Address(regT1, JSCell::structureOffset()), regT3);
-    addSlowCase(branch8(NotEqual, Address(regT3, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType)));
+    addSlowCase(emitJumpIfNotObject(regT3));
     
     // Fixme: this check is only needed because the JSC API allows HasInstance to be overridden; we should deprecate this.
     // Check that baseVal 'ImplementsDefaultHasInstance'.
@@ -484,7 +484,7 @@
     emitGetVirtualRegister(currentInstruction[1].u.operand, returnValueRegister);
     Jump notJSCell = emitJumpIfNotJSCell(returnValueRegister);
     loadPtr(Address(returnValueRegister, JSCell::structureOffset()), regT2);
-    Jump notObject = branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+    Jump notObject = emitJumpIfNotObject(regT2);
 
     // Grab the return address.
     emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
@@ -801,7 +801,7 @@
         isNotObject.append(emitJumpIfNotJSCell(regT0));
     if (base != m_codeBlock->thisRegister() || m_codeBlock->isStrictMode()) {
         loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
-        isNotObject.append(branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType)));
+        isNotObject.append(emitJumpIfNotObject(regT2));
     }
 
     // We could inline the case where you have a valid cache, but
@@ -1167,7 +1167,7 @@
     emitGetVirtualRegister(currentInstruction[2].u.operand, regT2);
     emitJumpSlowCaseIfNotJSCell(regT2, currentInstruction[2].u.operand);
     loadPtr(Address(regT2, JSCell::structureOffset()), regT1);
-    addSlowCase(branch8(NotEqual, Address(regT1, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType)));
+    addSlowCase(emitJumpIfNotObject(regT1));
     
     // now we know that the prototype is an object, but we don't know if it's got an
     // inheritor ID

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (94687 => 94688)


--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2011-09-07 17:55:18 UTC (rev 94687)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2011-09-07 17:55:50 UTC (rev 94688)
@@ -529,7 +529,7 @@
     
     // Check that prototype is an object
     loadPtr(Address(regT1, JSCell::structureOffset()), regT3);
-    addSlowCase(branch8(NotEqual, Address(regT3, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType)));
+    addSlowCase(emitJumpIfNotObject(regT3));
 
     // Fixme: this check is only needed because the JSC API allows HasInstance to be overridden; we should deprecate this.
     // Check that baseVal 'ImplementsDefaultHasInstance'.
@@ -1147,7 +1147,7 @@
         isNotObject.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)));
     if (base != m_codeBlock->thisRegister() || m_codeBlock->isStrictMode()) {
         loadPtr(Address(regT0, JSCell::structureOffset()), regT2);
-        isNotObject.append(branch8(NotEqual, Address(regT2, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType)));
+        isNotObject.append(emitJumpIfNotObject(regT2));
     }
 
     // We could inline the case where you have a valid cache, but
@@ -1442,7 +1442,7 @@
     emitLoad(currentInstruction[2].u.operand, regT1, regT0);
     emitJumpSlowCaseIfNotJSCell(currentInstruction[2].u.operand, regT1);
     loadPtr(Address(regT0, JSCell::structureOffset()), regT1);
-    addSlowCase(branch8(NotEqual, Address(regT1, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType)));
+    addSlowCase(emitJumpIfNotObject(regT1));
     
     // now we know that the prototype is an object, but we don't know if it's got an
     // inheritor ID
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to