NodeIndex value;
};
+struct MethodCheckData {
+ // It is safe to refer to these directly because they are shadowed by
+ // the old JIT's CodeBlock's MethodCallLinkInfo.
+ Structure* structure;
+ Structure* prototypeStructure;
+ JSObject* function;
+ JSObject* prototype;
+
+ bool operator==(const MethodCheckData& other) const
+ {
+ if (structure != other.structure)
+ return false;
+ if (prototypeStructure != other.prototypeStructure)
+ return false;
+ if (function != other.function)
+ return false;
+ if (prototype != other.prototype)
+ return false;
+ return true;
+ }
+
+ bool operator!=(const MethodCheckData& other) const
+ {
+ return !(*this == other);
+ }
+};
+
typedef Vector <BlockIndex, 2> PredecessorList;
struct BasicBlock {
return m_predictions.getGlobalVarPrediction(varNumber);
}
+ PredictedType getMethodCheckPrediction(Node& node)
+ {
+ return makePrediction(predictionFromCell(m_methodCheckData[node.methodCheckDataIndex()].function), StrongPrediction);
+ }
+
PredictedType getPrediction(Node& node)
{
Node* nodePtr = &node;
case Call:
case Construct:
return nodePtr->getPrediction();
+ case CheckMethod:
+ return getMethodCheckPrediction(*nodePtr);
default:
return PredictNone;
}
// Helper methods to check nodes for constants.
bool isConstant(NodeIndex nodeIndex)
{
- return at(nodeIndex).isConstant();
+ return at(nodeIndex).hasConstant();
}
bool isJSConstant(NodeIndex nodeIndex)
{
- return at(nodeIndex).isConstant();
+ return at(nodeIndex).hasConstant();
}
bool isInt32Constant(CodeBlock* codeBlock, NodeIndex nodeIndex)
{
{
return at(nodeIndex).isBooleanConstant(codeBlock);
}
+ bool isFunctionConstant(CodeBlock* codeBlock, JSGlobalData& globalData, NodeIndex nodeIndex)
+ {
+ if (!isJSConstant(nodeIndex))
+ return false;
+ if (!getJSFunction(globalData, valueOfJSConstant(codeBlock, nodeIndex)))
+ return false;
+ return true;
+ }
// Helper methods get constant values from nodes.
JSValue valueOfJSConstant(CodeBlock* codeBlock, NodeIndex nodeIndex)
{
- return at(nodeIndex).valueOfJSConstant(codeBlock);
+ if (at(nodeIndex).hasMethodCheckData())
+ return JSValue(m_methodCheckData[at(nodeIndex).methodCheckDataIndex()].function);
+ return valueOfJSConstantNode(codeBlock, nodeIndex);
}
int32_t valueOfInt32Constant(CodeBlock* codeBlock, NodeIndex nodeIndex)
{
- return at(nodeIndex).valueOfInt32Constant(codeBlock);
+ return valueOfJSConstantNode(codeBlock, nodeIndex).asInt32();
}
double valueOfNumberConstant(CodeBlock* codeBlock, NodeIndex nodeIndex)
{
- return at(nodeIndex).valueOfNumberConstant(codeBlock);
+ return valueOfJSConstantNode(codeBlock, nodeIndex).uncheckedGetNumber();
}
bool valueOfBooleanConstant(CodeBlock* codeBlock, NodeIndex nodeIndex)
{
- return at(nodeIndex).valueOfBooleanConstant(codeBlock);
+ return valueOfJSConstantNode(codeBlock, nodeIndex).getBoolean();
+ }
+ JSFunction* valueOfFunctionConstant(CodeBlock* codeBlock, JSGlobalData& globalData, NodeIndex nodeIndex)
+ {
+ JSCell* function = getJSFunction(globalData, valueOfJSConstant(codeBlock, nodeIndex));
+ ASSERT(function);
+ return asFunction(function);
}
#ifndef NDEBUG
Vector< OwnPtr<BasicBlock> , 8> m_blocks;
Vector<NodeIndex, 16> m_varArgChildren;
+ Vector<MethodCheckData> m_methodCheckData;
+ unsigned m_preservedVars;
+ unsigned m_parameterSlots;
private:
+
+ JSValue valueOfJSConstantNode(CodeBlock* codeBlock, NodeIndex nodeIndex)
+ {
+ return codeBlock->constantRegister(FirstConstantRegisterIndex + at(nodeIndex).constantNumber()).get();
+ }
// When a node's refCount goes from 0 to 1, it must (logically) recursively ref all of its children, and vice versa.
void refChildren(NodeIndex);