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

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

Issue 1060583008: Port CallSite methods to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 8 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/runtime/runtime-debug.cc ('k') | test/mjsunit/compiler/regress-stacktrace.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index a03087bd776387a6f37c5330ec59c02753a48089..6843c1160cea1950e8efd6410c68415697dcc706 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -322,6 +322,47 @@ RUNTIME_FUNCTION(Runtime_FormatMessageString) {
}
+#define CALLSITE_GET(NAME, RETURN) \
+ RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \
+ HandleScope scope(isolate); \
+ DCHECK(args.length() == 3); \
+ CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); \
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 1); \
+ CONVERT_INT32_ARG_CHECKED(pos, 2); \
+ Handle<String> result; \
+ CallSite call_site(receiver, fun, pos); \
+ return RETURN(call_site.NAME(isolate), isolate); \
+ }
+
+static inline Object* ReturnDereferencedHandle(Handle<Object> obj,
+ Isolate* isolate) {
+ return *obj;
+}
+
+
+static inline Object* ReturnPositiveSmiOrNull(int value, Isolate* isolate) {
+ if (value >= 0) return Smi::FromInt(value);
+ return isolate->heap()->null_value();
+}
+
+
+static inline Object* ReturnBoolean(bool value, Isolate* isolate) {
+ return isolate->heap()->ToBoolean(value);
+}
+
+
+CALLSITE_GET(GetFileName, ReturnDereferencedHandle)
+CALLSITE_GET(GetFunctionName, ReturnDereferencedHandle)
+CALLSITE_GET(GetScriptNameOrSourceUrl, ReturnDereferencedHandle)
+CALLSITE_GET(GetLineNumber, ReturnPositiveSmiOrNull)
+CALLSITE_GET(GetColumnNumber, ReturnPositiveSmiOrNull)
+CALLSITE_GET(IsNative, ReturnBoolean)
+CALLSITE_GET(IsToplevel, ReturnBoolean)
+CALLSITE_GET(IsEval, ReturnBoolean)
+
+#undef CALLSITE_GET
+
+
RUNTIME_FUNCTION(Runtime_IS_VAR) {
UNREACHABLE(); // implemented as macro in the parser
return NULL;
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/mjsunit/compiler/regress-stacktrace.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698