Index: src/runtime/runtime-internal.cc |
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc |
index e0e583e4021122d75999f9c1de54b5c08da14c00..afc7df77d171af248ba03d5baf5bc7bf84377e9c 100644 |
--- a/src/runtime/runtime-internal.cc |
+++ b/src/runtime/runtime-internal.cc |
@@ -416,5 +416,26 @@ RUNTIME_FUNCTION(Runtime_GetTypeFeedbackVector) { |
CONVERT_ARG_CHECKED(JSFunction, function, 0); |
return function->shared()->feedback_vector(); |
} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_GetCallerJSFunction) { |
+ SealHandleScope shs(isolate); |
+ DCHECK(args.length() == 0); |
+ JavaScriptFrameIterator it(isolate); |
+ int frames_to_count = 2; |
+ int function_index = 0; |
+ List<JSFunction*> functions(FLAG_max_inlining_levels + 1); |
+ while (frames_to_count-- != 0) { |
+ if (function_index == 0) { |
+ functions.Rewind(0); |
+ it.frame()->GetFunctions(&functions); |
+ it.Advance(); |
+ function_index = functions.length() - 1; |
+ } else { |
+ function_index--; |
+ } |
+ } |
+ return functions[function_index]; |
+} |
} // namespace internal |
} // namespace v8 |