Lines Matching refs:Node
23 #include "src/compiler/node-matchers.h"
61 void MergeControlToEnd(JSGraph* jsgraph, Node* node) {
64 NodeProperties::MergeControlToEnd(g, jsgraph->common(), node);
66 g->SetEnd(g->NewNode(jsgraph->common()->End(1), node));
108 // Add a check that traps if {node} is equal to {val}.
109 Node* TrapIfEq32(TrapReason reason, Node* node, int32_t val) {
110 Int32Matcher m(node);
113 AddTrapIfFalse(reason, node);
116 graph()->NewNode(jsgraph()->machine()->Word32Equal(), node,
122 // Add a check that traps if {node} is zero.
123 Node* ZeroCheck32(TrapReason reason, Node* node) {
124 return TrapIfEq32(reason, node, 0);
127 // Add a check that traps if {node} is equal to {val}.
128 Node* TrapIfEq64(TrapReason reason, Node* node, int64_t val) {
129 Int64Matcher m(node);
132 graph()->NewNode(jsgraph()->machine()->Word64Equal(), node,
137 // Add a check that traps if {node} is zero.
138 Node* ZeroCheck64(TrapReason reason, Node* node) {
139 return TrapIfEq64(reason, node, 0);
143 void AddTrapIfTrue(TrapReason reason, Node* cond) {
148 void AddTrapIfFalse(TrapReason reason, Node* cond) {
153 void AddTrapIf(TrapReason reason, Node* cond, bool iftrue) {
154 Node** effect_ptr = builder_->effect_;
155 Node** control_ptr = builder_->control_;
156 Node* before = *effect_ptr;
158 Node* branch = graph()->NewNode(common()->Branch(hint), cond, *control_ptr);
159 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
160 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
172 Node* traps_[kTrapCount];
173 Node* effects_[kTrapCount];
190 Node* exception = builder_->String(kTrapMessages[reason]);
191 Node* end;
192 Node** control_ptr = builder_->control_;
193 Node** effect_ptr = builder_->effect_;
207 Node* inputs[] = {
217 Node* node = graph()->NewNode(
219 *control_ptr = node;
220 *effect_ptr = node;
224 Node* thrw =
230 Node* ret_value;
280 Node* WasmGraphBuilder::Error() { return jsgraph()->Dead(); }
283 Node* WasmGraphBuilder::Start(unsigned params) {
284 Node* start = graph()->NewNode(jsgraph()->common()->Start(params));
290 Node* WasmGraphBuilder::Param(unsigned index, wasm::LocalType type) {
296 Node* WasmGraphBuilder::Loop(Node* entry) {
301 Node* WasmGraphBuilder::Terminate(Node* effect, Node* control) {
302 Node* terminate =
309 unsigned WasmGraphBuilder::InputCount(Node* node) {
310 return static_cast<unsigned>(node->InputCount());
314 bool WasmGraphBuilder::IsPhiWithMerge(Node* phi, Node* merge) {
320 void WasmGraphBuilder::AppendToMerge(Node* merge, Node* from) {
329 void WasmGraphBuilder::AppendToPhi(Node* merge, Node* phi, Node* from) {
339 Node* WasmGraphBuilder::Merge(unsigned count, Node** controls) {
344 Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals,
345 Node* control) {
347 Node** buf = Realloc(vals, count);
355 Node* WasmGraphBuilder::EffectPhi(unsigned count, Node** effects,
356 Node* control) {
358 Node** buf = Realloc(effects, count);
366 Node* WasmGraphBuilder::Int32Constant(int32_t value) {
371 Node* WasmGraphBuilder::Int64Constant(int64_t value) {
376 Node* WasmGraphBuilder::Binop(wasm::WasmOpcode opcode, Node* left,
377 Node* right) {
392 Node* before = *control_;
393 Node* denom_is_m1;
394 Node* denom_is_not_m1;
418 Node* rem = graph()->NewNode(m->Int32Mod(), left, right, d.if_false);
492 Node* before = *control_;
493 Node* denom_is_m1;
494 Node* denom_is_not_m1;
519 Node* rem = graph()->NewNode(m->Int64Mod(), left, right, d.if_false);
662 Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input) {
838 Node* trunc = graph()->NewNode(m->TryTruncateFloat32ToInt64(), input);
839 Node* result =
841 Node* overflow =
847 Node* trunc = graph()->NewNode(m->TryTruncateFloat64ToInt64(), input);
848 Node* result =
850 Node* overflow =
856 Node* trunc = graph()->NewNode(m->TryTruncateFloat32ToUint64(), input);
857 Node* result =
859 Node* overflow =
865 Node* trunc = graph()->NewNode(m->TryTruncateFloat64ToUint64(), input);
866 Node* result =
868 Node* overflow =
906 Node* WasmGraphBuilder::Float32Constant(float value) {
911 Node* WasmGraphBuilder::Float64Constant(double value) {
916 Node* WasmGraphBuilder::Constant(Handle<Object> value) {
921 Node* WasmGraphBuilder::Branch(Node* cond, Node** true_node,
922 Node** false_node) {
925 Node* branch =
933 Node* WasmGraphBuilder::Switch(unsigned count, Node* key) {
938 Node* WasmGraphBuilder::IfValue(int32_t value, Node* sw) {
944 Node* WasmGraphBuilder::IfDefault(Node* sw) {
950 Node* WasmGraphBuilder::Return(unsigned count, Node** vals) {
960 Node** buf = Realloc(vals, count);
964 Node* ret = graph()->NewNode(jsgraph()->common()->Return(), count + 2, vals);
971 Node* WasmGraphBuilder::ReturnVoid() { return Return(0, Buffer(0)); }
974 Node* WasmGraphBuilder::Unreachable() {
980 Node* WasmGraphBuilder::BuildF32Neg(Node* input) {
981 Node* result =
990 Node* WasmGraphBuilder::BuildF64Neg(Node* input) {
992 Node* result =
1001 Node* old_high_word = graph()->NewNode(m->Float64ExtractHighWord32(), input);
1002 Node* new_high_word = Binop(wasm::kExprI32Xor, old_high_word,
1010 Node* WasmGraphBuilder::BuildF32CopySign(Node* left, Node* right) {
1011 Node* result = Unop(
1023 Node* WasmGraphBuilder::BuildF64CopySign(Node* left, Node* right) {
1025 Node* result = Unop(
1037 Node* high_word_left = graph()->NewNode(m->Float64ExtractHighWord32(), left);
1038 Node* high_word_right =
1041 Node* new_high_word =
1052 Node* WasmGraphBuilder::BuildF32Min(Node* left, Node* right) {
1069 Node* WasmGraphBuilder::BuildF32Max(Node* left, Node* right) {
1086 Node* WasmGraphBuilder::BuildF64Min(Node* left, Node* right) {
1103 Node* WasmGraphBuilder::BuildF64Max(Node* left, Node* right) {
1120 Node* WasmGraphBuilder::BuildI32SConvertF32(Node* input) {
1123 Node* trunc = Unop(wasm::kExprF32Trunc, input);
1125 Node* f64_trunc = graph()->NewNode(m->ChangeFloat32ToFloat64(), trunc);
1126 Node* result = graph()->NewNode(m->ChangeFloat64ToInt32(), f64_trunc);
1130 Node* check = Unop(wasm::kExprF64SConvertI32, result);
1131 Node* overflow = Binop(wasm::kExprF64Ne, f64_trunc, check);
1138 Node* WasmGraphBuilder::BuildI32SConvertF64(Node* input) {
1141 Node* trunc = Unop(wasm::kExprF64Trunc, input);
1142 Node* result = graph()->NewNode(m->ChangeFloat64ToInt32(), trunc);
1146 Node* check = Unop(wasm::kExprF64SConvertI32, result);
1147 Node* overflow = Binop(wasm::kExprF64Ne, trunc, check);
1154 Node* WasmGraphBuilder::BuildI32UConvertF32(Node* input) {
1157 Node* trunc = Unop(wasm::kExprF32Trunc, input);
1159 Node* f64_trunc = graph()->NewNode(m->ChangeFloat32ToFloat64(), trunc);
1160 Node* result = graph()->NewNode(m->ChangeFloat64ToUint32(), f64_trunc);
1164 Node* check = Unop(wasm::kExprF64UConvertI32, result);
1165 Node* overflow = Binop(wasm::kExprF64Ne, f64_trunc, check);
1172 Node* WasmGraphBuilder::BuildI32UConvertF64(Node* input) {
1175 Node* trunc = Unop(wasm::kExprF64Trunc, input);
1176 Node* result = graph()->NewNode(m->ChangeFloat64ToUint32(), trunc);
1180 Node* check = Unop(wasm::kExprF64UConvertI32, result);
1181 Node* overflow = Binop(wasm::kExprF64Ne, trunc, check);
1188 Node* WasmGraphBuilder::BuildI32Ctz(Node* input) {
1197 Node* result =
1221 Node* WasmGraphBuilder::BuildI64Ctz(Node* input) {
1231 Node* result =
1259 Node* WasmGraphBuilder::BuildI32Popcnt(Node* input) {
1267 Node* result = Binop(
1306 Node* WasmGraphBuilder::BuildI64Popcnt(Node* input) {
1317 Node* result =
1364 Node* WasmGraphBuilder::BuildWasmCall(wasm::FunctionSig* sig, Node** args) {
1378 Node* call = graph()->NewNode(op, static_cast<int>(count), args);
1385 Node* WasmGraphBuilder::CallDirect(uint32_t index, Node** args) {
1396 Node* WasmGraphBuilder::CallIndirect(uint32_t index, Node** args) {
1402 Node* key = args[0];
1403 Node* table = FunctionTable();
1408 Node* size = Int32Constant(static_cast<int>(table_size));
1409 Node* in_bounds = graph()->NewNode(machine->Uint32LessThan(), key, size);
1419 Node* load_sig = graph()->NewNode(
1426 Node* sig_match = graph()->NewNode(machine->WordEqual(), load_sig,
1433 Node* load_code = graph()->NewNode(
1447 Node* WasmGraphBuilder::ToJS(Node* node, Node* context, wasm::LocalType type) {
1451 return graph()->NewNode(simplified.ChangeInt32ToTagged(), node);
1455 node =
1456 graph()->NewNode(jsgraph()->machine()->TruncateInt64ToInt32(), node);
1457 return graph()->NewNode(simplified.ChangeInt32ToTagged(), node);
1459 node = graph()->NewNode(jsgraph()->machine()->ChangeFloat32ToFloat64(),
1460 node);
1461 return graph()->NewNode(simplified.ChangeFloat64ToTagged(), node);
1463 return graph()->NewNode(simplified.ChangeFloat64ToTagged(), node);
1473 Node* WasmGraphBuilder::FromJS(Node* node, Node* context,
1476 Node* num =
1477 graph()->NewNode(jsgraph()->javascript()->ToNumber(), node, context,
1517 Node* WasmGraphBuilder::Invert(Node* node) {
1518 return Unop(wasm::kExprBoolNot, node);
1526 Node** args = Buffer(count);
1529 Node* start = Start(params + 3);
1533 Node* context = graph()->NewNode(
1541 Node* param = graph()->NewNode(jsgraph()->common()->Parameter(i), start);
1550 Node* call = graph()->NewNode(jsgraph()->common()->Call(desc), count, args);
1551 Node* jsval =
1554 Node* ret =
1569 Node* start = Start(wasm_count + 3);
1573 Node* context = Constant(Handle<Context>(function->context(), isolate));
1574 Node** args = Buffer(wasm_count + 7);
1606 Node* param = graph()->NewNode(jsgraph()->common()->Parameter(i), start);
1621 Node* call = graph()->NewNode(jsgraph()->common()->Call(desc), pos, args);
1624 Node* val =
1627 Node* ret = graph()->NewNode(jsgraph()->common()->Return(), val, call, start);
1633 Node* WasmGraphBuilder::MemBuffer(uint32_t offset) {
1644 Node* WasmGraphBuilder::MemSize(uint32_t offset) {
1655 Node* WasmGraphBuilder::FunctionTable() {
1664 Node* WasmGraphBuilder::LoadGlobal(uint32_t index) {
1666 Node* addr = jsgraph()->IntPtrConstant(
1669 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), *effect_,
1671 *effect_ = node;
1672 return node;
1676 Node* WasmGraphBuilder::StoreGlobal(uint32_t index, Node* val) {
1678 Node* addr = jsgraph()->IntPtrConstant(
1682 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), val,
1684 *effect_ = node;
1685 return node;
1689 void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index,
1695 Node* cond;
1713 Node* WasmGraphBuilder::LoadMem(wasm::LocalType type, MachineType memtype,
1714 Node* index, uint32_t offset) {
1715 Node* load;
1749 Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index,
1750 uint32_t offset, Node* val) {
1751 Node* store;
1772 void WasmGraphBuilder::PrintDebugName(Node* node) {
1773 PrintF("#%d:%s", node->id(), node->op()->mnemonic());
1777 Node* WasmGraphBuilder::String(const char* string) {
1814 Node* control = nullptr;
1815 Node* effect = nullptr;
1894 Node* control = nullptr;
1895 Node* effect = nullptr;