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

Side by Side Diff: src/checks.h

Issue 619005: Fast algorithm for double->string conversion. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 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/cached_powers.h ('k') | src/conversions.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 static inline void CheckEqualsHelper(const char* file, int line, 73 static inline void CheckEqualsHelper(const char* file, int line,
74 const char* expected_source, int expected, 74 const char* expected_source, int expected,
75 const char* value_source, int value) { 75 const char* value_source, int value) {
76 if (expected != value) { 76 if (expected != value) {
77 V8_Fatal(file, line, 77 V8_Fatal(file, line,
78 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i", 78 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i",
79 expected_source, value_source, expected, value); 79 expected_source, value_source, expected, value);
80 } 80 }
81 } 81 }
82 82
83
83 // Helper function used by the CHECK_EQ function when given int64_t 84 // Helper function used by the CHECK_EQ function when given int64_t
84 // arguments. Should not be called directly. 85 // arguments. Should not be called directly.
85 static inline void CheckEqualsHelper(const char* file, int line, 86 static inline void CheckEqualsHelper(const char* file, int line,
86 const char* expected_source, 87 const char* expected_source,
87 int64_t expected, 88 int64_t expected,
88 const char* value_source, 89 const char* value_source,
89 int64_t value) { 90 int64_t value) {
90 if (expected != value) { 91 if (expected != value) {
91 // Print int64_t values in hex, as two int32s, 92 // Print int64_t values in hex, as two int32s,
92 // to avoid platform-dependencies. 93 // to avoid platform-dependencies.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (*exp != *val) { 196 if (*exp != *val) {
196 V8_Fatal(file, line, 197 V8_Fatal(file, line,
197 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", 198 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
198 expected_source, value_source, *exp, *val); 199 expected_source, value_source, *exp, *val);
199 } 200 }
200 delete[] exp; 201 delete[] exp;
201 delete[] val; 202 delete[] val;
202 } 203 }
203 204
204 205
206 static inline void CheckNonEqualsHelper(const char* file,
207 int line,
208 const char* expected_source,
209 double expected,
210 const char* value_source,
211 double value) {
212 // Force values to 64 bit memory to truncate 80 bit precision on IA32.
213 volatile double* exp = new double[1];
214 *exp = expected;
215 volatile double* val = new double[1];
216 *val = value;
217 if (*exp == *val) {
218 V8_Fatal(file, line,
219 "CHECK_NE(%s, %s) failed\n# Value: %f",
220 expected_source, value_source, *val);
221 }
222 delete[] exp;
223 delete[] val;
224 }
225
226
205 namespace v8 { 227 namespace v8 {
206 class Value; 228 class Value;
207 template <class T> class Handle; 229 template <class T> class Handle;
208 } 230 }
209 231
210 232
211 void CheckNonEqualsHelper(const char* file, 233 void CheckNonEqualsHelper(const char* file,
212 int line, 234 int line,
213 const char* unexpected_source, 235 const char* unexpected_source,
214 v8::Handle<v8::Value> unexpected, 236 v8::Handle<v8::Value> unexpected,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 299
278 300
279 #define ASSERT_TAG_ALIGNED(address) \ 301 #define ASSERT_TAG_ALIGNED(address) \
280 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0) 302 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0)
281 303
282 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) 304 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0)
283 305
284 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 306 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
285 307
286 #endif // V8_CHECKS_H_ 308 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « src/cached_powers.h ('k') | src/conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698