Lines Matching defs:node
12 #include "src/compiler/node-matchers.h"
13 #include "src/compiler/node-properties.h"
20 Reduction JSContextSpecialization::Reduce(Node* node) {
21 switch (node->opcode()) {
23 return ReduceParameter(node);
25 return ReduceJSLoadContext(node);
27 return ReduceJSStoreContext(node);
29 return ReduceJSGetImportMeta(node);
36 Reduction JSContextSpecialization::ReduceParameter(Node* node) {
37 DCHECK_EQ(IrOpcode::kParameter, node->opcode());
38 int const index = ParameterIndexOf(node->op());
40 // Constant-fold the function parameter {node}.
50 Reduction JSContextSpecialization::SimplifyJSLoadContext(Node* node,
53 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
54 const ContextAccess& access = ContextAccessOf(node->op());
58 new_context == NodeProperties::GetContextInput(node)) {
64 NodeProperties::ReplaceContextInput(node, new_context);
65 NodeProperties::ChangeOp(node, op);
66 return Changed(node);
69 Reduction JSContextSpecialization::SimplifyJSStoreContext(Node* node,
72 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
73 const ContextAccess& access = ContextAccessOf(node->op());
77 new_context == NodeProperties::GetContextInput(node)) {
83 NodeProperties::ReplaceContextInput(node, new_context);
84 NodeProperties::ChangeOp(node, op);
85 return Changed(node);
90 bool IsContextParameter(Node* node) {
91 DCHECK_EQ(IrOpcode::kParameter, node->opcode());
92 return ParameterIndexOf(node->op()) ==
93 StartNode{NodeProperties::GetValueInput(node, 0)}
97 // Given a context {node} and the {distance} from that context to the target
102 JSHeapBroker* broker, Node* node, size_t* distance,
104 switch (node->opcode()) {
115 MakeRefAssumeMemoryFence(broker, HeapConstantOf(node->op()));
121 if (maybe_outer.To(&outer) && IsContextParameter(node) &&
136 Reduction JSContextSpecialization::ReduceJSLoadContext(Node* node) {
137 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
139 const ContextAccess& access = ContextAccessOf(node->op());
143 Node* context = NodeProperties::GetOuterContext(node, &depth);
149 // the load by folding-in the outer context node.
150 return SimplifyJSLoadContext(node, context, depth);
158 return SimplifyJSLoadContext(node, jsgraph()->Constant(concrete), depth);
164 return SimplifyJSLoadContext(node, jsgraph()->Constant(concrete), depth);
175 return SimplifyJSLoadContext(node, jsgraph()->Constant(concrete), depth);
187 return SimplifyJSLoadContext(node, jsgraph()->Constant(concrete), depth);
193 ReplaceWithValue(node, constant);
198 Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) {
199 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
201 const ContextAccess& access = ContextAccessOf(node->op());
205 // or hit a node that does not have a CreateXYZContext operator.
206 Node* context = NodeProperties::GetOuterContext(node, &depth);
212 // the load by folding-in the outer context node.
213 return SimplifyJSStoreContext(node, context, depth);
221 return SimplifyJSStoreContext(node, jsgraph()->Constant(concrete), depth);
224 return SimplifyJSStoreContext(node, jsgraph()->Constant(concrete), depth);
227 base::Optional<ContextRef> GetModuleContext(JSHeapBroker* broker, Node* node,
230 Node* context = NodeProperties::GetOuterContext(node, &depth);
272 Reduction JSContextSpecialization::ReduceJSGetImportMeta(Node* node) {
274 GetModuleContext(broker(), node, outer());
291 ReplaceWithValue(node, import_meta_const);