Index: src/compiler/js-intrinsic-lowering.cc |
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc |
index 2a3bdf8fa85bfe3dd54589852432fdefce70d93a..b679a75fab7ab2a188e27c6b1f001af9f5324aaf 100644 |
--- a/src/compiler/js-intrinsic-lowering.cc |
+++ b/src/compiler/js-intrinsic-lowering.cc |
@@ -84,6 +84,8 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) { |
return ReduceFixedArraySet(node); |
case Runtime::kInlineGetTypeFeedbackVector: |
return ReduceGetTypeFeedbackVector(node); |
+ case Runtime::kInlineGetCallerJSFunction: |
+ return ReduceGetCallerJSFunction(node); |
default: |
break; |
} |
@@ -455,6 +457,31 @@ Reduction JSIntrinsicLowering::ReduceGetTypeFeedbackVector(Node* node) { |
} |
+Reduction JSIntrinsicLowering::ReduceGetCallerJSFunction(Node* node) { |
+ Node* effect = NodeProperties::GetEffectInput(node); |
+ Node* control = NodeProperties::GetControlInput(node); |
+ |
+ Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0); |
+ Node* outer_frame = frame_state->InputAt(kFrameStateOuterStateInput); |
+ if (outer_frame->opcode() == IrOpcode::kFrameState) { |
+ // Use the runtime implementation to throw the appropriate error if the |
+ // containing function is inlined. |
+ return NoChange(); |
+ } |
+ |
+ // TODO(danno): This implementation forces intrinsic lowering to happen after |
+ // inlining, which is fine for now, but eventually the frame-querying logic |
+ // probably should go later, e.g. in instruction selection, so that there is |
+ // no phase-ordering dependency. |
+ FieldAccess access = AccessBuilder::ForFrameCallerFramePtr(); |
+ Node* fp = graph()->NewNode(machine()->LoadFramePointer()); |
+ Node* next_fp = |
+ graph()->NewNode(simplified()->LoadField(access), fp, effect, control); |
+ return Change(node, simplified()->LoadField(AccessBuilder::ForFrameMarker()), |
+ next_fp, effect, control); |
+} |
+ |
+ |
Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
Node* b) { |
node->set_op(op); |