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

Unified Diff: src/builtins.cc

Issue 1868513002: [runtime] reduce runtime function and builtins overhead (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: commit ALL files Created 4 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/arguments.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index ba57637b98f37280b50cf06dbaa19d2a75c46e77..ed6b69dd830c40342b6c9d349b0d017aa4a75d1d 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -138,25 +138,29 @@ BUILTIN_LIST_C(DEF_ARG_TYPE)
//
// In the body of the builtin function the arguments can be accessed
// through the BuiltinArguments object args.
-
+// TODO(cbruni): add global flag to check whether any tracing events have been
+// enabled.
#define BUILTIN(name) \
MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \
Isolate* isolate); \
- MUST_USE_RESULT static Object* Builtin_##name( \
+ \
+ V8_NOINLINE static Object* Builtin_Impl_Stats_##name( \
int args_length, Object** args_object, Isolate* isolate) { \
- Object* value; \
- isolate->counters()->runtime_calls()->Increment(); \
+ name##ArgumentsType args(args_length, args_object); \
+ RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \
+ RuntimeCallTimerScope timer(isolate, &stats->Builtin_##name); \
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \
"V8.Builtin_" #name); \
- name##ArgumentsType args(args_length, args_object); \
+ return Builtin_Impl_##name(args, isolate); \
+ } \
+ \
+ MUST_USE_RESULT static Object* Builtin_##name( \
+ int args_length, Object** args_object, Isolate* isolate) { \
if (FLAG_runtime_call_stats) { \
- RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \
- RuntimeCallTimerScope timer(isolate, &stats->Builtin_##name); \
- value = Builtin_Impl_##name(args, isolate); \
- } else { \
- value = Builtin_Impl_##name(args, isolate); \
+ return Builtin_Impl_Stats_##name(args_length, args_object, isolate); \
} \
- return value; \
+ name##ArgumentsType args(args_length, args_object); \
+ return Builtin_Impl_##name(args, isolate); \
} \
\
MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \
@@ -164,7 +168,6 @@ BUILTIN_LIST_C(DEF_ARG_TYPE)
// ----------------------------------------------------------------------------
-
#define CHECK_RECEIVER(Type, name, method) \
if (!args.receiver()->Is##Type()) { \
THROW_NEW_ERROR_RETURN_FAILURE( \
« no previous file with comments | « src/arguments.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698