@@ -85,10 +85,15 @@ extern bool v8_initialized;
85
85
// whether V8 is initialized.
86
86
void LowMemoryNotification ();
87
87
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);
90
96
[[noreturn]] void Abort ();
91
- [[noreturn]] void Assert (const char * const (*args)[4]);
92
97
void DumpBacktrace (FILE* fp);
93
98
94
99
#define DISALLOW_COPY_AND_ASSIGN (TypeName ) \
@@ -120,9 +125,12 @@ void DumpBacktrace(FILE* fp);
120
125
#define CHECK (expr ) \
121
126
do { \
122
127
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); \
126
134
} \
127
135
} while (0 )
128
136
0 commit comments