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

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: Tweaks 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..1c1495ca1f9eb92f96e92ca03dc9113f8f718c76 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -416,5 +416,19 @@ RUNTIME_FUNCTION(Runtime_GetTypeFeedbackVector) {
CONVERT_ARG_CHECKED(JSFunction, function, 0);
return function->shared()->feedback_vector();
}
+
+
+RUNTIME_FUNCTION(Runtime_GetCallerJSFunction) {
+ SealHandleScope shs(isolate);
+ StackFrameIterator it(isolate);
+ if (it.frame()->type() != StackFrame::STUB) {
Michael Starzinger 2015/06/05 11:21:56 nit: Let's use RUNTIME_ASSERT(it.frame()->type() =
danno 2015/06/05 11:49:59 Done.
+ return isolate->ThrowIllegalOperation();
+ }
+ it.Advance();
+ if (it.frame()->type() != StackFrame::JAVA_SCRIPT) {
Michael Starzinger 2015/06/05 11:21:56 nit: Let's use RUNTIME_ASSERT(it.frame()->type() =
danno 2015/06/05 11:49:59 Done.
+ return isolate->ThrowIllegalOperation();
+ }
+ return JavaScriptFrame::cast(it.frame())->function();
+}
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698