49#define OOJS_PROFILE OOLITE_DEBUG
53#define OOJS_PROFILE_ENTER_NAMED(NAME) \
55 OOJS_DECLARE_PROFILE_STACK_FRAME(oojsProfilerStackFrame) \
57 OOJSProfileEnter(&oojsProfilerStackFrame, NAME);
59#define OOJS_PROFILE_ENTER \
60 OOJS_PROFILE_ENTER_NAMED(__FUNCTION__)
62#define OOJS_PROFILE_EXIT_VAL(rval) \
66 OOJSProfileExit(&oojsProfilerStackFrame); \
68 OOJSUnreachable(__FUNCTION__, __FILE__, __LINE__); \
71#define OOJS_PROFILE_EXIT_VOID \
73 OOJS_PROFILE_EXIT_VAL()
75#define OOJS_PROFILE_ENTER_FOR_NATIVE OOJS_PROFILE_ENTER
79#define OOJS_PROFILE_ENTER {
80#define OOJS_PROFILE_EXIT_VAL(rval) \
82 OOJSUnreachable(__FUNCTION__, __FILE__, __LINE__); \
84#define OOJS_PROFILE_EXIT_VOID \
87#define OOJS_PROFILE_ENTER_FOR_NATIVE @try {
91#define OOJS_NATIVE_ENTER(cx) \
93 JSContext* oojsNativeContext = (cx); \
94 OOJS_PROFILE_ENTER_FOR_NATIVE
96#define OOJS_NATIVE_EXIT \
98 @catch (id exception) \
100 OOJSReportWrappedException(oojsNativeContext, exception); \
102 OOJS_PROFILE_EXIT_VAL(NO) \
110#define OOJSUnreachable(function, file, line) OO_UNREACHABLE()
113#define OOJS_PROFILE_EXIT OOJS_PROFILE_EXIT_VAL(0)
114#define OOJS_PROFILE_EXIT_JSVAL OOJS_PROFILE_EXIT_VAL(JSVAL_VOID)
129#define OOJS_BEGIN_FULL_NATIVE(context) \
131 OOJSPauseTimeLimiter(); \
132 JSContext* oojsRequestContext = (context); \
133 jsrefcount oojsRequestRefCount = JS_SuspendRequest(oojsRequestContext); \
136#define OOJS_END_FULL_NATIVE \
140 JS_ResumeRequest(oojsRequestContext, oojsRequestRefCount); \
141 OOJSResumeTimeLimiter(); \
145#define OOJS_BEGIN_FULL_NATIVE(context) \
148 OOJSPauseTimeLimiter(); \
151#define OOJS_END_FULL_NATIVE \
155 OOJSResumeTimeLimiter(); \
170typedef struct OOJSProfileStackFrame OOJSProfileStackFrame;
171struct OOJSProfileStackFrame {
172 OOJSProfileStackFrame* back;
174 const char* function;
178 void (*cleanup)(OOJSProfileStackFrame*);
181#define OOJS_DECLARE_PROFILE_STACK_FRAME(name) OOJSProfileStackFrame name;
187#define OOJS_DECLARE_PROFILE_STACK_FRAME(name)
188#define OOJSProfileEnter(frame, function) \
191#define OOJSProfileExit(frame) \
void OOJSReportWrappedException(JSContext *context, id exception)
#define OOJSProfileExit(frame)
#define OOJSProfileEnter(frame, function)
void OOJSUnreachable(const char *function, const char *file, unsigned line) NO_RETURN_FUNC
uint64_t OOHighResTimeValue