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

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1146963002: Add %GetCallerJSFunction intrinsic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 6 months 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/js-intrinsic-lowering.h ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698