File tree Expand file tree Collapse file tree 2 files changed +20
-18
lines changed Expand file tree Collapse file tree 2 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -166,23 +166,18 @@ void AppendExceptionLine(Environment* env,
166166 ABORT_NO_BACKTRACE ();
167167}
168168
169- [[noreturn]] void Assert (const char * const (*args)[4]) {
170- auto filename = (*args)[0 ];
171- auto linenum = (*args)[1 ];
172- auto message = (*args)[2 ];
173- auto function = (*args)[3 ];
174-
169+ [[noreturn]] void Assert (const AssertionInfo& info) {
175170 char name[1024 ];
176171 GetHumanReadableProcessName (&name);
177172
178173 fprintf (stderr,
179- " %s: %s:%s :%s%s Assertion `%s' failed.\n " ,
174+ " %s: %s:%u :%s%s Assertion `%s' failed.\n " ,
180175 name,
181- filename,
182- linenum,
183- function,
184- *function ? " :" : " " ,
185- message);
176+ info. filename ,
177+ info. linenum ,
178+ info. function ,
179+ *info. function ? " :" : " " ,
180+ info. message );
186181 fflush (stderr);
187182
188183 Abort ();
Original file line number Diff line number Diff line change @@ -85,10 +85,16 @@ 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 * filename;
92+ unsigned int linenum;
93+ const char * message;
94+ const char * function;
95+ };
96+ [[noreturn]] void Assert (const AssertionInfo& info);
9097[[noreturn]] void Abort ();
91- [[noreturn]] void Assert (const char * const (*args)[4]);
9298void DumpBacktrace (FILE* fp);
9399
94100#define DISALLOW_COPY_AND_ASSIGN (TypeName ) \
@@ -120,9 +126,10 @@ void DumpBacktrace(FILE* fp);
120126#define CHECK (expr ) \
121127 do { \
122128 if (UNLIKELY (!(expr))) { \
123- static const char * const args[] = { __FILE__, STRINGIFY (__LINE__), \
124- #expr, PRETTY_FUNCTION_NAME }; \
125- node::Assert (&args); \
129+ static const node::AssertionInfo args = { \
130+ __FILE__, __LINE__, #expr, PRETTY_FUNCTION_NAME \
131+ }; \
132+ node::Assert (args); \
126133 } \
127134 } while (0 )
128135
You can’t perform that action at this time.
0 commit comments