[Webkit-unassigned] [Bug 104807] Adds support for fromCharCode intrinsic

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 12 07:33:13 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=104807





--- Comment #2 from Vahag <vaag at ispras.ru>  2012-12-12 07:35:36 PST ---
(From update of attachment 179038)
>Index: Source/JavaScriptCore/ChangeLog
>===================================================================
>--- Source/JavaScriptCore/ChangeLog	(revision 137464)
>+++ Source/JavaScriptCore/ChangeLog	(working copy)
>@@ -1,3 +1,30 @@
>+2012-12-12  Vahag Vardanyan  <vaag at ispras.ru>
>+
>+        Adds support for fromCharCode intrinsic
>+        https://bugs.webkit.org/show_bug.cgi?id=104807
>+
>+        Reviewed by NOBODY (OOPS!).
>+
>+        Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!).
>+
>+        * dfg/DFGAbstractState.cpp:
>+        (JSC::DFG::AbstractState::execute):
>+        * dfg/DFGByteCodeParser.cpp:
>+        (JSC::DFG::ByteCodeParser::handleIntrinsic):
>+        * dfg/DFGNodeType.h:
>+        (DFG):
>+        * dfg/DFGPredictionPropagationPhase.cpp:
>+        (JSC::DFG::PredictionPropagationPhase::propagate):
>+        * dfg/DFGSpeculativeJIT.cpp:
>+        (JSC::DFG::SpeculativeJIT::compileFromCharCode):
>+        (DFG):
>+        * dfg/DFGSpeculativeJIT.h:
>+        (SpeculativeJIT):
>+        * dfg/DFGSpeculativeJIT32_64.cpp:
>+        (JSC::DFG::SpeculativeJIT::compile):
>+        * dfg/DFGSpeculativeJIT64.cpp:
>+        (JSC::DFG::SpeculativeJIT::compile):
>+
> 2012-12-11  Gabor Ballabas  <gaborb at inf.u-szeged.hu>
> 
>         Implement add64 for ARM traditional assembler after r136601
>Index: Source/JavaScriptCore/dfg/DFGNodeType.h
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGNodeType.h	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGNodeType.h	(working copy)
>@@ -174,6 +174,7 @@
>     /* Optimizations for string access */ \
>     macro(StringCharCodeAt, NodeResultInt32) \
>     macro(StringCharAt, NodeResultJS) \
>+    macro(StringFromCharCode, NodeResultJS) \
>     \
>     /* Nodes for comparison operations. */\
>     macro(CompareLess, NodeResultBoolean | NodeMustGenerate | NodeMightClobber) \
>Index: Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp	(working copy)
>@@ -2582,6 +2582,11 @@
>         compileGetByValOnString(node);
>         break;
>     }
>+
>+    case StringFromCharCode: {
>+        compileFromCharCode(node);
>+        break;
>+    }
>         
>     case CheckArray: {
>         checkArray(node);
>Index: Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp	(working copy)
>@@ -2551,6 +2551,11 @@
>         compileGetByValOnString(node);
>         break;
>     }
>+
>+    case StringFromCharCode: {
>+        compileFromCharCode(node);
>+        break;
>+    }
>         
>     case CheckArray: {
>         checkArray(node);
>Index: Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp	(working copy)
>@@ -2016,6 +2016,25 @@
>     cellResult(scratchReg, m_compileIndex);
> }
> 
>+void SpeculativeJIT::compileFromCharCode(Node& node)
>+{
>+    SpeculateStrictInt32Operand property(this, node.child1());
>+    GPRReg propertyReg = property.gpr();
>+    GPRTemporary smallStrings(this);
>+    GPRTemporary scratch(this);
>+    GPRReg scratchReg = scratch.gpr();
>+    GPRReg smallStringsReg = smallStrings.gpr();
>+
>+    // Only ASCII characters are supported
>+    speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, TrustedImm32(0x100)));
>+
>+    m_jit.move(MacroAssembler::TrustedImmPtr(m_jit.globalData()->smallStrings.singleCharacterStrings()), smallStringsReg);
>+    m_jit.loadPtr(MacroAssembler::BaseIndex(smallStringsReg, propertyReg, MacroAssembler::ScalePtr, 0), scratchReg);
>+    speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTest32(MacroAssembler::Zero, scratchReg));
>+
>+    cellResult(scratchReg, m_compileIndex);
>+}
>+
> GeneratedOperandType SpeculativeJIT::checkGeneratedTypeForToInt32(NodeIndex nodeIndex)
> {
> #if DFG_ENABLE(DEBUG_VERBOSE)
>Index: Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h	(working copy)
>@@ -2338,6 +2338,7 @@
>     
>     void compileGetCharCodeAt(Node&);
>     void compileGetByValOnString(Node&);
>+    void compileFromCharCode(Node&);
> 
>     void compileGetByValOnArguments(Node&);
>     void compileGetArgumentsLength(Node&);
>Index: Source/JavaScriptCore/dfg/DFGAbstractState.cpp
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGAbstractState.cpp	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGAbstractState.cpp	(working copy)
>@@ -887,6 +887,12 @@
>         forNode(nodeIndex).set(SpecInt32);
>         break;
>         
>+    case StringFromCharCode:
>+        node.setCanExit(true);
>+        forNode(node.child1()).filter(SpecInt32);
>+        forNode(nodeIndex).set(SpecString);
>+        break;
>+
>     case StringCharAt:
>         node.setCanExit(true);
>         forNode(node.child1()).filter(SpecString);
>Index: Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp	(working copy)
>@@ -1734,7 +1734,19 @@
>             set(resultOperand, charCode);
>         return true;
>     }
>+    case FromCharCodeIntrinsic: {
>+        if (argumentCountIncludingThis != 2)
>+            return false;
> 
>+        int indexOperand = registerOffset + argumentToOperand(1);
>+        NodeIndex charCode = addToGraph(StringFromCharCode, getToInt32(indexOperand));
>+
>+        if (usesResult)
>+            set(resultOperand, charCode);
>+
>+        return true;
>+    }
>+
>     case RegExpExecIntrinsic: {
>         if (argumentCountIncludingThis != 2)
>             return false;
>Index: Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
>===================================================================
>--- Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp	(revision 137458)
>+++ Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp	(working copy)
>@@ -640,6 +640,12 @@
>             break;
>         }
>         
>+        case StringFromCharCode: {
>+            changed |= setPrediction(SpecString);
>+            changed |= m_graph[node.child1()].mergeFlags(NodeUsedAsNumber | NodeUsedAsInt);
>+            break;
>+        }
>+
>         case StringCharAt: {
>             changed |= setPrediction(SpecString);
>             changed |= m_graph[node.child1()].mergeFlags(NodeUsedAsValue);

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list