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

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, 10 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
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.
93 V8_Fatal(file, line, 94 V8_Fatal(file, line,
94 "CHECK_EQ(%s, %s) failed\n#" 95 "CHECK_EQ(%s, %s) failed\n#"
95 " Expected: 0x%08x%08x\n# Found: 0x%08x%08x", 96 " Expected: 0x%08x%08x\n# Found: 0x%08x%08x",
96 expected_source, value_source, 97 expected_source, value_source,
97 static_cast<uint32_t>(expected >> 32), 98 static_cast<uint32_t>(expected >> 32),
98 static_cast<uint32_t>(expected), 99 static_cast<uint32_t>(expected),
99 static_cast<uint32_t>(value >> 32), 100 static_cast<uint32_t>(value >> 32),
100 static_cast<uint32_t>(value)); 101 static_cast<uint32_t>(value));
101 } 102 }
102 } 103 }
103 104
104 105
106 // Helper function used by the CHECK_EQ function when given uint64_t
107 // arguments. Should not be called directly.
108 static inline void CheckEqualsHelper(const char* file, int line,
109 const char* expected_source,
110 uint64_t expected,
111 const char* value_source,
112 uint64_t value) {
113 if (expected != value) {
114 // Print int64_t values in hex, as two int32s,
115 // to avoid platform-dependencies.
116 V8_Fatal(file, line,
117 "CHECK_EQ(%s, %s) failed\n#"
118 " Expected: 0x%08x%08x\n# Found: 0x%08x%08x",
119 expected_source, value_source,
120 static_cast<uint32_t>(expected >> 32),
121 static_cast<uint32_t>(expected),
122 static_cast<uint32_t>(value >> 32),
123 static_cast<uint32_t>(value));
124 }
125 }
126
127
105 // Helper function used by the CHECK_NE function when given int 128 // Helper function used by the CHECK_NE function when given int
106 // arguments. Should not be called directly. 129 // arguments. Should not be called directly.
107 static inline void CheckNonEqualsHelper(const char* file, 130 static inline void CheckNonEqualsHelper(const char* file,
108 int line, 131 int line,
109 const char* unexpected_source, 132 const char* unexpected_source,
110 int unexpected, 133 int unexpected,
111 const char* value_source, 134 const char* value_source,
112 int value) { 135 int value) {
113 if (unexpected == value) { 136 if (unexpected == value) {
114 V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %i", 137 V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %i",
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (*exp != *val) { 216 if (*exp != *val) {
194 V8_Fatal(file, line, 217 V8_Fatal(file, line,
195 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", 218 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
196 expected_source, value_source, *exp, *val); 219 expected_source, value_source, *exp, *val);
197 } 220 }
198 delete[] exp; 221 delete[] exp;
199 delete[] val; 222 delete[] val;
200 } 223 }
201 224
202 225
226 static inline void CheckNonEqualsHelper(const char* file,
227 int line,
228 const char* expected_source,
229 double expected,
230 const char* value_source,
231 double value) {
232 // Force values to 64 bit memory to truncate 80 bit precision on IA32.
233 volatile double* exp = new double[1];
234 *exp = expected;
235 volatile double* val = new double[1];
236 *val = value;
237 if (*exp == *val) {
238 V8_Fatal(file, line,
239 "CHECK_NE(%s, %s) failed\n# Value: %f",
240 expected_source, value_source, *val);
241 }
242 delete[] exp;
243 delete[] val;
244 }
245
246
203 namespace v8 { 247 namespace v8 {
204 class Value; 248 class Value;
205 template <class T> class Handle; 249 template <class T> class Handle;
206 } 250 }
207 251
208 252
209 void CheckNonEqualsHelper(const char* file, 253 void CheckNonEqualsHelper(const char* file,
210 int line, 254 int line,
211 const char* unexpected_source, 255 const char* unexpected_source,
212 v8::Handle<v8::Value> unexpected, 256 v8::Handle<v8::Value> unexpected,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 319
276 320
277 #define ASSERT_TAG_ALIGNED(address) \ 321 #define ASSERT_TAG_ALIGNED(address) \
278 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0) 322 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0)
279 323
280 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) 324 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0)
281 325
282 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 326 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
283 327
284 #endif // V8_CHECKS_H_ 328 #endif // V8_CHECKS_H_
OLDNEW
« src/cached_powers.h ('K') | « src/cached_powers.h ('k') | src/conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698