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: test/unittests/compiler/js-type-feedback-unittest.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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.h" 5 #include "src/compiler.h"
6 6
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 JSTypeFeedbackSpecializer::kDeoptimizationEnabled); 268 JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
269 269
270 // Check LoadNamed(global) => LoadField[PropertyCell::value](cell) 270 // Check LoadNamed(global) => LoadField[PropertyCell::value](cell)
271 ASSERT_TRUE(r.Changed()); 271 ASSERT_TRUE(r.Changed());
272 FieldAccess access = AccessBuilder::ForPropertyCellValue(); 272 FieldAccess access = AccessBuilder::ForPropertyCellValue();
273 Capture<Node*> cell_capture; 273 Capture<Node*> cell_capture;
274 Matcher<Node*> load_field_match = IsLoadField( 274 Matcher<Node*> load_field_match = IsLoadField(
275 access, CaptureEq(&cell_capture), graph()->start(), graph()->start()); 275 access, CaptureEq(&cell_capture), graph()->start(), graph()->start());
276 EXPECT_THAT(r.replacement(), load_field_match); 276 EXPECT_THAT(r.replacement(), load_field_match);
277 277
278 HeapObjectMatcher<PropertyCell> cell(cell_capture.value()); 278 HeapObjectMatcher cell(cell_capture.value());
279 EXPECT_TRUE(cell.HasValue()); 279 EXPECT_TRUE(cell.HasValue());
280 EXPECT_TRUE(cell.Value().handle()->IsPropertyCell()); 280 EXPECT_TRUE(cell.Value().handle()->IsPropertyCell());
281 281
282 EXPECT_THAT(ret, 282 EXPECT_THAT(ret,
283 IsReturn(load_field_match, load_field_match, graph()->start())); 283 IsReturn(load_field_match, load_field_match, graph()->start()));
284 EXPECT_THAT(graph()->end(), IsEnd(ret)); 284 EXPECT_THAT(graph()->end(), IsEnd(ret));
285 285
286 EXPECT_FALSE(dependencies()->IsEmpty()); 286 EXPECT_FALSE(dependencies()->IsEmpty());
287 dependencies()->Rollback(); 287 dependencies()->Rollback();
288 } 288 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 JSTypeFeedbackSpecializer::kDeoptimizationEnabled); 320 JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
321 321
322 // Check LoadNamed(global) => LoadField[PropertyCell::value](cell) 322 // Check LoadNamed(global) => LoadField[PropertyCell::value](cell)
323 ASSERT_TRUE(r.Changed()); 323 ASSERT_TRUE(r.Changed());
324 FieldAccess access = AccessBuilder::ForPropertyCellValue(); 324 FieldAccess access = AccessBuilder::ForPropertyCellValue();
325 Capture<Node*> cell_capture; 325 Capture<Node*> cell_capture;
326 Matcher<Node*> load_field_match = IsLoadField( 326 Matcher<Node*> load_field_match = IsLoadField(
327 access, CaptureEq(&cell_capture), graph()->start(), graph()->start()); 327 access, CaptureEq(&cell_capture), graph()->start(), graph()->start());
328 EXPECT_THAT(r.replacement(), load_field_match); 328 EXPECT_THAT(r.replacement(), load_field_match);
329 329
330 HeapObjectMatcher<PropertyCell> cell(cell_capture.value()); 330 HeapObjectMatcher cell(cell_capture.value());
331 EXPECT_TRUE(cell.HasValue()); 331 EXPECT_TRUE(cell.HasValue());
332 EXPECT_TRUE(cell.Value().handle()->IsPropertyCell()); 332 EXPECT_TRUE(cell.Value().handle()->IsPropertyCell());
333 333
334 EXPECT_THAT(ret, 334 EXPECT_THAT(ret,
335 IsReturn(load_field_match, load_field_match, graph()->start())); 335 IsReturn(load_field_match, load_field_match, graph()->start()));
336 EXPECT_THAT(graph()->end(), IsEnd(ret)); 336 EXPECT_THAT(graph()->end(), IsEnd(ret));
337 337
338 EXPECT_FALSE(dependencies()->IsEmpty()); 338 EXPECT_FALSE(dependencies()->IsEmpty());
339 dependencies()->Rollback(); 339 dependencies()->Rollback();
340 } 340 }
341 341
342 } // namespace compiler 342 } // namespace compiler
343 } // namespace internal 343 } // namespace internal
344 } // namespace v8 344 } // namespace v8
OLDNEW
« src/compiler/control-reducer.cc ('K') | « test/cctest/compiler/test-representation-change.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698