19 if (reduction.Changed()) {
36 if (
node_->opcode() != IrOpcode::kJSCallFunction)
return false;
38 if (!m.HasValue() || !m.Value().handle()->IsJSFunction())
return false;
40 return function->shared()->HasBuiltinFunctionId();
48 return function->shared()->builtin_function_id();
99 Reduction JSBuiltinReducer::ReduceMathAbs(Node* node) {
103 return Replace(r.
left());
107 Node* value = r.
left();
108 Node*
zero = jsgraph()->ZeroConstant();
109 Node* control = graph()->start();
110 Node* tag = graph()->NewNode(simplified()->NumberLessThan(),
zero, value);
112 Node* branch = graph()->NewNode(common()->Branch(), tag, control);
113 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
114 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
115 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
117 Node* neg = graph()->NewNode(simplified()->NumberSubtract(),
zero, value);
118 value = graph()->NewNode(common()->Phi(
kMachNone, 2), value, neg, merge);
119 return Replace(value);
126 Reduction JSBuiltinReducer::ReduceMathSqrt(Node* node) {
127 JSCallReduction r(node);
130 Node* value = graph()->NewNode(machine()->Float64Sqrt(), r.
left());
131 return Replace(value);
138 Reduction JSBuiltinReducer::ReduceMathMax(Node* node) {
139 JSCallReduction r(node);
146 return Replace(r.
left());
153 Node* control = graph()->start();
154 Node* tag = graph()->NewNode(simplified()->NumberLessThan(), value, p);
156 Node* branch = graph()->NewNode(common()->Branch(), tag, control);
157 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
158 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
159 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
161 value = graph()->NewNode(common()->Phi(
kMachNone, 2), p, value, merge);
163 return Replace(value);
170 Reduction JSBuiltinReducer::ReduceMathImul(Node* node) {
171 JSCallReduction r(node);
174 Node* value = graph()->NewNode(machine()->Int32Mul(), r.
left(), r.
right());
175 return Replace(value);
182 Reduction JSBuiltinReducer::ReduceMathFround(Node* node) {
183 JSCallReduction r(node);
187 graph()->NewNode(machine()->TruncateFloat64ToFloat32(), r.
left());
188 return Replace(value);
194 Reduction JSBuiltinReducer::Reduce(Node* node) {
195 JSCallReduction r(node);
static Handle< T > cast(Handle< S > that)
bool InputsMatchTwo(Type *t1, Type *t2)
bool HasBuiltinFunctionId()
bool InputsMatchAll(Type *t)
BuiltinFunctionId GetBuiltinFunctionId()
bool InputsMatchOne(Type *t1)
JSCallReduction(Node *node)
Node * GetJSCallInput(int index)
static void ReplaceWithValue(Node *node, Node *value, Node *effect=NULL)
static Node * GetValueInput(Node *node, int index)
static Bounds GetBounds(Node *node)
static int GetValueInputCount(const Operator *op)
static Reduction NoChange()
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
static Reduction ReplaceWithPureReduction(Node *node, Reduction reduction)
Debugger support for the V8 JavaScript engine.