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

Side by Side Diff: src/compiler/common-operator-reducer.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 "src/compiler/common-operator-reducer.h" 5 #include "src/compiler/common-operator-reducer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 13 matching lines...) Expand all
24 switch (cond->opcode()) { 24 switch (cond->opcode()) {
25 case IrOpcode::kInt32Constant: { 25 case IrOpcode::kInt32Constant: {
26 Int32Matcher mcond(cond); 26 Int32Matcher mcond(cond);
27 return mcond.Value() ? Decision::kTrue : Decision::kFalse; 27 return mcond.Value() ? Decision::kTrue : Decision::kFalse;
28 } 28 }
29 case IrOpcode::kInt64Constant: { 29 case IrOpcode::kInt64Constant: {
30 Int64Matcher mcond(cond); 30 Int64Matcher mcond(cond);
31 return mcond.Value() ? Decision::kTrue : Decision::kFalse; 31 return mcond.Value() ? Decision::kTrue : Decision::kFalse;
32 } 32 }
33 case IrOpcode::kHeapConstant: { 33 case IrOpcode::kHeapConstant: {
34 HeapObjectMatcher<HeapObject> mcond(cond); 34 HeapObjectMatcher mcond(cond);
35 return mcond.Value().handle()->BooleanValue() ? Decision::kTrue 35 return mcond.Value().handle()->BooleanValue() ? Decision::kTrue
36 : Decision::kFalse; 36 : Decision::kFalse;
37 } 37 }
38 default: 38 default:
39 return Decision::kUnknown; 39 return Decision::kUnknown;
40 } 40 }
41 } 41 }
42 42
43 } // namespace 43 } // namespace
44 44
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 node->set_op(op); 303 node->set_op(op);
304 node->ReplaceInput(0, a); 304 node->ReplaceInput(0, a);
305 node->ReplaceInput(1, b); 305 node->ReplaceInput(1, b);
306 node->TrimInputCount(2); 306 node->TrimInputCount(2);
307 return Changed(node); 307 return Changed(node);
308 } 308 }
309 309
310 } // namespace compiler 310 } // namespace compiler
311 } // namespace internal 311 } // namespace internal
312 } // namespace v8 312 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698