Chromium Code Reviews| 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..39b3f4d85a29b24d3809d2b466aa7d66830b8a89 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,35 @@ Reduction JSIntrinsicLowering::ReduceGetTypeFeedbackVector(Node* node) { |
| } |
| +Reduction JSIntrinsicLowering::ReduceGetCallerJSFunction(Node* node) { |
| + Node* effect = NodeProperties::GetEffectInput(node); |
| + Node* control = NodeProperties::GetControlInput(node); |
| + |
| + if (FLAG_turbo_deoptimization) { |
|
Michael Starzinger
2015/06/05 11:21:56
This flag no longer exists, we can just perform th
danno
2015/06/05 11:49:59
Done.
|
| + 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): If FLAG_turbo_deoptimization is false then this intrinsic |
| + // always returns the JSFunction from the caller's frame, regardless of |
| + // inlining depth, which isn't correct. This implementation also 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. |
|
Michael Starzinger
2015/06/05 11:21:56
nit: The TODO now no longer applies, correct?
danno
2015/06/05 11:49:59
Sort of. The inlining ordering dependency still ex
|
| + 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); |