Changeset 120974 in webkit for trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
- Timestamp:
- Jun 21, 2012, 3:55:42 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r120897 r120974 29 29 #if ENABLE(DFG_JIT) 30 30 31 #include "ArrayConstructor.h" 31 32 #include "CallLinkStatus.h" 32 33 #include "CodeBlock.h" … … 96 97 // Handle intrinsic functions. Return true if it succeeded, false if we need to plant a call. 97 98 bool handleIntrinsic(bool usesResult, int resultOperand, Intrinsic, int registerOffset, int argumentCountIncludingThis, SpeculatedType prediction); 99 bool handleConstantInternalFunction(bool usesResult, int resultOperand, InternalFunction*, int registerOffset, int argumentCountIncludingThis, SpeculatedType prediction, CodeSpecializationKind); 98 100 void handleGetByOffset( 99 101 int destinationOperand, SpeculatedType, NodeIndex base, unsigned identifierNumber, … … 1129 1131 1130 1132 NodeIndex callTarget = get(currentInstruction[1].u.operand); 1131 enum { ConstantFunction, LinkedFunction, UnknownFunction } callType; 1133 enum { 1134 ConstantFunction, 1135 ConstantInternalFunction, 1136 LinkedFunction, 1137 UnknownFunction 1138 } callType; 1132 1139 1133 1140 CallLinkStatus callLinkStatus = CallLinkStatus::computeFor( … … 1151 1158 m_graph.valueOfFunctionConstant(callTarget), 1152 1159 m_graph.valueOfFunctionConstant(callTarget)->executable()); 1160 #endif 1161 } else if (m_graph.isInternalFunctionConstant(callTarget)) { 1162 callType = ConstantInternalFunction; 1163 #if DFG_ENABLE(DEBUG_VERBOSE) 1164 dataLog("Call at [@%lu, bc#%u] has an internal function constant: %p.\n", 1165 m_graph.size(), m_currentIndex, 1166 m_graph.valueOfInternalFunctionConstant(callTarget)); 1153 1167 #endif 1154 1168 } else if (callLinkStatus.isSet() && !callLinkStatus.couldTakeSlowPath() … … 1184 1198 nextOffset += OPCODE_LENGTH(op_call_put_result); 1185 1199 } 1200 1201 if (callType == ConstantInternalFunction) { 1202 if (handleConstantInternalFunction(usesResult, resultOperand, m_graph.valueOfInternalFunctionConstant(callTarget), registerOffset, argumentCountIncludingThis, prediction, kind)) 1203 return; 1204 1205 // Can only handle this using the generic call handler. 1206 addCall(interpreter, currentInstruction, op); 1207 return; 1208 } 1209 1186 1210 JSFunction* expectedFunction; 1187 1211 Intrinsic intrinsic; … … 1215 1239 return; 1216 1240 } 1217 1241 1218 1242 addCall(interpreter, currentInstruction, op); 1219 1243 } … … 1570 1594 return false; 1571 1595 } 1596 } 1597 1598 bool ByteCodeParser::handleConstantInternalFunction( 1599 bool usesResult, int resultOperand, InternalFunction* function, int registerOffset, 1600 int argumentCountIncludingThis, SpeculatedType prediction, CodeSpecializationKind kind) 1601 { 1602 // If we ever find that we have a lot of internal functions that we specialize for, 1603 // then we should probably have some sort of hashtable dispatch, or maybe even 1604 // dispatch straight through the MethodTable of the InternalFunction. But for now, 1605 // it seems that this case is hit infrequently enough, and the number of functions 1606 // we know about is small enough, that having just a linear cascade of if statements 1607 // is good enough. 1608 1609 UNUSED_PARAM(registerOffset); // Remove this once we do more things to the arguments. 1610 UNUSED_PARAM(prediction); // Remove this once we do more things. 1611 UNUSED_PARAM(kind); // Remove this once we do more things. 1612 1613 if (function->classInfo() == &ArrayConstructor::s_info) { 1614 // We could handle this but don't for now. 1615 if (argumentCountIncludingThis != 1) 1616 return false; 1617 1618 setIntrinsicResult( 1619 usesResult, resultOperand, 1620 addToGraph(Node::VarArg, NewArray, OpInfo(0), OpInfo(0))); 1621 return true; 1622 } 1623 1624 return false; 1572 1625 } 1573 1626
Note:
See TracChangeset
for help on using the changeset viewer.