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

Side by Side Diff: src/base/logging.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_BASE_LOGGING_H_ 5 #ifndef V8_BASE_LOGGING_H_
6 #define V8_BASE_LOGGING_H_ 6 #define V8_BASE_LOGGING_H_
7 7
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "include/v8stdint.h" 10 #include "include/v8stdint.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 const void* expected, 145 const void* expected,
146 const char* value_source, 146 const char* value_source,
147 const void* value) { 147 const void* value) {
148 if (expected == value) { 148 if (expected == value) {
149 V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %p", 149 V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %p",
150 expected_source, value_source, value); 150 expected_source, value_source, value);
151 } 151 }
152 } 152 }
153 153
154 154
155 // Helper function used by the CHECK function when given floating
156 // point arguments. Should not be called directly.
157 inline void CheckEqualsHelper(const char* file,
158 int line,
159 const char* expected_source,
160 double expected,
161 const char* value_source,
162 double value) {
163 // Force values to 64 bit memory to truncate 80 bit precision on IA32.
164 volatile double* exp = new double[1];
165 *exp = expected;
166 volatile double* val = new double[1];
167 *val = value;
168 if (*exp != *val) {
169 V8_Fatal(file, line,
170 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
171 expected_source, value_source, *exp, *val);
172 }
173 delete[] exp;
174 delete[] val;
175 }
176
177
178 inline void CheckNonEqualsHelper(const char* file, 155 inline void CheckNonEqualsHelper(const char* file,
179 int line, 156 int line,
180 const char* expected_source, 157 const char* expected_source,
181 int64_t expected, 158 int64_t expected,
182 const char* value_source, 159 const char* value_source,
183 int64_t value) { 160 int64_t value) {
184 if (expected == value) { 161 if (expected == value) {
185 V8_Fatal(file, line, 162 V8_Fatal(file, line,
186 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", 163 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
187 expected_source, value_source, expected, value); 164 expected_source, value_source, expected, value);
188 } 165 }
189 } 166 }
190 167
191 168
192 inline void CheckNonEqualsHelper(const char* file,
193 int line,
194 const char* expected_source,
195 double expected,
196 const char* value_source,
197 double value) {
198 // Force values to 64 bit memory to truncate 80 bit precision on IA32.
199 volatile double* exp = new double[1];
200 *exp = expected;
201 volatile double* val = new double[1];
202 *val = value;
203 if (*exp == *val) {
204 V8_Fatal(file, line,
205 "CHECK_NE(%s, %s) failed\n# Value: %f",
206 expected_source, value_source, *val);
207 }
208 delete[] exp;
209 delete[] val;
210 }
211
212
213 #define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \ 169 #define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \
214 #expected, expected, #value, value) 170 #expected, expected, #value, value)
215 171
216 172
217 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \ 173 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
218 #unexpected, unexpected, #value, value) 174 #unexpected, unexpected, #value, value)
219 175
220 176
221 #define CHECK_GT(a, b) CHECK((a) > (b)) 177 #define CHECK_GT(a, b) CHECK((a) > (b))
222 #define CHECK_GE(a, b) CHECK((a) >= (b)) 178 #define CHECK_GE(a, b) CHECK((a) >= (b))
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 214
259 // "Extra checks" are lightweight checks that are enabled in some release 215 // "Extra checks" are lightweight checks that are enabled in some release
260 // builds. 216 // builds.
261 #ifdef ENABLE_EXTRA_CHECKS 217 #ifdef ENABLE_EXTRA_CHECKS
262 #define EXTRA_CHECK(condition) CHECK(condition) 218 #define EXTRA_CHECK(condition) CHECK(condition)
263 #else 219 #else
264 #define EXTRA_CHECK(condition) ((void) 0) 220 #define EXTRA_CHECK(condition) ((void) 0)
265 #endif 221 #endif
266 222
267 #endif // V8_BASE_LOGGING_H_ 223 #endif // V8_BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698