Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: src/compiler/effect-control-linearizer.cc

Issue 2517913002: [turbofan] Introduce LoadFunctionPrototype simplified operator. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/effect-control-linearizer.cc
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc
index b0158525723ee21ea7de1f8d0345a7ea5b820099..70b297da0d2a1377c400b910eca7672f8ad80cbe 100644
--- a/src/compiler/effect-control-linearizer.cc
+++ b/src/compiler/effect-control-linearizer.cc
@@ -784,6 +784,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kStoreTypedElement:
state = LowerStoreTypedElement(node, *effect, *control);
break;
+ case IrOpcode::kLoadFunctionPrototype:
+ state = LowerLoadFunctionPrototype(node, *effect, *control);
+ break;
case IrOpcode::kFloat64RoundUp:
state = LowerFloat64RoundUp(node, *effect, *control);
break;
@@ -3274,6 +3277,50 @@ EffectControlLinearizer::LowerStoreTypedElement(Node* node, Node* effect,
}
EffectControlLinearizer::ValueEffectControl
+EffectControlLinearizer::LowerLoadFunctionPrototype(Node* node, Node* effect,
+ Node* control) {
+ Node* function = node->InputAt(0);
+
+ // Load the {JSFunction::prototype-or-initial-map} field.
+ Node* function_prototype_or_initial_map = effect =
+ graph()->NewNode(simplified()->LoadField(
+ AccessBuilder::ForJSFunctionPrototypeOrInitialMap()),
+ function, effect, control);
+ Node* function_prototype_or_initial_map_map = effect =
+ graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
+ function, effect, control);
+
+ // Check if the {function} has an initial map.
+ Node* check0 = graph()->NewNode(
+ machine()->WordEqual(), function_prototype_or_initial_map_map,
+ jsgraph()->HeapConstant(factory()->meta_map()));
+ Node* branch0 =
+ graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control);
+
+ Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
+ Node* etrue0 = effect;
+ Node* vtrue0;
+ {
+ // Load the "prototype" from the initial map.
+ vtrue0 = etrue0 = graph()->NewNode(
+ simplified()->LoadField(AccessBuilder::ForMapPrototype()),
+ function_prototype_or_initial_map, etrue0, if_true0);
+ }
+
+ Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
+ Node* efalse0 = effect;
+ Node* vfalse0 = function_prototype_or_initial_map;
+
+ control = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
+ effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control);
+ Node* value =
+ graph()->NewNode(common()->Phi(MachineRepresentation::kTaggedPointer, 2),
+ vtrue0, vfalse0, control);
+
+ return ValueEffectControl(value, effect, control);
+}
+
+EffectControlLinearizer::ValueEffectControl
EffectControlLinearizer::LowerFloat64RoundUp(Node* node, Node* effect,
Node* control) {
// Nothing to be done if a fast hardware instruction is available.
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698