@@ -85,10 +85,15 @@ extern bool v8_initialized;
8585// whether V8 is initialized.
8686void LowMemoryNotification ();
8787
88- // The slightly odd function signature for Assert() is to ease
89- // instruction cache pressure in calls from CHECK.
88+ // The reason that Assert() takes a struct argument instead of individual
89+ // const char*s is to ease instruction cache pressure in calls from CHECK.
90+ struct AssertionInfo {
91+ const char * file_line; // filename:line
92+ const char * message;
93+ const char * function;
94+ };
95+ [[noreturn]] void Assert (const AssertionInfo& info);
9096[[noreturn]] void Abort ();
91- [[noreturn]] void Assert (const char * const (*args)[4]);
9297void DumpBacktrace (FILE* fp);
9398
9499#define DISALLOW_COPY_AND_ASSIGN (TypeName ) \
@@ -120,9 +125,12 @@ void DumpBacktrace(FILE* fp);
120125#define CHECK (expr ) \
121126 do { \
122127 if (UNLIKELY (!(expr))) { \
123- static const char * const args[] = { __FILE__, STRINGIFY (__LINE__), \
124- #expr, PRETTY_FUNCTION_NAME }; \
125- node::Assert (&args); \
128+ /* Make sure that this struct does not end up in inline code, but */ \
129+ /* rather in a read-only data section when modifying this code. */ \
130+ static const node::AssertionInfo args = { \
131+ __FILE__ " :" STRINGIFY (__LINE__), #expr, PRETTY_FUNCTION_NAME \
132+ }; \
133+ node::Assert (args); \
126134 } \
127135 } while (0 )
128136
0 commit comments