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

Side by Side Diff: test/cctest/compiler/test-representation-change.cc

Issue 1196623002: [ubsan] Fix HeapObjectMatcher to avoid invalid casts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <limits> 5 #include <limits>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 #include "test/cctest/compiler/codegen-tester.h" 9 #include "test/cctest/compiler/codegen-tester.h"
10 #include "test/cctest/compiler/graph-builder-tester.h" 10 #include "test/cctest/compiler/graph-builder-tester.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 CheckDoubleEq(expected, m.Value()); 62 CheckDoubleEq(expected, m.Value());
63 } 63 }
64 64
65 void CheckFloat32Constant(Node* n, float expected) { 65 void CheckFloat32Constant(Node* n, float expected) {
66 CHECK_EQ(IrOpcode::kFloat32Constant, n->opcode()); 66 CHECK_EQ(IrOpcode::kFloat32Constant, n->opcode());
67 float fval = OpParameter<float>(n->op()); 67 float fval = OpParameter<float>(n->op());
68 CHECK_EQ(expected, fval); 68 CHECK_EQ(expected, fval);
69 } 69 }
70 70
71 void CheckHeapConstant(Node* n, HeapObject* expected) { 71 void CheckHeapConstant(Node* n, HeapObject* expected) {
72 HeapObjectMatcher<HeapObject> m(n); 72 HeapObjectMatcher m(n);
73 CHECK(m.HasValue()); 73 CHECK(m.HasValue());
74 CHECK_EQ(expected, *m.Value().handle()); 74 CHECK_EQ(expected, *m.Value().handle());
75 } 75 }
76 76
77 void CheckNumberConstant(Node* n, double expected) { 77 void CheckNumberConstant(Node* n, double expected) {
78 NumberMatcher m(n); 78 NumberMatcher m(n);
79 CHECK_EQ(IrOpcode::kNumberConstant, n->opcode()); 79 CHECK_EQ(IrOpcode::kNumberConstant, n->opcode());
80 CHECK(m.HasValue()); 80 CHECK(m.HasValue());
81 CheckDoubleEq(expected, m.Value()); 81 CheckDoubleEq(expected, m.Value());
82 } 82 }
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64); 544 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64);
545 545
546 for (size_t i = 0; i < arraysize(all_reps); i++) { 546 for (size_t i = 0; i < arraysize(all_reps); i++) {
547 for (size_t j = 0; j < arraysize(all_reps); j++) { 547 for (size_t j = 0; j < arraysize(all_reps); j++) {
548 if (i == j) continue; 548 if (i == j) continue;
549 // Only a single from representation is allowed. 549 // Only a single from representation is allowed.
550 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged); 550 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged);
551 } 551 }
552 } 552 }
553 } 553 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698