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

Unified Diff: src/runtime/runtime-internal.cc

Issue 1146963002: Add %GetCallerJSFunction intrinsic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merge with ToT Created 5 years, 7 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
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

Powered by Google App Engine
This is Rietveld 408576698