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

Side by Side Diff: src/checks.cc

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/checks.h ('k') | src/code-stubs.h » ('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 // 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 #include "src/checks.h" 5 #include "src/checks.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 11
12 intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; } 12 intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; }
13 13
14 } } // namespace v8::internal 14 } } // namespace v8::internal
15 15
16 16
17 static bool CheckEqualsStrict(volatile double* exp, volatile double* val) {
18 v8::internal::DoubleRepresentation exp_rep(*exp);
19 v8::internal::DoubleRepresentation val_rep(*val);
20 if (std::isnan(exp_rep.value) && std::isnan(val_rep.value)) return true;
21 return exp_rep.bits == val_rep.bits;
22 }
23
24
25 void CheckEqualsHelper(const char* file, int line, const char* expected_source,
26 double expected, const char* value_source,
27 double value) {
28 // Force values to 64 bit memory to truncate 80 bit precision on IA32.
29 volatile double* exp = new double[1];
30 *exp = expected;
31 volatile double* val = new double[1];
32 *val = value;
33 if (!CheckEqualsStrict(exp, val)) {
34 V8_Fatal(file, line,
35 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
36 expected_source, value_source, *exp, *val);
37 }
38 delete[] exp;
39 delete[] val;
40 }
41
42
43 void CheckNonEqualsHelper(const char* file, int line,
44 const char* expected_source, double expected,
45 const char* value_source, double value) {
46 // Force values to 64 bit memory to truncate 80 bit precision on IA32.
47 volatile double* exp = new double[1];
48 *exp = expected;
49 volatile double* val = new double[1];
50 *val = value;
51 if (CheckEqualsStrict(exp, val)) {
52 V8_Fatal(file, line,
53 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
54 expected_source, value_source, *exp, *val);
55 }
56 delete[] exp;
57 delete[] val;
58 }
59
60
17 void CheckEqualsHelper(const char* file, 61 void CheckEqualsHelper(const char* file,
18 int line, 62 int line,
19 const char* expected_source, 63 const char* expected_source,
20 v8::Handle<v8::Value> expected, 64 v8::Handle<v8::Value> expected,
21 const char* value_source, 65 const char* value_source,
22 v8::Handle<v8::Value> value) { 66 v8::Handle<v8::Value> value) {
23 if (!expected->Equals(value)) { 67 if (!expected->Equals(value)) {
24 v8::String::Utf8Value value_str(value); 68 v8::String::Utf8Value value_str(value);
25 v8::String::Utf8Value expected_str(expected); 69 v8::String::Utf8Value expected_str(expected);
26 V8_Fatal(file, line, 70 V8_Fatal(file, line,
27 "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s", 71 "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s",
28 expected_source, value_source, *expected_str, *value_str); 72 expected_source, value_source, *expected_str, *value_str);
29 } 73 }
30 } 74 }
31 75
32 76
33 void CheckNonEqualsHelper(const char* file, 77 void CheckNonEqualsHelper(const char* file,
34 int line, 78 int line,
35 const char* unexpected_source, 79 const char* unexpected_source,
36 v8::Handle<v8::Value> unexpected, 80 v8::Handle<v8::Value> unexpected,
37 const char* value_source, 81 const char* value_source,
38 v8::Handle<v8::Value> value) { 82 v8::Handle<v8::Value> value) {
39 if (unexpected->Equals(value)) { 83 if (unexpected->Equals(value)) {
40 v8::String::Utf8Value value_str(value); 84 v8::String::Utf8Value value_str(value);
41 V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %s", 85 V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %s",
42 unexpected_source, value_source, *value_str); 86 unexpected_source, value_source, *value_str);
43 } 87 }
44 } 88 }
OLDNEW
« no previous file with comments | « src/checks.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698